10 MOSQUITTO - patience4711/ESP8266_read_p1meter GitHub Wiki

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 {"idx":910,"nvalue":0,"svalue":"51775.00;0.00;24413.00;0.00;335.00;0.00"} and for the gas {"idx":911,"nvalue":0,"svalue":"16.713;"} These mesages are used by Domoticz to update the p1 meter sensor and the gas usage sensor.

Other formats are: format 2: {"econ_lt":51.78,"econ_ht":0.00,"eret_ht":24.41,"eret_lt":0.00,"actualp_con":335.00,"actualp_ret":0.00,"gas":16.713}

format 3: field1=51.775&field2=0.000&field3=24.413&field4=0.000&field5=335&field6=0&field7=16.713&status=MQTTPUBLISH (for thingspeak)

values

  • econ_lt = energy consumed low rate (kWh)
  • econ_ht = energy consumed high rate (kWh)
  • eret_lt = energy produced low rate (kWh)
  • eret_ht = energy produced high rate (kWh)
  • actualp_con = power usage W
  • actualp_ret = power produced W
  • gas = gas m2

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 p1 meter. This sensor has an identity (idx). This idx can be filled up in the relative field in the settings. This value is sent along with the data so that domoticz can see for which sensor the data is intended.

get data

We can trigger the poll of the p1 meter by sending a json like {"poll":1}. The data will be returned then.

memory check

If we setup a sensor in domoticz we can monitor the heap of the ESP. The state idx is used for that.