MQTT Switch - detecting when MQTT Broker is offline

Hi, I have an MQTT Switch, which works fine, my issue is I want HA to recognise when the MQTT broker is unavailable and hence make the MQTT switch “unavailable” or “unknown” in the UI.
HA knows when the MQTT switch (not broker) is offline via the MQTT will_message, that works fine.
I have a number of MQTT Sensors that detect when the MQTT broker is offline via the "expire_after: " under the sensors’ yaml config. The “expire_after” command is not an option for an MQTT switch
in yaml
This is the relevant config,.

  - platform: mqtt
    name: "Hydronic Heater"
    state_topic: "hydronic_heater"
    command_topic: "hydronic_heater_set"
    availability_topic: "hydronic_heater_available"
    payload_on: "ON"
    payload_off: "OFF"
    state_on: "ON"
    state_off: "OFF"
    payload_available: "online"
    payload_not_available: "offline"
    optimistic: false
    qos: 0
    retain: false

  discovery: false
  keepalive: 30
    topic: 'hass/status'
    payload: 'online'
    topic: 'hass/status'
    payload: 'offline'

I’m not sure if you are running on systemd controlled machine, but I use this to detect if mosquitto is running on my Pi

  - platform: command_line
    name: "mosquitto status"
    command: systemctl show mosquitto.service | awk -F= '/^SubState=/ {print $2}'
    scan_interval: 60

Thank for your suggestion but no, the MQTT server is running in a docker container on a Synology NAS as is HA.