Now my question, I want the lights to go out when I leave the house, now I have googled and tried different options, unfortunately it does not work. I don’t get an error message and the automation is neat on the homepage when I go to / states.
I will put the code below:
automation 19:
alias: Turn All Lights off When We Leave
trigger:
entity_id: device_tracker.gerritjan
from: home
platform: state
to: away
action:
entity_id: group.switches
service: switch.turn_off
You say “we” - if you have multiple persons in the house I suggest you create a template binary_sensor for the house so that it will have a separate “occupancy” point indicating if anyone is in the house or not.
It will also allow you to trigger lights on when first person arrive and off when the last person leaves.
But for only one person, try this:
alias: Turn All Lights off When We Leave
trigger:
- entity_id: device_tracker.gerritjan
platform: state
from: home
to: not_home
condition: []
action:
- entity_id: group.switches
service: switch.turn_off
If you go to the sidebar and then to Developer Tools -> States, it says “home” and “not_home”, no matter what language your system is. “Absent” and “home” will only be shown in the frontend and will be based on the language you configured for the user.
Do you see any errors under Developer Tools -> Logs?
The following was the last one, this was before I asked you for help and before I added the above automation. There are no new errors or the like.
2019-11-17 13:33:06 ERROR (MainThread) [homeassistant.components.hassio] Invalid config for [automation]: expected dict for dictionary value @ data[‘action’][0][‘data’]. Got None
extra keys not allowed @ data[‘entity_id’]. Got None
extra keys not allowed @ data[‘service’]. Got None. (See /config/configuration.yaml, line 87). Please check the docs at https://home-assistant.io/integrations/automation/
2019-11-17 13:34:06 ERROR (MainThread) [homeassistant.components.hassio] Invalid config for [automation]: [data] is an invalid option for [automation]. Check: automation->action->0->data. (See /config/configuration.yaml, line 87). Please check the docs at https://home-assistant.io/integrations/automation/
alias: Turn All Lights off When We Leave
trigger:
- entity_id: device_tracker.gerritjan
platform: state
from: home
to: not_home
condition: []
action:
- data:
entity_id: group.switches
service: switch.turn_off
Can you please post your code again, looks to me like a indentation error or something like this. Your automation can not trigger because it is not correct.
automation 19:
alias: Turn All Lights off When We Leave
trigger:
- entity_id: device_tracker.gerritjan
platform: state
from: home
to: not_home
condition: []
action:
- data:
entity_id: group.switches
service: switch.turn_off
automation 19:
alias: Turn All Lights off When We Leave
trigger:
- entity_id: device_tracker.gerritjan
platform: state
from: home
to: not_home
condition: []
action:
- service: homeassistant.turn_off
entity_id: group.switches