How do I setup a manual home / away mode? Nothing fancy - I select the button when leaving the house and it turns off all switches, lights etc…
Use an input_boolean:
yes, but what do I put in the automation.yaml file to control it?
automation:
- alias: Away
trigger:
platform: state
entity_id: input_boolean.home
state: 'off'
action:
[WHAT YOU WANT TO DO WHEN YOU GO OUT]
- alias: Home
trigger:
platform: state
entity_id: input_boolean.home
state: 'on'
action:
[WHAT YOU WANT TO DO WHEN YOU GET BACK]
Thanks… Sorry I’m kinda dumb to this but will get it quickly when I see a working example.
Like this?
- alias: Away
trigger:
platform: state
entity_id: input_boolean.home
state: 'off'
action:
entity_id: group.all_lights
- alias: Home
trigger:
platform: state
entity_id: input_boolean.home
state: 'on'
action:
entity_id: group.all_lights
Nearly
You’ll want to tell it what to do with the lights…
- alias: Away
trigger:
platform: state
entity_id: input_boolean.home
state: 'off'
action:
service: homeassistant.turn_off
entity_id: group.all_lights
- alias: Home
trigger:
platform: state
entity_id: input_boolean.home
state: 'on'
action:
service: homeassistant.turn_on
entity_id: group.all_lights
Thanks - I added that to the automation file but get an error on my config:
Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/homeassistant/.homeassistant/configuration.yaml, line 66). Please check the docs at Automation - Home Assistant Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /home/homeassistant/.homeassistant/configuration.yaml, line 66). Please check the docs at Automation - Home Assistant
line 66 on my config file is
automation: !include automations.yaml
Yeah sorry, in the triggers change
state: 'on'
TO
to: 'on'
(and off)
Perfect - thank you! That works when I hit the ‘trigger button manually’
Final question. What do I put in the config file? I’m following this but can’t see the alias?
input_boolean:
home:
name: Notify when someone arrives home
initial: off
icon: mdi:car
That should be fine, have you restarted homeassistant since adding it?
Also to customise that input_boolean to better fit your application you can change the name or icon to whatever you want:
input_boolean:
home:
name: "Home Mode"
initial: off
icon: mdi:home
You can use any of icons here: https://materialdesignicons.com/ just relace the bit after icon: mdi:
with the icon you like’s name (no space).