Skip to content

Set parameters

ManuA edited this page Oct 8, 2024 · 13 revisions

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

HomeAssistant (By ESP64)

Set Parameters

"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.

Send and receive messages manually with the MQTT EXPLORER

The following explains how messages "Set_Paramters" can be sent manually with the program MQTT Explorer and can bei received as "Set_Command_answer".

Preparation 01: Reading out the MQTT topic

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.

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 001

Preparation 02: Read out the protocol ID with the MQTT Explorer

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.

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 002

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.

Send and receive MQTT messages manually with the MQTT Explorer

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.

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 003

The item numbers refer to the numbering of the picture above.

  1. 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.

  2. Mark "raw" so that the message is published unchanged

  3. 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.

  4. The MQTT Explorer publishes the message under "Set_Command", Solar2MQTT will evaluate the message and forward it to the inverter.

  5. 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.

Send and receive MQTT messages manually with the HomeAssistant

As an alternative to the MQTT Explorer, you may also use the HomeAssistant to send and receive messages manually.

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 004

  1. 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".

  2. START LISTENING

  3. Type at Settings > Device & Services > MQTT > CONFIGURE > Publish a packet --> HAS2ML1/DeviceControl/Set_Command and of course replace „HAS2ML1“ with your own "MQTT Topic".

  4. 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.

  5. PRESS PUBLISH

  6. After a few seconds the answer appears: 18 for the P18 protocol.

Display MQTT messages on the HomeAssistant’s dashboard

This chapter explains how to integrate the "Set_Command_answer" response from the inverter into the HomeAssistant’s dashboard. First read some Advance information:

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 005

The MQTT Explorer displays the MQTT topic "HAS2ML1", which is used as an example in these instructions, in two places:

  1. Firstly directly at "HAS2ML1". This contains (only) numbers as messages from the inverter. They are constantly updated.

  2. 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.

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 006

  1. Mark homeassistant/sensor/HAS2ML1/AC_in_rating_current/config

  2. Make sure that you work in the section "Value"

  3. 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"
  }
}
  1. Replace three times „AC_in_rating_current" with „Set_Command_answer“.

  2. Change „current-ac“ to „eye“

  3. Delete the full row: "unit_of_meas": "Wh",

  4. 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.

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 007

  1. Work inside the "Publish" area

  2. homeassistant/sensor/HAS2ML1/Set_Command_answer/config <-- This is where it should go

  3. "json" (select data format).

  4. Insert your "Discovery Message"

  5. 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".

  6. 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".

Aspose Words d82af1a1-69df-4f17-9026-c38119402117 008

  1. "Set_Command_answer" should appear in the "Overview" dashboard.

  2. If the value "18" or whatever is still not displayed, then send QPI or ^P005PI again as described above.