iCloud Binding Communication Error

I have seen this within your description. But my json file format looks like this and is created by MainUI. Can i modify the json in order to do the job?

"icloud:account:62ba8ace": {
    "class": "org.openhab.core.thing.internal.ThingStorageEntity",
    "value": {
      "isBridge": true,
      "channels": [],
      "label": "iCloud Account Willi",
      "configuration": {
        "appleId": "willibald.konrath@t-online.de",
        "password": "xxxxxx",
        "refreshTimeInMinutes": 5
      },
      "properties": {},
      "UID": "icloud:account:62ba8ace",
      "thingTypeUID": "icloud:account",
      "location": ""
    }

Where needs an icloud.things (not a .config) file to be stored and how does it come together with my json file? Sorry for this kind of questions but i am a MainUI user type.

I have tested it…it’s working…Thank You!!!

What you are referring to is the json db. I’m not sure if it works to add it there. I meant a .things file in the config dir.

1 Like

Understood now. Is my first xxx.things file. Took a while because i am not a text config user.

Works for me, asked for access confirmation cipher code twice.
Thanks a ton for the effort!

The discovery seems to double work since I configured two apple account bridges in the thing file.

Stored the icloud.things file using the same account ID “62ba8ace” as in my old json database file and it does the job using the existing account thing :smiley:.

Many thanks so far.

Bridge icloud:account:**62ba8ace** [appleId="willibald.konrath@t-online.de",
1 Like

Understood, thats also interesting. I will try to find out how to add the config to the UI.

1 Like

Adding the code to the UI was very easy. Created a new release for that:

4 Likes

Works out, am back to normal now :stuck_out_tongue_winking_eye:. Thanks a lot for your effort. Great support.

I set this up for my account. That works great. This is a WEB.de, gmx.de, etc. account.

My daughter has an icloud.com account. This gives me a “Cannot authenticate token” error

Regarding icloud.com account, if you provide a log. I can check it.

I’ll try to debug that tomorrow

Thanks for your work on this and for sharing your progess.

I tried it today (deleted iCloud binding in the UI, downloaded the .jar file to addons folder). It works as expected. I immediately receive a 2FA prompt on my iPhone. I entered the code in the Code field under the iCloud Account Thing in the UI. I’m running openHAB 3.4.0M1 on a Pi4 using openhabian.

Apple iCloud account is US based.

I have the same error if I setup another account in openhab, but the first account is fine.
Patrick

2022-11-09 12:29:20.382 [WARN ] [l.handler.ICloudAccountBridgeHandler] - Unable to refresh device data

java.io.IOException: Cannot authenticate token

	at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.lambda$0(ICloudAccountBridgeHandler.java:110) ~[?:?]

	at org.openhab.core.cache.ExpiringCache.refreshValue(ExpiringCache.java:101) [bundleFile:?]

	at org.openhab.core.cache.ExpiringCache.getValue(ExpiringCache.java:72) [bundleFile:?]

	at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.refreshData(ICloudAccountBridgeHandler.java:188) [bundleFile:?]

	at org.openhab.binding.icloud.internal.handler.ICloudDeviceHandler.refreshData(ICloudDeviceHandler.java:126) [bundleFile:?]

	at org.openhab.binding.icloud.internal.handler.ICloudDeviceHandler.initialize(ICloudDeviceHandler.java:116) [bundleFile:?]

	at jdk.internal.reflect.GeneratedMethodAccessor98.invoke(Unknown Source) ~[?:?]

	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]

	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

	at java.lang.Thread.run(Thread.java:829) [?:?]

I’m Also having problems authenticating the code

2022-11-09 22:37:57.598 [WARN ] [l.handler.ICloudAccountBridgeHandler] - Unable to refresh device data

java.io.IOException: Cannot authenticate token

at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.lambda$0(ICloudAccountBridgeHandler.java:110) ~[?:?]

at org.openhab.core.cache.ExpiringCache.refreshValue(ExpiringCache.java:101) ~[?:?]

at org.openhab.core.cache.ExpiringCache.getValue(ExpiringCache.java:72) ~[?:?]

at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.refreshData(ICloudAccountBridgeHandler.java:188) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

at java.lang.Thread.run(Thread.java:829) [?:?]

2022-11-09 22:37:57.617 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'icloud:account:6d9c5a675b' changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): Cannot authenticate token

Works for my first Apple ID, but not for the second.

Cannot authenticate token

I created a new release here, which improves many things (mainly code quality and hopefully avoidance of multiple code requests). Release RC-1 · maihacke/openhab-addons · GitHub
I’m not sure if it yet supports multiple iCloud accounts. If you have issues please post debug log.

8 Likes

Thanks for your effort, will try tomorrow and report back.

1 Like

Was able to try earlier.
Updated to latest version and second account was online straight away. Great work :+1:
Only issue I see so far is some localisation strings are incorrect. But thats another story…

Edit: 3rd account online as well…

Thanks for your work! Do i need a thing config textfile? At the UI i dont see a code field and adding it at the “code tab” at MainUI doesnt let me save it