Beginner Help - Custom Status Based On Location

I’ve done a bit of coding before, but nothing like Home Assistant so finding it quite a lot to take in!

What I’d like to do is have a card for each person, with a single line status based on their location, sleep status or driving status. Examples below:

[person] left [zone] at [hh:mm am/pm]
[person] arrived at [zone] at [hh:mm am/pm]
[person] went to sleep at [hh:mm am/pm]
[person] woke up at [hh:mm am/pm]
[person] started driving at [hh:mm am/pm]
[person] stopped driving at [hh:mm am/pm]

I know I can do from/to automations based on entering/leaving a zone, however I’m not sure if I can standardise this or if I need to make a separate automation for each person. Ie. instead of the trigger being a single device tracker, can the trigger be a list of people that are each checked for their state?

My other question is about how to actually store the status and display it in a card. I know how to create the trigger, but I’m not really sure of the best way to store the status itself for each person. Can anyone point me in the right direction with this?

I haven’t sorted out the sleep or driving condition (based on integration with tasker and sleep as android), but figured I might just get this working for zones first before I worry about that.

You can define zones in HA, when a person enters a configured zone that is what it shows on their status. If you look at when that entity last changed that will tell you at what time they entered that zone. But that will get replaced when they leave it (away (not_home)) or enter another zone.
Your best bet would be to send messages at each transition.
Though I must admit, what you want to do sounds a bit creepy to me

1 Like

Yeah many find this whole home automation thing quite creepy, given that it relies to a large extent on knowing where people are, and what they are doing. Bed sensors? Sleep timers?

An employee of mine had her husband ring one day when her heart rate went up (nothing to do with HA, more fitbit). She had walked up the stairs instead of taking the lift.

Then again when my kids first got their driving licence, sure I wanted to know that they hadn’t driven off the road, or taken too long to reach their destination.

TL;DR one person’s creepy is another person’s safety check. Be cautious about judging.

1 Like

That’s why I answered the question. Well a bit of it anyway.
You are a professional who deals with judgements on a regular basis.
I don’t think anyone could describe : -

As a judgement. At worst a statement of my personal opinion.
Sorry Nick :crazy_face:

No need to apologise, I wasn’t telling you off! I agree about the creepiness of home automation in general. It is important to know context though.

I thought the same the last days… I am currently implementing what I criticize Google & Co for, even more extensive.

However, it is so much fun and at least I don’t sell all the data to suspicious people :slight_smile:

Yeah, you consider what supermarkets know about you.
You buy x about every 3 weeks.
You buy y but only with z
You buy q on a fairly regular basis but you buy a lot of it when J sporting event is running
Amazon has similar knowledge, so it amazes me that after you have bought x they bombard you with opportunities to buy more off, fine when it’s biscuits but less so for a garden shed

Yeah, instead it would be a good idea to spam me with ads for addons or so to what I bought :smiley:

We are drifting off topic…

Drifting, true, but they call it a community…
Cheers

1 Like

I like that :slight_smile:

I based our presence / state reporting on a blog post that uses an input_select for each tracked person to display a current status. The writer covers off how to standardise automations for multiple device_tracker triggers - the article is not very recent however I found it extremely useful, and the automations I created based on it have not really changed since.

We use a combination of Owntracks (controlled by Tasker) and Unifi presence detection to drive changes to status. Each individual’s trackers are grouped using the person entity.

From there I added a sleep mode per person (driven by Tasker based on charging during certain hours using webhooks via Nabu Casa) and house-level sleep and holiday modes (manual toggle).

Our states however do not go down to the level you envisage - my wife finds our current HomeAssistant tracking levels acceptable but I doubt she’d be keen if they became any more granular (although she appreciates the voice announcement when I’ve left work).

Not a concise post, more a random collection of lunchtime thoughts but it might give you a few ideas for proceeding with your own plans…

1 Like

I would consider your post to be helpful, and a good basis for building (if I were actually interested in the topic, I’m not :tongue: :crazy_face: )
Never be afraid to offer similar in future. IMHO anyway. :wink: