Toggle button mqtt switch

I am updating an old HA installation. The frontend was only composed of toggle buttons from mqtt switches. I decided to proceed with a fresh installation and manually reconfigure the mqtt entities.
The necessary changes were made and everything seems to be ok.

However all the toggles buttons (similar to the one seen in front of “fan light”) were replaced by two separate icons (similar to the one seen in front of “dining”).

(merely illustrative image)
ha toggle 2

How can I go back to the toggle buttons?

Already seen some references talking about the assumed_state: false variable but I wasn’t able to solve the problem.

Thanks

HA info
Home Assistant 2023.10.3
Supervisor 2023.10.0
Operating System 11.0
Interface: 20231005.0 - latest

Would you share an example how you defined your switches?

Here it is, the GUI result and the code just after.

mqtt_testing

configuration.yaml


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt: !include mqtt_insano.yaml

mqtt.yaml

switch:
  - name: "Plug 1"
    command_topic: "cmnd/plug1/power"
    state_topic: "stat/plug1/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
    
  - name: "Plug 2"
    command_topic: "cmnd/plug2/power"
    state_topic: "stat/plug2/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
    
  - name: "Plug 3"
    command_topic: "cmnd/plug3/power"
    state_topic: "stat/plug3/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
  


light:
  - name: "Entrance Light"
    command_topic: "cmnd/entrance_light/power"
    state_topic: "stat/entrance_light/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
  
  - name: "Back Light"
    command_topic: "cmnd/back_light/power"
    state_topic: "stat/back_light/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

just in case this is somehow useful

So, it seems that the button changes again to a toggle button if the availability_topic is set/added to the configurations.

In older versions this wasn’t necessary.
Is this what causes the button type not to be a toggle button or is it just a coincidence / workaround?

1 Like
Was struggling with the same thing but your solution helped. Adding the availability_topic, payload_available and payload_not_available solved it for me. Thank you very much!