iCloud device data integration in openHAB

rules
location
iphone
Tags: #<Tag:0x00007f6ce929cc20> #<Tag:0x00007f6ce929c6d0> #<Tag:0x00007f6ceeb579f0>

(Rich Koshak) #165

I’ve given it a good deal of thought and I don’t think you can use the battery charging status for this. As you are seeing, it takes too long for the battery to drop a percent to be useful and there isn’t a “PLUGGED IN/UNPLUGGED” status you can rely upon. You will have to look to some other sensor or status information to detect this.


(Ryan Grace) #166

Hi @patrik_gfeller,

Just wanted to let you know that I installed the snapshot version of the binding you linked to above and have three iCloud accounts working now with three iPhones. This is very useful. No issues so far…

Thank you!


(Patrik Gfeller) #167

:slight_smile: thanks for the feedback; happy to hear that it is used (& works).

with kind regards,
Patrik


(-) #168

Hi @patrik_gfeller. Would it be possible to add a channel that kicks off an immediate location refresh for a given device (i.e. in case we require an updated location when in between the regular refresh schedule).

Thanks again!


(Patrik Gfeller) #169

Hi @smar,

yep - I can do that; but please note that the I can only ask iCloud. It will give the last known position, which might be outdated by a few minutes. If I´m correct it only updates every 5 minutes. Would that do the job?

If yes I´ll implement a switch item to force a refresh. In that case would you still like to set an update interval. Or should that be optional?

The switch would be on the bridge item - as I receive updates from all items on a request. So all items of that bridge will be receive an update. Is that ok?

with kind regards,
Patrik


(-) #170

Yes, a switch would be perfect. And yes, it may be good to also continue with the refresh cycle (maybe optional?) for those that want this. WRT the switch, can it be done on the device instead of the bridge? That saves hitting the iCloud servers for all devices, when we may only be interested in one device, especially when a household has a quite a few iPhones! Obviously it is not a problem, if this is too difficult to do.

And yes, I recognise the delays in iCloud updates - hence the reason for this manual request. What I’ve found practically with iCloud is that even if the initial location data is old, forcing a couple of quick succession refreshes does get it to get updated data from the phone, as long as the phone is accessible.


(Patrik Gfeller) #171

The request to the server produces a response with all data for all devices registered to this account; so the request would be the same if the switch is on the item - I just would have to filter the other devices out from the repsponse. Thus I think a bridge update is the way to go.


(-) #172

You are right. I haven’t set up the binding for all our different iOS accounts yet, and so hadn’t realised that the bridge was getting data for all devices on a given account.


(Patrik Gfeller) #173

ok … done - do you need it immediately?


(-) #174

Wow that was quick!! :smile: Thanks, but not urgent. Whenever you have time. I will probably look to install it later in the evening anyway.


(Patrik Gfeller) #175

ok - I´ll give it a few tests then commit; this should trigger a build. then you can use the link posted by ThomDietrich above. In the evening it should be ready. Give me a note if it is not there, or does not work as expected.


(-) #176

Great, thanks again @patrik_gfeller.


(Patrik Gfeller) #177

It´s commited; once travis & jenkins are green (at the very end of the thread) it should be ok to consume:


(Kurt S) #178

Hi,

first of all, thanks a lot @patrik_gfeller for this great binding - it’s working very well indeed!
I’ve seen that users report the possibility to use multiple iCloud accounts (e.g. mine and the one of my wife), however I’m not able to track all our devices via 2 accounts at the same time.
I’ve tried to enter both credentials in the .thing file, but without success

Any guidance on how to achieve this would be appreciated.
thanks in advance!

Kurt


(Hans-Jörg Merk) #179

You need two bridge things, one for each account.


(Kurt S) #180

Hi Hans-Jörg!
thanks for the swift response!

I seem to only be able to actually set the pwd for the account in paperUI.

When I enter the credential in the thing files (I created 2 .thing files, as you suggested), none of the passwords for either account in the thing file is recognized and returns a 401 error (non authorized access) in the log files.
Did I mis-read the readme? My thing file just looks like that:

AppleId my@id.com
Password mypwd
RefreshTimeInMinutes 5

As soon as I re-type the pwd in PaperUI, items are discovered. However, I can only enter credentials for one account there.

Kurt


( ) #181

Hey Kurt, check out: https://github.com/openhab/openhab2-addons/pull/2672#issuecomment-336739126


(Kurt S) #182

Thanks a lot for your support! It’s working perfectly!


(Aleksey) #183

Hello, help. The third day I try to start icloud binding, but nothing happened. In the paper UI I see Status: UNINITIALIZED, there is nothing in the logs, version org.openhab.binding.icloud-2.2.0-SNAPSHOT.jar. I can not understand why in the openhab logs I do not see any errors?


( ) #184

Did you follow the README and create a bridge Thing manually?