iCloud device data integration in openHAB

@alkaline
Did you manually create the devices, or were they discovered? Manual device creation is not supported - you´ll need to configure the binding (bridge); this should discover your devices and add them to the inbox.

Else I´ll add more logging to the binding to find the cause for the issue.

Can you send me some more logs; manual device creation is not supported - the bridge should discover them … probably a bug in the bridge handler; but I´ll need more logs to see what went wrong.

Same here:

Is it because of the 2 factor auth? It goes online and half a second later offline again.
Indeed I have created the device manually first time, meanwhile I deleted both things, rebooted and just try to get the bridge online, which is failing.

the only message I see in the logs:

2017-09-11 18:34:34.484 [ERROR] [g.icloud.handler.iCloudBridgeHandler] - java.lang.NumberFormatException: Expected an int but was 1490620892563 at line 1 column 858 path $.serverContext.prefsUpdateTime
2017-09-11 18:34:34.486 [ERROR] [g.icloud.handler.iCloudBridgeHandler] - null
[Ljava.lang.StackTraceElement;@c7ffa3

most likely a wrong (to small datatype); as the number might not fit into an int. I´ll change it to “long” and post an updated link. Give me moment.

can you give that one a try:

1 Like

Success
Went immediately online and found two devices :slight_smile:
Thanks for your very quick reply, continue now testing.
Is it already possible to add a second account?

Same here, thanks for quick reaction. Won’t be able to play around further before Thursday but devices discovered as well.

never tested it with a 2nd account; should/could work :wink:
(pls. let me know)

Hi all,

to get the binding official we need a nice documentation page how to configure it & what channels it does support. I love coding; but hate to create such documents :wink: … in case someone would like to help/volunteer help would be appreciated.

with kind regards,
Patrik

Confirm: second account is working, found another 2 devices belonging to the second account. Start to play arround now :grinning:
GREAT WORK :+1::+1:

Works super! Two apple IDs/three devices all showing correctly!

Edit: Almost… I have two identical iPad 2 Air, one with ios 10, and one with ios 11 beta. All the data for the ios 10 one is returned, but only owner, name and unique id are returned for the ios 11 one, and then this:

2017-09-11 20:20:02.740 [INFO ] [.smarthome.model.script.icloud.rules] - BatteryStatus: Unknown
2017-09-11 20:20:02.741 [INFO ] [.smarthome.model.script.icloud.rules] - BatteryLevel:  0.0
2017-09-11 20:20:02.742 [INFO ] [.smarthome.model.script.icloud.rules] - TimeStamp:     null

Edit 2: Now that I’ve turned on Find My iPad it works (oops)

1 Like

Works great.
Installed this latest binding and found 6 devices .:wink:

Just for anyone who’s interested, here’s a basic sitemap:

sitemap icloud  label="iCloud Data" {

        Frame label="John Doe"  {
                Default item=JohnIPhone6_BatteryStatus icon="poweroutlet_uk"
                Default item=JohnIPhone6_BatteryLevel label="Battery Level [%.0f %%]" icon="battery"
//              Default item=JohnIPhone6_Location label="Location [%s]"
                Default item=JohnIPhone6_LocationAccuracy icon="movecontrol"
                Default item=JohnIPhone6_DistanceFromHome label="Distance from Home [%.0f m]" icon="zoom"
                Default item=JohnIPhone6_Street icon="house"
                Default item=JohnIPhone6_City icon="house"
                Default item=JohnIPhone6_Country icon="house"
                Default item=JohnIPhone6_FormattedAddress
                Default item=JohnIPhone6_LastLocationUpdate label="Updated [%1$td/%1$tm/%1$ty %1$tH:%1$tM]" icon="clock"
                Switch  item=JohnIPhone6_FindMyPhone label="Find this device"
        }
}

Just replace JohnIPhone6 with your thing name.

I have “JohnIPhone6_Location” commented out as I can’t quite figure out how to display the map (it displays perfectly in PaperUI/Control:

1 Like

Found one issue while starting up the system. Both Binding are still working afterwards, the logs file instead displays:

2017-09-13 06:55:07.443 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred during bridge handler ('icloud:bridge:966033ce') notification about handler initialization of child 'icloud:device:966033ce:0': null
java.lang.NullPointerException
	at org.openhab.binding.icloud.handler.iCloudBridgeHandler.childHandlerInitialized(iCloudBridgeHandler.java:109)[225:org.openhab.binding.icloud:2.2.0.201709111846]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$13.run(ThingManager.java:912)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
2017-09-13 06:55:07.533 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred during bridge handler ('icloud:bridge:be789ef3') notification about handler initialization of child 'icloud:device:be789ef3:0': null
java.lang.NullPointerException
	at org.openhab.binding.icloud.handler.iCloudBridgeHandler.childHandlerInitialized(iCloudBridgeHandler.java:109)[225:org.openhab.binding.icloud:2.2.0.201709111846]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$13.run(ThingManager.java:912)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

Like your screenshot location is displayed in Paper UI, but not on the iPhone itself while showing the sitemap…sitemap on the iPhone shows always 0, no link to google maps or something.
Is there a way to get it displayed there as well?

That’s why I had that line commented out of the sitemap - I can’t get it to show on the sitemap or my phone either :frowning:

Have a look at Google Map on how to display it in basic ui.

Add

		Mapview item=JohnIPhone6_Location height=13 //height depends from your needs

to your Sitemap and the location will be displayed on a OpenStreetMap.

2 Likes

Thanks Christoph, that was a lot easier than I expected! I can’t find any documentation on “Mapview” - are there any other parameters e.g. initial zoom, etc.?

Edit 1: My impatience got the better of me :roll_eyes: In Classic UI, the map shows at maximum zoomed out until there’s an update received, then it zooms in to the correct location automatically. The maps don’t display on the sitemap in the openHAB Android app, but they do in Chrome on Android, except for the initial zoom issue also.

Is it possible to force an initial zoom, using something like “Mapview item=… zoom=80”? (I tried that but it doesn’t work…)

Edit 2: This seems to be an issue with the ClassicUI, as BasicUI shows the map correctly zoomed in on first load.

The MapView is not yet documented but an Issue exists and is waiting for a volunteer. https://github.com/openhab/openhab-docs/issues/492

I’m sorry to tell you, that the Mapview only has the height parameter, the actual map can not be influenced…