My MQTT entity is set up by putting the following line into configuration.yaml:
mqtt: !include mqtt.yaml
and creating the file mqtt.yaml with the contents:
sensor:
- name: SIP
state_topic: SIP/zones
availability:
- topic: SIP
payload_available: "\"UP\""
payload_not_available: "\"DOWN\""
value_template: "{{ value_json.zone_list }}"
My device populates the topic SIP/zones with
{"zone_list": [0, 0, 0, 0, 0, 0, 0, 0], "zone_dict": {"Front": 0, "South": 0, "North": 0, "T1south": 0, "S05": 0, "S06": 0, "S07": 0, "S08": 0}, "master_on": 0}
I create a card for the dashboard with:
type: entities
entities:
- entity: sensor.sip
show_header_toggle: false
This displays:
[0, 0, 0, 0, 0, 0, 0, 0]
I have written a script that works, except for the condition:
alias: SetValvePerSIP
sequence:
- service: notify.mysensors
data:
target: Zone
message: "0"
- repeat:
count: "8"
sequence:
- if:
- condition: state
entity_id: "sensor.sip"
state: "{{ sensor.sip[ {{ repeat.index - 1 }} ] }}"
then:
- service: notify.mysensors
data:
target: Zone
message: "{{ repeat.index }}"
- service: switch.turn_on
data: {}
target:
entity_id: switch.start
mode: single
The conditional does not ever evaluate to true even when one of the values is 1. Why is that?
Thanks for your help