I don’t know, I just went to the services page and either switched on the light with the service.toggle and copied the service data !!
However it works !!
I don’t know, I just went to the services page and either switched on the light with the service.toggle and copied the service data !!
However it works !!
Your solution works, I try it both with and without the extra “brackets” (that @alverman used). Not sure why he need those extras…Thanks for your solution.
Okay my issue is related…
So I’ve set up a sensor that changes Icon based on state:
- platform: template
sensors:
garage_door_status:
value_template: >-
{% if states.binary_sensor.garage_roller_100.state == 'on' %}
Open
{% elif states.binary_sensor.garage_roller_100.state == 'off' %}
Close
{% endif %}
icon_template: >-
{% if states.binary_sensor.garage_roller_100.state == 'on' %}
mdi:garage-open
{% elif states.binary_sensor.garage_roller_100.state == 'off' %}
mdi:garage
{% endif %}
which is great, but I want to associate it with a button:
type: 'custom:button-card'
tap_action:
action: toggle
confirmation:
text: Toggle Garage Door?
entity: switch.garage_door_90
icon: 'mdi:garage'
show_state: false
show_name: true
show_icon: true
size: 60px
color: var(--paper-item-icon-color)
hold_action:
action: none
How do I combine the two…
The reason I’m doing that is because my button activates a pushbutton via dry contact, so there is no feedback on state. So i have a reed switch which will pick up if it’s open or closed so I want to relay that information visually on this button rather than having a button and a sensor state glance adjacent.
Thanks.
Instead of using the button, use the sensor, and call the button as its action:
- entity: garage_door_status
name: Garage Door
tap_action:
action: call-service
service: switch.toggle
service_data:
entity_id: switch.garage_door_90
confirmation:
text: Toggle Garage Door?
or something similar to that
Thanks Richie!
this works:
type: 'custom:button-card'
tap_action:
action: call-service
service: switch.toggle
service_data:
entity_id: switch.garage_door_90
confirmation:
text: Toggle Garage Door?
entity: sensor.garage_door_status
show_state: false
show_name: false
show_icon: true
size: 60px
color: var(--paper-item-icon-color)
hold_action:
action: none