I publish this:
- alias: 'Uppdate alarm sensor'
trigger:
platform: state
entity_id: sensor.alarm_last_update
condition:
condition: template
value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
action:
- service: mqtt.publish
data:
topic: "alarm/visonic/alarmpanel/active"
payload_template: "{{ states.sensor.alarm_active }}"
retain: true
and I recieve this:
template state sensor.alarm_active=True; friendly_name=Larm aktivt, icon=mdi:shield-lock @ 2019-06-02T15:23:45.094645+02:00>
with this sensor definition:
- platform: mqtt
name: "alarm_active2"
state_topic: "alarm/visonic/alarmpanel/active"
force_update: true
I cannot figure out how to extract the payload “True” in a value template, My best guess so far is this:
value_template: "{{ value_json.sensor.alarm_active }}"
but no… what I am doing wrong?