Пример:
{“ZbReceived”:{“0x8982”:{“Device”:”0x8982″,”0006!01″:””,”Power”:1,“Endpoint”:1,”LinkQuality”:117}}}
value_json.ZbReceived[‘0x8982’].Endpoint
1
Так более правильно:
- platform: mqtt
unique_id: ZigBeeV1Switch_8
name: ZigBeeV1Switch_8
state_topic: "tele/ZigBeeTest/SENSOR"
value_template: |-
{%- if value_json.ZbReceived is defined and value_json.ZbReceived['0x8982'] is defined -%}
{%- if value_json.ZbReceived['0x8982'].Endpoint == 8 -%}
{%- if value_json.ZbReceived['0x8982'].Power == 1 -%}
ON
{% else %}
OFF
{% endif %}
{% endif %}
{% endif %}
state_on: "ON"
state_off: "OFF"
command_topic: "cmnd/ZigBeeTest/ZbSend"
payload_on: '{ "device":"0x8982", "Endpoint":8, "send":{"Power":"on"} }'
payload_off: '{ "device":"0x8982", "Endpoint":8, "send":{"Power":"off"} }'
availability_topic: "tele/ZigBeeTest/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
retain: false
# ---------------------------------------------