liksvette
(Tommy Hjelm)
September 26, 2017, 7:23pm
1
This is prob super simple, only I can’t find it anywhere.
I simply want to create a switch in the HASS gui that allows me to turn on/off automations.
Eg. I’ve made a couple of vacation automations (turning lights on and off, changing temperatures etc.) and I want to turn them on with a switch.
Do I have to use a template switch for this or is there something simpler?
rabittn
(Ryan)
September 26, 2017, 7:28pm
2
look at an input Boolean.
I have one called Vacation_mode and then those automations have a condition that says it must be on to run.
clyra
(Clyra)
September 26, 2017, 7:35pm
3
Just put then in a group and you are done :-).
VDRainer
(🍻)
September 26, 2017, 7:50pm
4
You can group your automations:
group:
sys_automations:
name: Automations & Scripts
control: hidden
entities:
- automation.kodi_home
- automation.mcp_test_motion_04
Jer78
(Jeremy Percival)
September 26, 2017, 9:08pm
5
And if you want to get really fancy, set up a config page and a input_select dropdown box to “filter” by groups of options. This uses an automation that hides and shows groups.
1 Like
tmjpugh
(Tmjpugh)
September 26, 2017, 9:17pm
6
Can you share config for this?
Jer78
(Jeremy Percival)
September 27, 2017, 6:59pm
7
First you’ll need to group your input_booleans and switches etc into their own group. Add all the groups into a config group that is a view.
Next, create an input_select with your options.
Finally, here’s the automation. Add a new action for every group of options:
- alias: "Config Dropdown"
initial_state: on
trigger:
- platform: state
entity_id: input_select.config
- platform: homeassistant
event: start
action:
- service: group.set_visibility
entity_id: group.speech_options
data_template:
visible: >
{% if is_state("input_select.config", "Speech") or is_state("input_select.config", "Guest Mode") %}true{% else %}false{% endif %}
- service: group.set_visibility
entity_id: group.guest_mode_options
data_template:
visible: >
{% if is_state("input_select.config", "Guest Mode") %}true{% else %}false{% endif %}
- service: group.set_visibility
entity_id: group.calendar_options
data_template:
visible: >
{% if is_state("input_select.config", "Calendar") %}true{% else %}false{% endif %}
2 Likes