Question on your card. I set it up that the way you had it and if the door is open it will close by clicking on it. However, it will not open when you click on it even with the call to service to open it. I can open it if I manually put in the call to service for that cover. Not sure why it will not work.
Maybe try using the call service cover.toggle?
Hi Matt,
do you know where are something wrong?
type: 'custom:state-switch'
entity: binary_sensor.garage_garage_door_contact
states:
'off':
type: 'custom:button-card'
entity: binary_sensor.garage_garage_door_contact
show_icon: true
show_name: true
tap_action:
action: call-service
service: switch.turn_on
service_data:
entity_id: switch.garage_trigger
icon: 'hass:garage'
state:
- value: 'off'
color: 'rgb(68,115,159)'
'on':
type: 'custom:button-card'
entity: binary_sensor.garage_garage_door_contact
show_icon: true
show_name: true
tap_action:
action: call-service
service: switch.turn_off
service_data:
entity_id: switch.garage_trigger
icon: 'hass:garage'
state:
- value: 'on'
color: 'rgb(255,0,0)'
Many thanks!
NB: I’m a newbie
honestly i’m not an expert on the state switch, but my random guess off the top of my head is that on and off don’t need quotes. not sure if that would cause issues, but it might.
what exactly is going wrong?
I definitely don’t have a lot of experience with templates but using status of sensors I was able to get this to work as I wanted - hope this helps someone This is used with Zooz ZEN16 relay and Zooz Tilt sensor.
type: custom:button-card
tap_action:
action: toggle
entity: switch.garage_door_relay_2
entity: binary_sensor.double_garage_door_sensor_window_door_is_open
show_state: true
name: Double Door
styles:
card:
- height: 100px
- width: 105px
icon: mdi:garage
state:
- value: off
color: purple
value: on
color: green