#How do I make a switch that executes scripts

1 messages · Page 1 of 1 (latest)

left ruin
#

Hi,

I would like to make a switch on my dashboard that does not switch on or off, but switch between 2 scripts

(Switch from Right to left, run script 1, Switch from Left to Right, run script 2)

jagged spruce
quiet anchor
# left ruin Hi, I would like to make a switch on my dashboard that does not switch on or of...

You have a couple of options depending on how you want to handle it. You could use an input_boolean helper and combine both scripts into one and let the script figure out what to do. (Which Missy basically said as I was typing this...)
EDIT: wait.... that wasn't Missy... 🔍
I'd recommend using the custom:button-card. It is a very useful card that, with a little bit of JavaScript, you can customize how the tap_action is handled (for example, which script to run.) The custom:button-card is one of the few cards that can do this; the stock cards in HA (usually) do not support something like this.

left ruin
#

I tried the Helper, but It always remains on/off, I want it to switch between modes

quiet anchor
left ruin
quiet anchor