SwitchBot - show state on dashboard

I have a switchbot and the assosciated integration installed. The bot can be switched on and off remotely. So that part is great.

What I was hoping to see in the dashboard is the state of the device. When I add the entity and click on or off I was expecting the known state to change the icon colour etc. When I add a button card again the state doesn’t change when I click the button. So from the dashboard I have no way of knowing if the device is in the on or off state without looking at the logs.

Does anybody know a way to visually see the state of the switch?


If you run it in optimistic mode you get the state.

Thanks for the pointer.

I placed this in my config.YAML

  - platform: template
        friendly_name: "SwitchBot1"
        value_template: "{{ is_state_attr('switch.switch.switchbotA', 'sensor_state', 'on') }}"
          service: switch.toggle
            entity_id: switch.switchbotA
          service: switch.toggle
            entity_id: switch.switchbotA

This gives me a toggle switch that doesn’t actually toggle. I can click it but the status of the toggle doesn’t change.

The switchbot is set to ‘Press mode’. The alternative is ‘switch mode’ but that doesn’t seem to work in the way I require. I have the switchbot pressing a latching switch. The press mode works fine but the switch mode is designed I think to press and pull a switch off which doesn’t work with the latching switch.

In HA I can see that in press mode it records on/off. I guess the switch entity just needs a tweak to make it see that status?

Any help is appreciated.

It doesn’t toggle if the value_template delivers false.
Maybe a typo? You have ‘switch.switch.switchbotA’ as the entity.
Try Developer Tools → Templates if the statement renders true.
If you trust your switchbot you can delete the value_template and set it this way into optimistic mode.

Yep spotted the typo. Didn’t make a difference unfortunatly.

So i’ve removed the value_template line altogether and it “works”. Albeit its not fool proof. For this requirement howver, that’ll do me.

Many thanks for your assistance, much appreciated.