I would like to program a button on my home assistant that turns on and off some automations.
I have a house that from time to time i need to turn off automations when i am away and turn them back on when i am coming back. Is there a way to have a button that says ‘activated’ when i toggle the button and turn on all automations and ‘deactivated’ when i toggle the button to turn them off…
You can put directly your automation entities on the UI. That way you will be able to turn them on and off. No need to create an input boolean to do that
You could do it manually with input_boolean, but I suggest looking in to device tracking to automate this instead. For example, if you have an Asus router, there is an HA device tracker component that can register when your phone is connected to wifi or not. So when you arrive home, your phone connects to your router wifi, HA see’s this, and then allows your automations to be active. When you leave, the phone disconnects from wifi, HA then disables automations until it see’s your phone on wifi again.
I believe there may be similar components for other brand routers too, and there are many other non-wifi ways HA can track your presence near your home. There are BT devices, gps based cloud services, etc… that can be used to automate this. One caveat with wifi presence… since iphone’s like to disconnect wifi randomly, they usually require a few minute delay after disconnect for things to work reliably. This means with wifi presence, automations may run a few minutes after you leave, if that matters.
I hadn’t thought of just adding the entities to a card. It of course works. I guess my problem is more of an ‘aesthetic’ one. I guess id like exactly the same as this:
type: entities
entities:
- entity: automation.main_house_water
- entity: automation.main_house_heating
title: Turn on house
but as a big shiny button with an icon of a house…
P.S i am a newbie, i installed HA yesterday so am discovering everything, so sorry if i cant be more helpful!!
Gotcha… paste this in your configuration.yaml and restart HA:
input_boolean:
turn_on_house:
name: Turn On House
That will give you an entity input_boolean.turn_on_house that you can add as a switch to your GUI using glances or whatever you like. Then, you add this entity in to the logic of your automations, et voila. I do the same thing for my x-mas light automations… but I use nodered so the automation part is different than yaml. After I put the lights up, I turn on the boolean (this kills a front yard plug earlier than normal to save energy). After xmas I take down the lights, and turn off the boolean.
Many thanks for everyone’s help! There are so many ways to do the same thing it seems but its good to learn them all, it comes in handy for other ideas!!
I have sucessfully managed to create a group of automation entities as well as a button. However when i push the button, the colour of the home icon does not change. It toggles the automations, so in that respect it works, but the colour of the icon stays the same. Is there any way to define colours for toggle status?