Greetings all,
First of all, appreciate the insights on this topic. I have received a Siemens LOGO 8.4 which is capable of MQTT. That LOGO 8.4 is communicating with other Siemens LOGO PLC’s on the network here which are controlling the actual relais.
The LOGO 8.4 is using network input and network outputs, which works as expected. I’m able to show the values, coming from 8.3 on the display of the LOGO 8.4.
I’ve registered LOGO 8.4 to the MQTT of Home Assistant(HA). Which is showing up in LOGO as registered.
Publish topic: LOGO_Pub
Subscribe topic: LOGO_Sub
Connection TCP
Also “cloud transfer values” are configured in LOGO.
When i use MQTT Explorer, which is connected to HA i see the values nicely getting towards HA.
LOGO_Pub
{"state":{"reported":{"M1":{"desc":"M-bit-1-1","value":[0]},"M2":{"desc":"M-bit-2-1","value":[0]},"M3":{"desc":"M-bit-3-1","value":[0]},"M4":{"desc":"M-bit-4-1","value":[0]},"V0":{"desc":"V-bit-0.0-1","value":[0]}}}}
LOGO_Sub is of course not visible, because that’s only visible when using a switch in HA to set value 0 in to 1 (on/off)
So far so good MQTT is getting towards HA. But i’m getting stuck in the configuration.yaml
mqtt:
switch:
# Siemens LOGO 8.4 network switches
unique_id: hottub-switch
name: "Hottub"
state_topic: "LOGO_Sub"
command_topic: "LOGO_Sub/x.state.reported.V0.value[0]"
payload_on: "1"
payload_off: "0"
optimistic: false
qos: 0
retain: false
sensor:
# Siemens LOGO 8.4 sensors
- name: "Pomp"
state_topic: "LOGO_Pub"
value_template: '{{ value_json.x.state.reported.M1.value[0] }}'
unit_of_measurement: ''
json_attributes_topic: "LOGO_Pub"
json_attributes_template: '{{ value_json | tojson }}'
- name: "UVC"
state_topic: "LOGO_Pub"
value_template: '{{ value_jsonx.state.reported.M2.value[0] }}'
unit_of_measurement: ''
json_attributes_topic: "LOGO_Pub"
json_attributes_template: '{{ value_json | tojson }}'
- name: "Sproeiers"
state_topic: "LOGO_Pub"
value_template: '{{ value_json.x.state.reported.M3.value[0] }}'
unit_of_measurement: ''
json_attributes_topic: "LOGO_Pub"
json_attributes_template: '{{ value_json | tojson }}'
The values of the LOGO are configured as 0 or 1, but as you can see are in an array.
{"state":{"reported":{"M1":{"desc":"M-bit-1-1","value":[0]},"M2":{"desc":"M-bit-2-1","value":[0]},"M3":{"desc":"M-bit-3-1","value":[0]},"M4":{"desc":"M-bit-4-1","value":[0]},"V0":{"desc":"V-bit-0.0-1","value":[0]}}}}
And when M1 and M2 is 1 (on) i receive this:
{"state":{"reported":{"M1":{"desc":"M-bit-1-1","value":[1]},"M2":{"desc":"M-bit-2-1","value":[1]},"M3":{"desc":"M-bit-3-1","value":[0]},"M4":{"desc":"M-bit-4-1","value":[0]},"V0":{"desc":"V-bit-0.0-1","value":[0]}}}}
I spend a couple of hours trying to get the values out of it. Also with JSON Path finder trying different paths, but i can’t get the sensor nor the switch to work.
Anyone that can help me out on this? With regards to formatting of course in HA it would be nice to see on/off instead of 0/1.