iCloud Binding - DeviceID

Patrik, overall I think the documentation is for the most part quite informative, but I will have a read through and see if I can come up with some suggestions or additions to the docs.

I still cannot get the locationLastUpdate item to work. I´ve looked in the logs and find the following in the openhab.log.

2017-12-25 10:53:49.704 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.thingUpdated()' on 'org.openhab.binding.icloud.handler.ICloudDeviceHandler@c39140': 2017-12-25T10:48:47CET is not in a valid format.
java.lang.IllegalArgumentException: 2017-12-25T10:48:47CET is not in a valid format.
	at org.eclipse.smarthome.core.library.types.DateTimeType.<init>(DateTimeType.java:96) ~[?:?]
	at org.openhab.binding.icloud.handler.ICloudDeviceHandler.getLastLocationUpdateDateTimeState(ICloudDeviceHandler.java:172) ~[?:?]
	at org.openhab.binding.icloud.handler.ICloudDeviceHandler.updateLocationRelatedStates(ICloudDeviceHandler.java:123) ~[?:?]
	at org.openhab.binding.icloud.handler.ICloudDeviceHandler.deviceInformationUpdate(ICloudDeviceHandler.java:74) ~[?:?]
	at org.openhab.binding.icloud.handler.ICloudAccountBridgeHandler.lambda$2(ICloudAccountBridgeHandler.java:155) ~[?:?]
	at java.util.ArrayList.forEach(ArrayList.java:1249) [?:?]
	at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2062) [?:?]
	at org.openhab.binding.icloud.handler.ICloudAccountBridgeHandler.informDeviceInformationListeners(ICloudAccountBridgeHandler.java:155) [218:org.openhab.binding.icloud:2.2.0]
	at org.openhab.binding.icloud.handler.ICloudAccountBridgeHandler.refreshData(ICloudAccountBridgeHandler.java:144) [218:org.openhab.binding.icloud:2.2.0]
	at org.openhab.binding.icloud.handler.ICloudDeviceHandler.initializeThing(ICloudDeviceHandler.java:137) [218:org.openhab.binding.icloud:2.2.0]
	at org.openhab.binding.icloud.handler.ICloudDeviceHandler.initialize(ICloudDeviceHandler.java:84) [218:org.openhab.binding.icloud:2.2.0]
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.thingUpdated(BaseThingHandler.java:228) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
	at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: java.time.format.DateTimeParseException: Text '2017-12-25T10:48:47CET' could not be parsed, unparsed text found at index 19
	at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1952) ~[?:?]
	at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) ~[?:?]
	at java.time.LocalDateTime.parse(LocalDateTime.java:492) ~[?:?]
	at org.eclipse.smarthome.core.library.types.DateTimeType.<init>(DateTimeType.java:89) ~[?:?]
	... 21 more

Any suggestions to what could be the reason for this ?

@MartinKo
Hi Martin,

that looks like a bug in the binding; it can not parse the date format your server response produces. I´ll have a look into that and let you know once I´ve an updated version.

with kind regards,
Patrik

@MartinKo
Hi Martin,

can you try if you still have the problem with this version:

did some changes in the way the timestamp is processed.

with kind regards,
Patrik

I am running the stable version. Would it simply be a matter of renaming the file, changing the permissions and dropping it into /var/lib/openhab2/tmp/mvn/org/openhab/binding/org.openhab.binding.icloud/2.2.0 ?

… and restarting the service ?

on karaf console stop the binding 1st

$ list
$ stop xxx

xxx is the number of the binding, then copy the new jar to the addon folder; check with list that it did load and start as expected.

I find…

218 │ Resolved │ 80 │ 2.2.0 │ iCloud Binding
and
256 │ Installed │ 80 │ 2.2.0.201712251133 │ iCloud Binding

I am able to start/stop 218, but when I try to start 256, I get an error message

openhab> stop 218
openhab> start 256
Error executing command: Error executing command on bundles:
	Error starting bundle 256: Could not resolve module: org.openhab.binding.icloud [256]
  Another singleton bundle selected: osgi.identity; type="osgi.bundle"; version:Version="2.2.0"; osgi.identity="org.openhab.binding.icloud"; singleton:="true"

I will try a fresh install tomorrow and let you know how it went.

@MartinKo

Just uninstalling 218 should do;

$ uninstall 218

with kind regards,
Patrik

@patrik_gfeller

Your latest snapshot is now running

257 │ Active   │  80 │ 2.2.0.201712251133     │ iCloud Binding

and the item locationLastUpdate is now being updated as it should.

2017-12-25 20:25:15.218 [vent.ItemStateChangedEvent] - Martin_LocationLastUpdate changed from 2017-12-25T20:20:19.187+0100 to 2017-12-25T20:20:23.648+0100

Thanks for fixing and for hints on how to get the snapshot running. I´ve had it running for approximately 1 hour with refreshTimeInMinutes=5 with no exceptions. There is a slight delay detecting location change (I took a walk to test if the service updated location and locationLastUpdate to where I actually was at various times), but I think this due to how icloud updates information and not the binding.

Best regards,

Martin

@Michael_Marinkovits
Hi Martin,

thanks for the feedback :slight_smile:.

with kind regards,
Patrik

@sipvoip @MartinKo
I see new things in auto discovery but they are formattet like:

“icloud:device:myaccount:1e97b374:batteryStatus”

so I assumed that device ID is “1e97b374” but with this there is no connection possible.
You all had longer device IDs. You really just looked in the auto discovery in the things?

Now grep the logs for that token and you will find the associated ID.

@PeterP
In case you have not found the Device ID yet. Go to the Paper UI. Press Configuration->Things->“Your iCloud Device”. You will now see a blue pen icon. Press that and you will find the Device ID under the Configuration Parameters.

Good luck

Hi there!
I want to use this binding as well but i got a few concerns.
I got it all set up and working but i recognize a huge battery drain on my devices.
Normally my iPhone ia at around 60 - 70 % in the evening but now it’s at 5 % …
The update interval is set to 5 minutes.
If i change it to 10 or 30 minutes in my textual configuration-file the binding does not work anymore.
Is the max number 9 minutes?

Does anyone else have this issue or maybe a solution?

Greetings

Jonas

having some issue please help

steps i am using please corect me

  1. add to things file
    Bridge icloud:account:GadIOS [appleId=“sadgdysp@gmal.com”, password=“blabla”, refreshTimeInMinutes=9]
    {
    Thing device Gad_Iphone “BatmenVsGod” [deviceId=“dont have it yet right?|”]
    }
  2. add items
    Group “iPhone” iCloud_Group

String iPhone_BatteryStatus “Battery Status [%s %%]” (iCloud_Group) {channel=“icloud:device:GadIOS:Gad_Iphone:batteryStatus”}

  1. when i try to take Device ID from Paper UI i am not able to see full config
    but the device is online

i can see only ,Name and Location

  1. i am getting this logging erros

23:35:24.295 [ERROR] [home.core.thing.binding.ThingFactory] - Thing factory (class org.openhab.binding.icloud.internal.ICloudHandlerFactory) returned null on create thing when it reports to support the thing type (icloud:device).
23:35:24.296 [WARN ] [g.discovery.internal.PersistentInbox] - Cannot create thing. No binding found that supports creating a thing of type icloud:device.

  1. when i try to add from paper UI inbox i am getting 409 confilct

  2. after a while of playing i also got this

     at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)[95:org.eclipse.smarthome.config.xml:0.9.0.201707190720]
     at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)[95:org.eclipse.smarthome.config.xml:0.9.0.201707190720]
     at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)[95:org.eclipse.smarthome.config.xml:0.9.0.201707190720]
     at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)[95:org.eclipse.smarthome.config.xml:0.9.0.201707190720]
     at org.eclipse.smarthome.core.thing.xml.internal.AbstractDescriptionTypeConverter.unmarshal(AbstractDescriptionTypeConverter.java:185)

One question about iCloud (I could not find the answer yet).

If I login into my web based iCloud account at icloud.com, I can see al my friends in “Find my Friends” App.
Is this information also (theoretically) retrievable with the binding?
I did not find any other Things yet, beside the Family member associated with my icloud account.

No one?

I have the same problem, has someone been able to solve it?

Did anyone managed to create multiple accounts ?

Because functions in Binding are more (Status, Find my Phone, etc.) I think not the service friends from apple is used, the service is used by binding will be “find my phone”. And there you can only see family and own devices.

O’m no developer, but think icloud-friends would be a very different binding, not sure if apple got an API for it.

Thanks, Jens.
You are possibly right.
Maybe there will be something in the future…