Presence / home occupied detection

Evening All,

I currently monitor my mobile phone with network binding to detect my presence at home - all works great. But struggling little with displaying text “Occupied” or “Away” on separate syntax (Home_Status) when I`m home or away.
Here is my current setup.

Sitemap

Frame label="Presence" {
	    Text item=Home_Status icon="presence" {
		Frame label="Andy`s Phone" {
		        Text item=Phone1Status label="Status [MAP(phone.map):%s]" 
		        Text item=Phone1LastSeenTime label="Last Seen [%1$ta %1$tR]" 

Items

/* Presence Detection - Mobile Phone Monitoring */
Switch Phone1Status  <my_iphone> 
DateTime Phone1LastSeenTime  <time> 
Switch Home_Status   "House Status [%s]"   <status> 

Would someone please advise how to implement the above.
Many thanks.

map file?

My map file attached, forgot to include in previous post.

phone.map

ON=Home
OFF=Away
NULL=Unknown Location
-=NULL

I need to trigger Home_Status to ON (and display Occupied) when Phone1Status is ON.
Is anyone has any suggestions ?

1 Like

Have you considered using a group function instead?

xxx.items

Group:Switch:OR(ON,OFF) Home_Status   "House Status [MAP(home.map):%s]"   <presence> 
Switch Phone1Status  "Andy`s Phone" <my_iphone> (Home_Status)
Switch Phone2Status  "Andy`s Other Phone" <my_iphone> (Home_Status)

home.map

ON=Occupied
OFF=Away
NULL=Unknown Occupancy
UNDEF=Unknown Occupancy

Hi @rossko57

Thanks for suggestion. I tried that but its not displaying house status.

Below is my current syntax and picture of each section so you can see what Im trying to achieve. Strangely, I cant see any error in logs which would give me a clue what to change.

Sitemap

Frame label="Home Status" {
	    Text item=Home_Status icon="presence" {
		Frame label="Andy`s Phone" {
		        Text item=Phone1Status label="Status [MAP(phone.map):%s]" 
		        Text item=Phone1LastSeenTime label="Last Seen [%1$ta %1$tR]" 

Items

Group:Switch:OR(ON,OFF)         Home_Status   "House Status [MAP(home.map):%s]"   <presence>     (All)
Switch Phone1Status  "Phone1" <my_iphone> (Home_Status)
DateTime Phone1LastSeenTime  <time> 
Switch Home_Status   "The house is [%s]"  <status> (Home_Status)

You’ve got the Group and another Item with the same name. Last one created wins, so you’ve no working group.

By all means, give the group a new name if you must keep the old switch item as well.

Not sure where I`m going wrong, sorry slightly embarrassed :flushed: with that but changed configs as per your indication (I hope) and still no luck.
Have I done it correctly ?

Sitemap

Frame label="Home Status" {
	    Text item=Home_Status icon="presence" {
		Frame label="Andy`s Phone" {
		        Text item=Phone1Status label="Status [MAP(phone.map):%s]" 
		        Text item=Phone1LastSeenTime label="Last Seen [%1$ta %1$tR]" 

Items

Group Presence  (All)

Group:Switch:OR(ON, OFF)        Presence    "House Status [MAP(home.map):%s]"   <presence>        (All)


Switch Phone1Status  "Phone1" <my_iphone>  (Presence)
DateTime Phone1LastSeenTime  <time> 
Switch Home_Status   "The house is [%s]"  <status>  (Presence)

You now have two Groups called Presence.
Every Item (which includes groups) must have a unique name.

I’m really not sure why you added the first one, just get rid.

The second version is good, a Group called Presence that will be ON if any of its member Items are ON.
This group has two members.
One is your phone status. All good so far.

The other member is the switch Item that you were first going to use as the “overall” indicator.
I’m not sure why you have kept that, but you can if you like.
Nothing will happen with it in the current setup.

Group:Switch:OR(ON, OFF)        Presence    "House Status [MAP(home.map):%s]"   <presence>        (All)

Switch Phone1Status  "Phone1" <my_iphone>  (Presence)
DateTime Phone1LastSeenTime  <time>

Okay, so you have this group Presence.
The whole idea was to show it on your sitemap, and it isn’t there, so you won’t see it.
Let’s fix that.

Frame label="Home Status" {
	    Text item=Presence {
		Frame label="Andy`s Phone" {
		        Text item=Phone1Status label="Status [MAP(phone.map):%s]" 
		        Text item=Phone1LastSeenTime label="Last Seen [%1$ta %1$tR]"
                 }
             }
}
2 Likes

I see now where was the problem @rossko57 :grinning: swapped the mistake and everything works now as a treat - many thanks and thank you for explaining the functionality above that really helps me.
And I got confused with creating two groups with the same name, not really sure why I done it.

Once again, thanks a lot. I will probably add virtual switch to enable override presence status manually just in case my phone is out of action. Will that be just a new switch which belong to “Presence” group?

Yep. As you develop other presence sensing strategies, you can add each one to the group in the same way.

Many thanks - thanks for great help much appreciate it and I gave you like and highlighted solution for others :+1:

1 Like