I hope that you guys can help me here.
I would like to make a garage button card. The button card should do the following
Change the icon,colour and texts when the garage is opened or closed
When the garage door opened, tap on the card will close it
When the garage door closed tap on the card will open it
I can get the item 1 work but cannot make item 2 work.
I tried to use if statement with entity_id to select between input_boolean.opengarge and input_boolean.closegarage when the sensor detect whether the garage open or close but it did not work
note: input_boolean.garageopened is the sensor input_boolean.opengarage is the output to open garage input_boolean.closegarage is the output to close garage
Is it possible to use if statement with entity_id to dynamically select different boolean to activate ? Or is there a better way of doing this if this does not work ?
Replace all input_booleans with a single one, which closes the garage when it is turned off an opens the garage when it is turned on and which is updated when the status of the garage door changes. Then you can use the input_boolean.toggle service with your button card.
Create a script, which checks the condition and calls either the one or the other input_boolean. By pressing the button, you can call the script then, by calling the service script.<name-of-script>. Script Syntax - Home Assistant
I would prefer the first solution if it is possible, but the second should work as well.
Thank you for your suggestion, can’t do option 1 as the input_boolean linked to external controller so maybe I have to create a script as your suggestion.