Hi all,
I’m pretty new to HA and these first few weeks, the learning curve has been steep, but I’m starting to get somewhere.
However, one of (many) points I’m still struggling with is this:
I want to trigger certain automations based on if certain people in my household are home or not.
From example : my 2 girls share a room, when they are both “away”, I want the heating to turn to away mode. But only when both are away.
Basically, looking for somekind of "switch"that turns ON when they’re both away. Which I could then use as a trigger for the necessary actions.
Been looking around, but didn’t see to find something that is an evident way of doing it.
They have phones, I expect. One option is to install the HA app on each one, then you can use the home zone to detect whether they’re in or not.
You could also check whether they’re connected to wi-fi. Again, this is easy if they have the HA app on their phones - and you may not want that.
Neither of these options gives you presence detection at a room level. You might look at something like Bermuda, which uses Bluetooth proxies in each room to track devices as they move around the house. It works very well with BLE tags as well.
Bermuda itself is well-documented. The proxies I found to (yet another) steep learning curve. On the other hand, they’re very cheap.
A simple motion sensor would tell you whether the girls were in their room (no movement for x minutes) and more sophisticated presence detector would detect them even if they were sitting still. Both of these would need something like Zigbee to communicate with HA. Another learning curve.
If you want to get really fancy, you could use the Bayesian integration to work out whether they’re probably in their room, based on time of day, day of week, school holidays, is the TV on etc. etc.
Edit: Don’t rush into things, particularly if they involve spending money. Get the hang of basic operations first - presence detection using zones may not do everything you want, but it doesn’t cost anything.
1 Like
Hi Jack, thank you for the response…
So currently, I’m tracking them when they connect to my unifi network.
and I can change temperature on their room alone based on them being away or not…
only when using triggers, then their status changing to away is an OR action.
so : girl 1 status becomes away > triggers the change of room temperature.
I am looking at something that does:
if girl 1 and girl 2 become away, then switch ON. When ON could be trigger for the change of room temperature
Can you make a group?
That would be ON if either were home and OFF only if both were away.
1 Like
Was looking into that, but not sure what kind of group to use then? I tried a couple but couldn’t even find the tracker entities, so thought I was on the wrong path there
That’s a limitation of the UI, I think. You should be able to define device_tracker groups in configuration.yaml:
group:
girls:
name: Girls phones
entities:
- device_tracker.daughter1
- device_tracker.daughter2
This will give you a group called “Girls phones” with the entity_ID “group.girls”. If either one is Home, the group will be Home.
Thanks will try that out tomorrow
Hi @jackjourneyman
thanks a lot, that group worked, as in…getting the right status on the group entity.
It took me some fenagling to get it right because apparently HA is very sensitive to indentation, but once I got that dialed in, it was working.
However, if I’m allowed to do a follow-up question, when testing automation in same way as I did with the devices, then it doesn’t seem to work
I tried it like this
alias: testgrp away
description: ""
triggers:
- trigger: state
entity_id:
- group.testgrp
to: Home
for:
hours: 0
minutes: 0
seconds: 0
from: Away
conditions: []
actions:
- action: notify.notify
metadata: {}
data:
message: testgrp away
- action: notify.mobile_app_oneplus
metadata: {}
data:
message: testgrp away
- action: scene.turn_on
metadata: {}
target:
entity_id: scene.living_room_dim_movie_15
mode: single
then like this as well :
alias: testgrp away
description: ""
triggers:
- trigger: state
entity_id:
- group.testgrp
for:
hours: 0
minutes: 0
seconds: 0
conditions:
- condition: state
entity_id: group.testgrp
state: Away
actions:
- action: notify.notify
metadata: {}
data:
message: testgrp away
- action: notify.mobile_app_oneplus
metadata: {}
data:
message: testgrp away
- action: scene.turn_on
metadata: {}
target:
entity_id: scene.living_room_dim_movie_15
mode: single
However, I don’t seem to get it to trigger. One indication might be that I don’t see Home and Away in GUI either. Only Unavailable and Unknown.
I can see the trigger gets hit, but fails on condition:
Executed: November 12, 2024 at 09:45:48
Result:
result: false
entity_id/0
Executed: November 12, 2024 at 09:45:48
Result:
result: false
state:
- device_tracker.oneplus_11_5g_3
- device_tracker.oneplus_7_pro
wanted_state: Away
Any idea what this could be or how to correct?
I found the solution to my problem, thanks @jackjourneyman you put me on the right track.
For the ones coming after me :
Step 1 :
I created 2 persons (person1 and person2) and assigned them my test devices.
Step 2 :
I then created a “people” group in configurations.yaml and reloaded the configuration.
group:
persongrp:
name: "persongrp"
entities:
- person.person1
- person.person2
Step 3 :
I then created a test automation, which initially failed as well. However in the trace, I was now able to see the “from” and the “to” state. Which fixed the triggering issue for me:
alias: persongrp away
description: ""
triggers:
- trigger: state
entity_id:
- group.persongrp
from: null
conditions:
- condition: state
entity_id: group.persongrp
#rather than "away" the status was "not_home"
state: not_home
actions:
- action: notify.mobile_app_oneplus
metadata: {}
data:
message: persongrp away
mode: single
When both phones were turned off for 5min (the default waiting time, I guess), the group changed its state and ran the automation.