-
-
Notifications
You must be signed in to change notification settings - Fork 41
Set parameters
You can set the inverter parameter by set custom commands, get the commands list from the protocols
/DeviceControl/Set_Command
you can write all commands listed in the protocol.
Warning, it have no syntax check or something, use careful
The Response of the Set_Command will be sent to /DeviceControl/Set_Command_answer
"Set paramters" is not a menue item of Solar2MQTT. It is a MQTT Adresse's part, which serves to send and receive messages to and from the inverter. You may ask something "Tell the daily production" or you may command something "use Grid only".
Warning: Commands are not checked by Solar2MQTT. Incorrect commands can damage the inverter or whatsoever. Command lists can be found here: https://github.com/softwarecrash/Solar2MQTT/tree/master/Protocol
Summary: A MQTT message to "Set_Paramters" is evaluated by Solar2MQTT and forwarded to the inverter. The response from the inverter is published by Solar2MQTT as "Set_Command_answer". Read further to understand, what this means.
The following explains how messages "Set_Paramters" can be sent manually with the program MQTT Explorer and can bei received as "Set_Command_answer".
First find out the "MQTT Topic" of Solar2MQTT. It is displayed in the Solar2MQTT menu under "Edit Configuration". The MQTT topic usually matches the "Device Name" with which Solar2MQTT is registered in the WLAN. Here, and in all the following examples, the "MQTT Topic" will be „HAS2ML1“ as an example. „HAS2ML1“ is a just placeholder name. Your Solar2MQTT will have definitely another "MQTT Topic", maybe "Solar1" or something else.
There are various protocols with which inverters receive commands. The most common are the PI30 and P18 protocols. The names may differ, but will be somehow similar. The MQTT Explorer can be used to display the protocol number.
The MQTT Explorer can be used to read out the "Protocol ID" of the inverter. In this case it is "18". Reminder: „HAS2ML1“ is an example "MQTT topic" used in this explanation. Your „MQTT topic“ will be different, for shure.
If you know your "MQTT topic" and also your "Protocol ID" you can start to send commands to your inverter and receive it's answer.
The item numbers refer to the numbering of the picture above.
-
Enter
HAS2ML1/DeviceControl/Set\_Command
in the "Publish" area under "Topic". Of course, again, your "MQTT Topic" will not be HAS2ML1", it is just an example. -
Mark "raw" so that the message is published unchanged
-
Enter the message content: For the PI30 protocol, enter QPI This message asks for the protocol. For the P18 protocol, enter ^P005PI This message asks for the protocol. If you do not know which protocol your inverter has, simply try both. Push the „PUBLISH“-Button.
-
The MQTT Explorer publishes the message under "Set_Command", Solar2MQTT will evaluate the message and forward it to the inverter.
-
Solar2MQTT receives the response from the inverter and publishes it under "Set_Command_answer". For the PI30 protocol, the response will be „PI“ or somewhat similar. For the P18 protocol, the response will be „18“.
For further messages you only have to mark the correct line at (4), then it's text is at (1) automatically adopted.
For the P18 protocol you may also try ^P004T This should display the date and time at (5): 20240215204556 = 2024 02 15...
For the PI30 protocol, you may also try QID This should display the serial number.
As an alternative to points (1) and (2), the message can also be sent with Solar2MQTT using the "WebSerial" menu item (see "WebSerial" in the Solar2MQTT wiki). The result for points (4) and (5) should be the same.
As an alternative to the MQTT Explorer, you may also use the HomeAssistant to send and receive messages manually.
-
Type at
Settings > Device & Services > MQTT > CONFIGURE > Listen to a topic
-->HAS2ML1/DeviceControl/Set\_Command\_answer
where „HAS2ML1“ is to be replaced by your own "MQTT Topic". -
START LISTENING
-
Type at
Settings > Device & Services > MQTT > CONFIGURE > Publish a packet
-->HAS2ML1/DeviceControl/Set\_Command
and of course replace „HAS2ML1“ with your own "MQTT Topic". -
Enter the message content and send: For the PI30 protocol, enter QPI This message asks for the protocol. For the P18 protocol, enter ^P005PI This message asks for the protocol. If you do not know which protocol the inverter has, simply try both.
-
PRESS PUBLISH
-
After a few seconds the answer appears: 18 for the P18 protocol.
This chapter explains how to integrate the "Set_Command_answer" response from the inverter into the HomeAssistant’s dashboard. First read some Advance information:
The MQTT Explorer displays the MQTT topic "HAS2ML1", which is used as an example in these instructions, in two places:
-
Firstly directly at "HAS2ML1". This contains (only) numbers as messages from the inverter. They are constantly updated.
-
Secondly at "homeassistant > sensor > HAS2ML1". The information at this point is evaluated by the HomeAssistant. Here is defined how the numbers meaning is. How should be called, where they can be found, what units they have, etc. This information is read in once when the HomeAssistant is started (and not repeatedly).This information is called "Discovery Messages".
To display the "Set_Command_answer" message on the dashboard, a Discovery Message must be created. To do this, we will fetch a template and modify it.
-
Mark
homeassistant/sensor/HAS2ML1/AC\_in\_rating\_current/config
-
Make sure that you work in the section "Value"
-
Copy from this lokation. It is your template.
Your template will be somehow like this:
{
"name": "AC_in_rating_current",
"stat_t": "HAS2ML1/DeviceData/AC_in_rating_current",
"uniq_id": "HAS2ML1-F927FD.AC_in_rating_current",
"ic": "mdi:current-ac",
"unit_of_meas": "A",
"dev_cla": "current",
"dev": {
"ids": [
"HAS2ML1-F927FD"
],
"name": "HAS2ML1",
"cu": "http://192.168.49.92",
"mdl": "null",
"mf": "SoftWareCrash",
"sw": "1.1.6_ESP01"
}
}
Cange it to the following form. This will be your new "Discovery Message".
{
"name": "Set_Command_answer",
"stat_t": "HAS2ML1/DeviceControl/Set_Command_answer",
"uniq_id": "HAS2ML1-F927FD.Set_Command_answer",
"ic": "mdi:eye",
"dev": {
"ids": [
"HAS2ML1-F927FD"
],
"name": "HAS2ML1",
"cu": "http://192.168.49.92",
"mdl": "null",
"mf": "SoftWareCrash",
"sw": "1.1.6_ESP01"
}
}
-
Replace three times „AC_in_rating_current" with „Set_Command_answer“.
-
Change „current-ac“ to „eye“
-
Delete the full row: "unit_of_meas": "Wh",
-
Delete the full row: "dev_cla": "current", You should delete this two rows, because the "Set_Command_answer" will be numbers and text messages and so on, but they don't have units. Homeassistant will not display any text, if there ist a "unit" set.
In the next step you publish your new "Discovery Message" so that HomeAssistant can recognize it. Use the MQTT Explorer.
-
Work inside the "Publish" area
-
homeassistant/sensor/HAS2ML1/Set\_Command\_answer/config
<-- This is where it should go -
"json" (select data format).
-
Insert your "Discovery Message"
-
Mark "retain" = "keep". This means (presumably): Although Solar2MQTT regenerates the "Discovery Messages" every time it is restarted (power failure etc.), this entry should be retained in the MQTT broker. And press "PUBLISH".
-
Your "Discovery message" should pop up at position (6).
Finally restart HomeAssistant completely, as it only reads the "Discovery Messages" once with every restart.
"Developer tools > CHECK CONFIGURATION" and "Developer tools > RESTART > Restart Home Assistant".
-
"Set_Command_answer" should appear in the "Overview" dashboard.
-
If the value "18" or whatever is still not displayed, then send QPI or ^P005PI again as described above.
If you don't have the willingness to tinker and learn... TURN BACK!
This project is not a commercial product and support is limited. You have to be willing to research and solve potential problems you