Hi all, I’m trying to create a entity card for my garagedoor motor. And i would like a message to popup like, are you sure you want to open the garagedoor ?
I have magnetic sensor, so based on the state the message should change between do you want to open or do you want to close.
Can someome point me in right direction how to solve this? thanks! I have created a template sensor that change depending on the magnetic sensors.
garage_door_message: friendly_name: garage_door_message value_template: >- {% if ( (is_state(‘sensor.garage_magnet_open’,‘1’)) and (is_state(‘sensor.garage_magnet_closed’,‘0’)) ) %}
Do you want to close?
{% elif ( (is_state(‘sensor.garage_magnet_open’,‘0’)) and (is_state(‘sensor.garage_magnet_closed’,‘1’)) ) %}
Do you want to open? {% endif %}
Where you want to send the message to? I think you want to decide via the notification if you want to open or close?
You can use Actionable Notifications
You have to create a dummy switch (Open/Close) and build automations based on the state of the dummy switch, to sent a notification to your end-device.
I guess you could probably create a conditional entity to ‘show’ a different entity (but actually the same one, just with a different confirmation message). I never bothered with this though.
I just want a confirmation window with “yes/no” on the device where i tap the switch, could be my phone, tablet or computer.
But the message should change from “do you want to close the door” to “do you want to open the door”
I fixed it with a custom button card, here is my code if someone needs it.
The messages is in Swedish
The icon is red when the garagedoor is closed
Blinking yellow when it’s opening
And green when it’s opened.
type: custom:button-card
show_name: false
entity: sensor.garage_door_status
show_state: true
size: 20%
secondary_info: last-changed
tap_action:
entity: switch.shelly1pm_84cca8ad2d7d
action: toggle
confirmation:
text: |
[[[
if (states[“sensor.garage_magnet_open”].state == ‘1’)
return “Är du säker på att du vill stänga garageporten?”;
if (states[“sensor.garage_magnet_closed”].state == ‘1’)
return “Är du säker på att du vill öppna garageporten?”;
]]]
state:
value: Garageport stängd
icon: mdi:garage-variant-lock
styles:
icon:
- color: red