MQTT Switch to store feature override states?

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

if you’re only going to publish on and off you don’t need a value template.
If you really want to keep it, it should be as such: value_template: '{{value_json}}'
more info here:

Your configuration would require you to publish online to overrides/wakeup/brian/availability to bring the sensor online. But I’m not entirely sure why you would need an availability topic at all. This is normally to indicate that a hub had gone down.