iCloud device data integration in openHAB

Although I have specified updates are every 5 minutes in the binding configuration I seem to get them every 10. its certainly not a big issue but I thought I would advise.

I seem to get the BatteryStatus and BatteryLevel values erratically as in not every update seems to have them, as the values go to ‘unknown’ and 0.0 respectively when not provided. This reliability is a little more concerning.

but certainly heading in the right direction with the latest updates

Thanks!!!

Paul

[EDIT] The updates are looking like every 15 minutes not 10 as stated above.
Still the same unreliable Battery meta data retrieval.

@idkpmiller could you please switch your debug level to TRACE and post the line start with “json”. This will help to identify why the deleted device is still visible.

Before you post the json string, please check for sensitive information like your Apple ID.

@Philipp I will get this sorted shortly.

I thought I would advise that when I was out I realised that my updates were not grabbing new data properly so I performed a refresh now ON using the switch.

This provided all the information including the previously missing BatteryStatus and BatteryLevel.
Unfortunately since that refrfesh at 1354 I have only had one other update around an hour later. at the time of grabbing the logs it was 15:53 so the regular updating is certain not very regular.

LOGS:

2017-11-20 13:54:42.229 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge refreshing data ...
2017-11-20 13:54:42.229 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge refreshing data ...
2017-11-20 13:54:45.089 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:69e7d8f7]
2017-11-20 13:54:45.089 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:69e7d8f7]
2017-11-20 13:54:45.092 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [413c0f36]
2017-11-20 13:54:45.093 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [69e7d8f7]
2017-11-20 13:54:45.153 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:413c0f36]
2017-11-20 13:54:45.153 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:413c0f36]
2017-11-20 13:54:45.154 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [413c0f36]
2017-11-20 13:54:46.420 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:faa6ee2a]
2017-11-20 13:54:46.420 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:faa6ee2a]
2017-11-20 13:54:46.430 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [413c0f36]
2017-11-20 13:54:46.433 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [69e7d8f7]
2017-11-20 13:54:46.437 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [faa6ee2a]
2017-11-20 13:54:47.109 [DEBUG] [binding.icloud.handler.BridgeHandler] - Discovery for index [0]
2017-11-20 13:54:47.111 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone SE]
2017-11-20 13:54:47.111 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone SE]
2017-11-20 13:54:47.113 [DEBUG] [binding.icloud.handler.BridgeHandler] - Device id [413c0f36] found.
2017-11-20 13:54:47.115 [DEBUG] [binding.icloud.handler.BridgeHandler] - Discovery for index [1]
2017-11-20 13:54:47.117 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone 4s]
2017-11-20 13:54:47.117 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone 4s]
2017-11-20 13:54:47.119 [DEBUG] [binding.icloud.handler.BridgeHandler] - Device id [69e7d8f7] found.
2017-11-20 13:54:47.122 [DEBUG] [binding.icloud.handler.BridgeHandler] - Discovery for index [2]
2017-11-20 13:54:47.126 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPad Air 2]
2017-11-20 13:54:47.126 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPad Air 2]
2017-11-20 13:54:47.129 [DEBUG] [binding.icloud.handler.BridgeHandler] - Device id [faa6ee2a] found.
2017-11-20 13:54:47.132 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge data refresh complete.
2017-11-20 13:54:47.132 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge data refresh complete.
2017-11-20 14:50:11.975 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge refreshing data ...
2017-11-20 14:50:11.975 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge refreshing data ...
2017-11-20 14:50:14.587 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:69e7d8f7]
2017-11-20 14:50:14.587 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:69e7d8f7]
2017-11-20 14:50:14.599 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [413c0f36]
2017-11-20 14:50:14.602 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [69e7d8f7]
2017-11-20 14:50:14.664 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:413c0f36]
2017-11-20 14:50:14.664 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:413c0f36]
2017-11-20 14:50:14.667 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [413c0f36]
2017-11-20 14:50:16.208 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:faa6ee2a]
2017-11-20 14:50:16.208 [DEBUG] [binding.icloud.handler.DeviceHandler] - Device: [icloud:device:fbab2713:faa6ee2a]
2017-11-20 14:50:16.210 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [413c0f36]
2017-11-20 14:50:16.211 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [69e7d8f7]
2017-11-20 14:50:16.213 [DEBUG] [binding.icloud.handler.DeviceHandler] - Current data element: [faa6ee2a]
2017-11-20 14:50:16.835 [DEBUG] [binding.icloud.handler.BridgeHandler] - Discovery for index [0]
2017-11-20 14:50:16.837 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone SE]
2017-11-20 14:50:16.837 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone SE]
2017-11-20 14:50:16.839 [DEBUG] [binding.icloud.handler.BridgeHandler] - Device id [413c0f36] found.
2017-11-20 14:50:16.841 [DEBUG] [binding.icloud.handler.BridgeHandler] - Discovery for index [1]
2017-11-20 14:50:16.846 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone 4s]
2017-11-20 14:50:16.846 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPhone 4s]
2017-11-20 14:50:16.849 [DEBUG] [binding.icloud.handler.BridgeHandler] - Device id [69e7d8f7] found.
2017-11-20 14:50:16.852 [DEBUG] [binding.icloud.handler.BridgeHandler] - Discovery for index [2]
2017-11-20 14:50:16.855 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPad Air 2]
2017-11-20 14:50:16.855 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud device discovery for [iPad Air 2]
2017-11-20 14:50:16.858 [DEBUG] [binding.icloud.handler.BridgeHandler] - Device id [faa6ee2a] found.
2017-11-20 14:50:16.862 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge data refresh complete.
2017-11-20 14:50:16.862 [DEBUG] [binding.icloud.handler.BridgeHandler] - iCloud bridge data refresh complete.

Update:
I have just signed in icloud, gone to find my phone and the Iphone 4S that I asked to be removed from my account a few days ago is still there. I will try once more to ‘Remove from this account’ and see what happens.
Ahh! it seems I must switch off ‘Find My Phone’ on the device otherwise when it gets powered on and is online it will readd itself. I have now disabled on the phone and it is not showing in icloud web site. I will not yet delete the things entry in OH for the removed device and see what happens.

Update
After finally removing the iphone 42 which was listed as device 1. I can see that the iPad now moves from index 2 into index 1 slot and I get

2017-11-20 18:05:44.398 [DEBUG] [binding.icloud.handler.DeviceHandler] - Unable to find device data.

I think I will need to remove all the items and things and then start again? whats your thoughts?

Sounds like a plan! First of all, you should download the last version. Patrick has released a new version yesterday evening. Then I would start with a “plain” icloud.things file (see below) and check the discovery result on the paper ui. If everything is working correctly, you should see now you iCloud devices.

If not, please switch your log level from DEBUG to TRACE and provide one more time your log files.

./openhab/conf/things/icloud.things:
Bridge icloud:account:account1 [appleId="nomail4@me.com", password="SuperSecret", refreshTimeInMinutes=10, googleAPIKey="YOUR-API-KEY"]
{
     
}

Here is the process I followed, I have documented this as I am performing
the tasks so that I know where I have got to and the order I performed the
tasks in case of later queries.

  1. I commented out the icloud segments in my sitemaps
  2. I commented out the icloud dependant rules
  3. Using PaperUI I UNLINK the following things: Account, iPhone SE and
    iPad; Note: the iPhone 4S did not have any items linked to the things
  4. Using PaperUI removed all the items files for ALL devices and the account
  5. Using PaperUI remove things; iPhone Se, iPhone 4S, iPad and finally the
    iCloud account.

At this stage all configuration has been removed or prevented from loading
in the OH instance.
The following activitys occur on the console.

  1. bundle:list
    253 | Active | 80 | 2.2.0.201711192039 | iCloud Binding

  2. bundle:stop 253

  3. bundle:list
    253 | Resolved | 80 | 2.2.0.201711192039 | iCloud Binding

  4. bundle:update 253
    253 | Resolved | 80 | 2.2.0.201711201923 | iCloud Binding

  5. bundle:start 253

  6. bundle:list
    253 | Active | 80 | 2.2.0.201711201923 | iCloud Binding

  7. Check using PaperUI Configurations > bindings > icloud is still present

  8. Using PaperUI deleted Add-Ons > Bindings > iCloud

  9. Check using PaperUI Configurations > bindings > icloud has now gone

  10. using console the iCloud binding no longer appers in the bundle:list

[EDIT]
The tail of my email response got lost somehow, I have readded it back below.


Now to add the new version of iCloud

  1. Using PaperUI, Add-ons > Bindings > iCloud. INSTALL, successful
  2. bundle:list
    254 | Active | 80 | 2.2.0.201711201923 | iCloud Binding
  3. log:set DEBUG org.openhab.binding.icloud
  4. ISSUE -
    Cannot seem to locate the iCloud thing
    Cannot see the icloud binding using the Things ‘filter by binding’

At this stage I will stop so you can advise what I have done wrong as it is not appearing in the PaperUI

Paul

For those curious, I settled on a modified version of this approach. It occurred to me that there are indicators that I might be arriving home - the garage door opening, the front door unlocking, and so on. So now, I’ve configured the rules to automatically trigger me as being “home” when one of these events occurs, then I send refresh commands to iCloud a couple of times via timers in rules to get up to date location info for everyone, so I can know exactly who is home. This seems to work well without impacting battery life very terribly, since there’s only two of us at my place and it’s not like we have people coming and going all day long.

1 Like

I have tried rebooting a number of times and I still see no log entries from the iCloud binding.
Also as per my step-by-step the iCloud thing type is not selectable using PaperUI.

Any ideas of what I have done wrong in my step-by-step or is this an issue with the binding?

Regards

Paul

Hey @idkpmiller,
just so you know. I have just reported another issue with this binding (over on Github). There will be another breaking change before the binding is final. Besides this change everything works fine for me. I’d suggest to wait for this last change and then try again.

As per your detailed step-by-step list: I can’t quite follow as I am using the latest pull request build automatically published here: https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.icloud/

The file provided there needs to go into the addons folder. After that the binding should be ready to be used. The addons folder is even shared via samba if you use openHABian.

Thanks ThomDietrich.
I am trying to improve the binding use-ability and so was trying the more
GUI installation process with the console really to confirm everything is
deleted/log levels etc are correct.
If the current binding is more alpha than beta then of course I will go for
functionality testing first and follow your advise of copying the file into addons
directory.

Hey Paul,
I didn’t say that, the binding feels stable and mature. The issue I was talking about is about how the binding does things rather than a malfunction. See for yourself: https://github.com/openhab/openhab2-addons/pull/2672#issuecomment-346318855
I expect a merge into the main addons repository soon.

I have now tried downloading the file you kindly gave the link to and copied to the addons directory.
This resulted in the same outcome for me.

  • binding is seen as active in the console
  • PaperUI > configuration > Thing does not see the binding
  • No entries are found in the log.

Regards

Paul

I am now trying the latest version 2.2.0.201711251926 installing again using the PaperUI.
Now I have added the thing and setup my icloud account.
The binding has discovered the two devices on my account correctly.

I now go to the PaperUI Think menu and try and create items and link to them and hit a new problem, the item list is empty and the ‘create new item’ is also missing, see screen shot below.

1 Like

Hi Paul,

I tried to reproduce the problem here; but I can see the list of items and also create new ones. Can you try if this works on an other thing from an other binding - or is this specific to the iCloud binding on that installation?

thank you for all the time you invest to help with testing; it is much appreciated!

with kind regards,
Patrik

1 Like

Hi Patrik,
At your suggestion I have tried with another binding (i used chromecast
binding) and found the same issue.
Meaning there is a high probability this is a local server issue and NOT an
iCloud binding issue. I will need to investigate what is causing this, fix
and then come back to iCloud when it is working with other bindings.

Thanks

Paul

Hi all,

please note that the latest binding build is no longer working with OH 2.1; I´ll have to try with OH 2.2. snapshot. But I assume that the introduction of the “representation-property” as something to do with it …

I´ll update here as soon as I´ve tested it with OH 2.2

with kind regards,
Patrik

… ok; seems to work with OH 2.2 build #1100 (with paper UI); therefore it looks like the binding is not compatible with OH 2.1 anymore due to the use of the “representation-property” (to prevent unwanted inbox entries).

with kind regards,
Patrik

Hi Patrik,

Thanks for this binding, I succesfully tested it on OH2.1 with various iOS devices (2x iPhone 5s, Ipad 3, Ipad pro, Macbook).
Last sunday I uninstalled/installed the binding in PaperUI to obtain the latest version, and unfortunately in OH2.1 it is no longer working, as you mentioned above.
Is it possible to provide a workaround for OH2.1users? At the moment I do not yet want to upgrade to OH2.2, my current setup is working stable.
Where can I find a snapshot of the binding before the ‘representation property’ being included?

Thanks again!
Bram

even im not able to use in OH2.1, make it usable to 2.1v untill 2.2 is out officially

There is no need for a separate 2.1 version. You just need a snapshot before @patrik_gfeller implemented the representation property.
@patrik_gfeller could you let the guys know when you did so or lik to the respective snapshot build?

i didnt read the whole thread, sorry for that - its tooo long

i am on OH 2.1

is this binding just for OH 2.2 ? i cant see the iCloud-binding in my PaperUI…

But i’ve implemented the code given in the first thread and it works fine here in 2.1, without any binding needed…
just saying