openhab-addons: [iCloud] Bridge-Thing generates Communication Error

The Brigde-Thing (iCloud-Account) does not go online.

It gets the state: COMMUNICATION_ERROR with the following details information:

java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header

The binding is not usable completly at this time.

Current Behavior

The Bridge-Thing does not come online. Restart of binding or OH doesn’t help.

Possible Solution

It seems, that apple has changed something in their api.

Steps to Reproduce (for Bugs)

  1. Just start the binding.
  2. See the error

Environment

  • Version used: OpenHAB 3.3 / 3.4
  • Operating System: Windows Server 2016

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 101 (60 by maintainers)

Most upvoted comments

Good news. I was able to identify and solve the problem. The root cause is javas implementation of CookieManager, which leaves out the quotes (") when building the cookie header. I was able to create a solution for that. See above branch.

I started to create a proof-of-concept for including icloud4j into openhab-addons here https://github.com/maihacke/openhab-addons/tree/icloud

I made some more progress. I was able to integrate the new solution into the existing binding. Every thing is still very unpolished, but it works. If you like to try out feel free to do so. The commit id is db3b6b930f7e39d6d3711cbdd4a26b9133231bdf. If you start with the new version you should receive a 2-FA code on one of your devices. Put this code into your thing config:

Bridge icloud:account:simon [appleId=“*“, password=””, code=“XXXXXX”, refreshTimeInMinutes=5]

DISCLAIMER: This solution is far from finished. There is no error handling. Sometimes codes are requested multiple times, which is confusing, and many more, … but it is a start…

You may download the file here https://github.com/maihacke/openhab-addons/releases/download/proof-of-concept-1/org.openhab.binding.icloud-3.2.1-SNAPSHOT.jar

Sorry switches my notebook inbetween. Doesn’t have it either. You could also think of using the java code as a blueprint, starting from org.openhab.binding.icloud.TestICloud#testAuth. It’s not to complicated.

Thanks everybody !!!

jo…installed now…comes online…retrieving all data…will report after 24 hours again!

Hello everyone,

I installed and set up the RC4. Worked right away. I will report if there are problems.

Thank you so much for doing the binding programming.

The configuration of the bindings also works wonderfully as a text file. This is my configuration “icloud.things” for those who don’t do the configuration via UI.

Bridge icloud:account:iCloud_FR "iCloud Bridge"             [appleId="XXXXXX@XXX.XXX password="XYZ123", refreshTimeInMinutes=5, code="########"]
{
Thing device iPhone_Flori   "iCloud Florians iPhone"        [deviceId="JGFKUZGLZGB"]
Thing device iPhone_Tine    "iCloud Tines iPhone"           [deviceId="JGFKUZGLZGB"]
Thing device iPhone_Johanna "iCloud Johannas iPhone"        [deviceId="JGFKUZGLZGB"]
}

Regards Florian

That’s not true. You can do via rest-API (enable/disable)

just another hint: here one bridge went offline 6 times this morning, but came online again within next 3 minutes. So you better not should restart binding immediately. 😉