RPI-APS-inverters icon indicating copy to clipboard operation
RPI-APS-inverters copied to clipboard

using mosquitto in home assistant

Open defaliz opened this issue 10 months ago • 3 comments

Hi, i'm using mqtt to create sensors in Home Assistant i have datas in mqtt like this : {"serial":"xxxxxxxx","acv":232.6,"freq":50.0,"temp":15.1,"pwr":[21.4,20.6],"en":[41.6,40.6],"totalpwr":42.0,"totalen":82.2} with differents lines and serial, because i've 3 inverters but how can i discriminate datas between my 3 inverters ? thank a lot here is a declaration sensor in my home assistant : mqtt: sensor: #power
- name: inv0 pwr1 unique_id: inv0 pwr1 state_topic: "rpiecu/out" json_attributes_topic: "rpiecu/out" value_template: '{{ value_json.pwr[0] }}' unit_of_measurement: 'W'

- name: inv0 pwr2
  unique_id: inv0 pwr2
  state_topic: "rpiecu/out"
  json_attributes_topic: "rpiecu/out"
  value_template: '{{ value_json.pwr[1] }}'
  unit_of_measurement: 'W' 

defaliz avatar Apr 11 '24 11:04 defaliz

here is result in mqtt explorer, 3 lines (first none panel is connected) 11:45:27 {"serial":"703000518414","acv":0,"freq":0,"temp":0,"pwr":[0,0],"en":[,],"totalpwr":0,"totalen":0} 11:45:24 {"serial":"703000557318","acv":238.7,"freq":50.0,"temp":28.6,"pwr":[255.2,246.5],"en":[416.4,392.7],"totalpwr":501.7,"totalen":809.0} 11:45:20 {"serial":"703000071646","acv":238.7,"freq":50.0,"temp":31.3,"pwr":[189.7,331.8],"en":[340.0,565.4],"totalpwr":521.5,"totalen":905.4} is there a way to create 3 differents sensors in Home Assistant... ? regards

defaliz avatar Apr 12 '24 09:04 defaliz

I am not really familiair with Home Assistent but i think that each sensor has its own mqtt topic.
You can have different topics for each inverter in the RPI-ECU. First you go to the inverter settings and fillup an IDX number for each inverter (p.e. 111, 222, 333 if you have 3 inverters).
Now, in mqtt settings, put a slash ("/") behind the send topic .
Now the idx of the inverter will be added automatically to the sendtopic. P.e. if you have an inverter with IDX 123, and a sendtopic your/topic/ the mosquito message goes to your/topic/123. This way you can have a separate topic for each inverter.

patience4711 avatar Apr 12 '24 10:04 patience4711

thanks again ! it's exactly what i want and that works like a charm... regards Alain

defaliz avatar Apr 12 '24 12:04 defaliz