Hi, I am having issues with an automation that i have created to capture mqtt messages and republish them.
the automation is:
trigger:
- platform: mqtt
topic: 475/NM7-US-HGA8103A/status/current
condition:
- condition: template
value_template: >-
{{ trigger.payload_json.msg == "CURRENT-STATE" }}
action:
- service: mqtt.publish
data:
topic: DYSON/Master_Bedroom
payload_template: |-
{% if trigger.payload_json.["product-state"].fmod == "FAN" %}
{"fan":"off","speed":"0","oscillation":"off" }
{% elif trigger.payload_json.["product-state"].fmod == "OFF" %}
{"fan":"off","speed":"0","oscillation":"off" }
{% endif %}
qos: '0'
retain: true
mode: queued
max: 10
and the feeding mqtt string is
475/NM7-US-HGA8103A/status/current {"msg":"STATE-CHANGE","time":"2021-03-05T17:52:19.002Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fmod":["FAN","OFF"],"fnst":["FAN","OFF"],"fnsp":["0004","0004"],"qtar":["0003","0003"],"oson":["OFF","OFF"],"rhtm":["ON","ON"],"filf":["0000","0000"],"ercd":["NONE","NONE"],"nmod":["OFF","OFF"],"wacd":["FLTR","FLTR"]},"scheduler":{"srsc":"49c6","dstv":"0001","tzid":"0001"}}
i suspect its not properly addressing the product-state.fmod value but having a hell of a time figuring this out