I am having trouble with persistence, I tried persistence.yaml but, I have found my Speech Notifications toggle turned off several times recently, so I thought I’d give MQTT a try. But I can’t seem to figure out how to setup an on/off switch that simple stores wether a feature is enabled or not. Here’s my latest attempt. I used node-red to store “on” in “overrides/wakeup/brian/availability” in mosquito. So I don’t know why my switch won’t show the status in the interface.
binary_sensor:
- platform: mqtt
name: "Wakeup Brian"
state_topic: "overrides/wakeup/brian"
payload_on: "on"
payload_off: "off"
availability_topic: "overrides/wakeup/brian/availability"
payload_available: "online"
payload_not_available: "offline"
qos: 0
value_template: '{{ value.x }}'
switch:
- platform: template
switches:
wakeup_brian:
friendly_name: "Wakeup Brian"
value_template: "{{ binary_sensor.wakeup_brian }}"
turn_on:
- service: mqtt.publish
data:
topic: "overrides/wakeup/brian"
payload: "on"
qos: 0
retain: true
turn_off:
- service: mqtt.publish
data:
topic: "overrides/wakeup/brian"
payload: "off"
qos: 0
retain: true