Howdy,
I’m trying to set up a custom button that opens my garage door with a long press (toggles ESP01 relay), turns on the lights (toggle) with a single press and the icon changes color based on the door sensor (open or closed). It also displays the temperature from the door sensor. I’ve got it 95% right, it all works except the single press for the light toggle. I can make it half work if I call the service switch.turn_on, or switch.turn_off, but I can’t get the toggle to work.
If i replace the tap action below with this (below) it doesn’t work. ‘failed to call service binary_sensor/turn_on. Service not found’
Looks like it’s trying to toggle the sensor, not the switch
tap_action:
action: toggle
entity_id: switch.1001f0cb28_1
**Mostly working code thus far:**
type: custom:button-card
entity: binary_sensor.0x00158d0009ce46c1_contact
show_icon: true
show_name: true
tap_action:
action: call-service
service: switch.turn_on
service_data:
entity_id: switch.1001f0cb28_1
show_state: false
double_tap_action:
action: none
hold_action:
action: call-service
service: switch.turn_on
service_data:
entity_id: switch.esp01_garage_door_garage_door
icon: mdi:garage-variant
color: rgb(68,115,158)
name: >-
[[[ return "Garage Door<br/>Current Temp " +
states["sensor.0x00158d0009ce46c1_device_temperature"].state; ]]]
state:
- value: 'on'
icon: mdi:garage-open-variant
color: rgb(255,0,0)
styles:
card:
- background-color: rgb(255,181,3)
- animation: blink 2s ease infinite
name:
- font-size: 30px
- color: red
- value: 'off'
color: rgb(68,115,159)
styles:
card:
- background-color: rgb(28,28,28)