Skip to content

10 MOSQUITTO

patience4711 edited this page Jun 9, 2023 · 5 revisions

PURPOSE

With the help of mosquitto you can share the inverterdata with Thingspeak, Home assistant, Domoticz, or other home automation systems. If you are not familiair with mosquitto, please google to find information about concepts such as broker, topic, etc.

settings

You should enable mosquitto in the the mosquitto page. You do this by choosing one of the available mqtt formats. In the infopage you can check the state of mosquitto (should be connected). In the console you can try 10;testmqtt to debug

WORKING

The results of the pollings are sent in the chosen format. This is mostly a json format. For example if your chosen format is 1, the mosquitto message will have the form {"inv_serial" : "xxxxxxxxxxxx","idx" : xxx, "nvalue" : 0,"svalue" : "90;2975.00"} so it contains also the idx of the inverter. This idx is used by Domoticz to identify the device. Other formats are:

  • format 2:{"inv_serial":"123456789012","temp":"12,3","p0":"123","p1":"123","p2":"123","p3":"123","energy":"345"}
  • format 3: {"inv_serial":"408000158211","acv":226.2,"freq":50.0,"temp":18.0,"dcv":[36.8,37.0],"dcc":[4.3,3.0],"pwr":[123.4,123.5],"en":[174.35,178.44]}
  • format 4: {"inv_serial":"408000158211","acv":226.2,"freq":50.0,"temp":18.0,"ch0":[dc-volt,dc-current,power,enenergy],"ch1":[37.0,3.0,123.5,178.44], totals[power, energy]}
  • format 5: field1=invnr&field2=temperature&field3=p0&field4=p1&field5=p2&field6=p3&field7=energy&status=MQTTPUBLISH (for thingspeak)

For inverters with 4 channels the other two chanels are added.

retain flag

The formats 3 and 4 have the retain flag set.

values

  • temp = temperature in degrees celcius
  • acv = ac voltage
  • freq - the ac frequency
  • p0 = power of chanel 0 in Watt
  • dcv = dc voltage
  • dcc = dc current

send topic

If you define the send topic with a slash ("/") at the end, the idx of the inverter is added. So the topic becomes tralala/123. This way you can have a separate topic for each inverter.

recipients

The data is received by subscribers on the defined topic, this can be a home automation software like Domoticz or Homeassistant.

Domoticz

In domoticz you can define a sensor for a pv unit. This sensor has an identity (idx). This idx can be filled up in the relative field in the inverter settings. This value is sent along with the data so that domoticz can see for which sensor the data is intended.

Home Assistant

Also a sensor must be defined. More info is available in the issues here and here.

get data

We can trigger the poll of an inverter by sending a json like {"poll":1} to get inverter 1 polled. The data will be returned then. This only works if autopolling (settings) is disabled.