Skip to content

10 MOSQUITTO

patience4711 edited this page Apr 12, 2024 · 3 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 can send a testmessage to the working of mosquitto.

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

There is a way to assign each inverter its own sendtopic. First you go to the inverter settings and fillup a unique IDX number for each inverter, p.e. 111 222 333 if you have 3 inverters. Now, in mqtt settings, if you simply put a slash ("/") behind the send topic, p.e. your/topic/
The slash ensures that the idx number is automatically added to the sendtopic. P.e. if you have an inverter with IDX 123, the mosquito message goes to your/topic/123. This way you can have a separate sendtopic 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.

Clone this wiki locally