I’ve searched the forums and am just getting confused, I’d really appreciate a clear simple answer.
All I want to do is switch off all lights when the last person leaves the house.
I used to have this set up perfectly using state change group.all_devices from home to not_home. After an update quite a while ago, it stopped working.
We have person A and person B each with a phone using the HA Companion app for presence detection.
but it doesn’t seem to work (the syntax which i copy exactly from the above topic is getting mangled by the UI configurator (it keeps changing the quotations marks in the template even when use the Edit in YAML function (See below for what it changes it to). At the bottom of that topic they suggest using groups (as I used to) but I literally cannot find how to create groups anymore using the UI.
alias: Turn off the lights when I leave home
description: ‘’
trigger:
platform: zone
entity_id: person.A
zone: zone.home
event: leave
platform: zone
entity_id: person.B
zone: zone.home
event: leave
condition:
The only way I know of to create groups is through editing the YAML files. In this case, you either have to have something in the configuration.yaml like this:
group:
family:
name: family
entities:
- person.me
- person.her
or you could put the part starting with “family:” into a separate file (eg: groups.yaml) and put
group: !include groups.yaml
into your configuration.yaml
The group will have status of “home” when anyone is home or “not_home” when everyone has left (which is what you’ll be using for your automation). I find that, depending on the gps radius of our phones, I can be a some blocks away before HA says I’m gone, but the home/not home functionality has never failed to track.
Aside: Those code blocks in this reply are set between three back quote characters “```”. (The back-quote is the one in the upper left of the keyboard between ESC and TAB). That preserves indentation and even highlights some things.
Thank you both very much. I have figured it out using groups, its very simple.
My main issue was that I didn’t realise there are some things you can do in the UI and some things you can’t. Turning all lights off when last person leaves seems like such an obvious thing that most people would want to automate, yet you cant do it in the UI.
Duly noted for the back quotes too, will do in future.