#How do I make a switch that executes scripts
1 messages · Page 1 of 1 (latest)
Easiest way is probably to create a switch(toggle) helper then use an automation to run the scripts triggered by the switching going on/off.
You can also use a template switch and assign actions to it going on/off directly into the switch.
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.
I tried the Helper, but It always remains on/off, I want it to switch between modes
That's all the input_boolean helper does. It is either on or off. To get it to do what you want, there's three options mentioned above: automation, combined script (with tap_action to run the script), or the custom:button-card with a templated tap_action.
Thanks!!
And how do I sync the room temperature control of my radiator knob to the set target temperature of my boosters?
Without knowing your exact configuration, I'd say by using a simple automation: when radiator knob state changes then set the state of the booster to the value of the radiator knob.