Presence detection with iCloud

Hi there,

i want to configure a presence detection with iCloud-Binding with two iPhones. I already installed the Binding and the bridge is online and working.

The first iPhone, my device is working fine. But I get no connection with the device of my wife. I have the family-sharing activated. The sharing works fine.

Here are my items:

//iPhone A
Group       giPhone_A                      "iPhone A"                                 <iphone>                (gAnwesenheit)
Number      iPhone_BatteryLevel_A               "Batterie [%d %%]"                              <battery>                                       {channel="icloud:device:7d938589:82ce4474:batteryLevel"}
DateTime    iPhone_LocationLastUpdate_A         "letzer Empfang [%1$td.%1$tm.%1$tY, %1$tH:%1$tM]"  <time>                                       {channel="icloud:device:7d938589:82ce4474:locationLastUpdate"}
Switch      iPhone_Home_A                       "Zuhause"                                       <presence>              
Switch      iPhone_Refresh_A                    "Koordinaten auffrischen"                                                                       {channel="icloud:device:7d938589:82ce4474:location", autoupdate="false"}
Location    iPhone_Location_A                   "Koordinaten"                                   <gps>                                           {channel="icloud:device:7d938589:82ce4474:location"}

//iPhone K
Group       giPhone_K                    "iPhone K"                               <iphone>                (gAnwesenheit)
Number      iPhone_BatteryLevel_K               "Batterie [%d %%]"                              <battery>                                       {channel="icloud:device:7d938589:4ff33ce:batteryLevel"}
DateTime    iPhone_LocationLastUpdate_K         "letzer Empfang [%1$td.%1$tm.%1$tY, %1$tH:%1$tM]"  <time>                                       {channel="icloud:device:7d938589:4ff33ce:locationLastUpdate"}
Switch      iPhone_Home_K                       "Zuhause"                                       <presence>              
Switch      iPhone_Refresh_K                    "Koordinaten auffrischen"                                                                       {channel="icloud:device:7d938589:4ff33ce:location", autoupdate="false"}
Location    iPhone_Location_K                   "Koordinaten"                                   <gps>                                           {channel="icloud:device:7d938589:4ff33ce:location"}

Sitemap:
Group item=giPhone_A {
Text item=iPhone_BatteryLevel_A
Switch item=iPhone_Home_A mappings=[ON=“anwesend”, OFF=“abwesend”]
Text item=iPhone_LocationLastUpdate_A
Switch item=iPhone_Refresh_A mappings=[REFRESH=‘jetzt aktualisieren’]
Mapview item=iPhone_Location_A height=10
}

Group item=giPhone_K {
                Text item=iPhone_BatteryLevel_K
                Switch item=iPhone_Home_K mappings=[ON="anwesend", OFF="abwesend"]
                Text item=iPhone_LocationLastUpdate_K
                Switch item=iPhone_Refresh_K mappings=[REFRESH='jetzt aktualisieren']
                Mapview item=iPhone_Location_K height=10
            }

Rules:
rule “iPhone Home A”
when
Item iPhone_Location_A changed
then
// specify your home location
val PointType home_location = new PointType(new DecimalType(50.12), new DecimalType(8.45))
val PointType phone_location = iPhone_Location_A.state as PointType
val int distance = phone_location.distanceFrom(home_location).intValue()
// specify your preferred radius (in meters)
if ( distance < 200) {
iPhone_Home_A.postUpdate(ON)
logInfo(“iPhone Home”, “iPhone is at home.”)
} else {
iPhone_Home_A.postUpdate(OFF)
logInfo(“iPhone Home”, “iPhone is away.”)
}
end

rule "iPhone Home K"
when
    Item iPhone_Location_K changed
then
    // specify your home location
    val PointType home_location  = new PointType(new DecimalType(50.12), new DecimalType(8.45))
    val PointType phone_location = iPhone_Location_K.state as PointType
    val int distance = phone_location.distanceFrom(home_location).intValue()
    // specify your preferred radius (in meters)
    if ( distance < 200) {
        iPhone_Home_K.postUpdate(ON)
        logInfo("iPhone K Home", "iPhone K is at home.")
    } else {
        iPhone_Home_K.postUpdate(OFF)
        logInfo("iPhone K Home", "iPhone K is away.")
    }
end

Has somebody an idea what’s wrong?

Thank you guys!

Kind regards,

A long time since - as I’m on a android now, but as far as I know family share does not work. You 'll have to setup the account of your wife as well.

With kind regards,
Patrik

1 Like

Yes. I am using iCloud as part of my presence detection and each phone/user needs their own account.

Sorry, but think you are wrong. I configured all Devices off the Family with one Account (In my case my son’s one)! As long as I share in Friends (now Who am i in new iOs) my Positions is shown under the account of my son too.

Update: Missing the thing configuration here. It’s important you add all things under one Bridge if you want to do with one account.