[SOLVED] iCloud-Binding Things turn offline unexpectedly

Hi,

i added the icloud Binding to my openhab 4 installation to check if my iPhone is in my house. Unfortunately, after some time the icloud binding either reports a communication error or the binding says that my iPhone is offline. When I restart one of the things they start working again but after some time one of them goes offline again. Is there a way to keep both things online?

Maybe that’s the same?
https://community.openhab.org/t/icloud-things-permanently-turning-offline/150553

Thanks for your reply. Looks like this could be a hacky solution for the problem. So far it looks like the rule posted in this thread works.

configuration: {}
triggers:
  - id: "1"
    configuration:
      thingUID: icloud:account:xxxxxx
      previousStatus: ONLINE
      status: OFFLINE
    type: core.ThingStatusChangeTrigger
  - id: "2"
    configuration:
      time: 07:00
    type: timer.TimeOfDayTrigger
  - id: "4"
    configuration:
      thingUID: icloud:device:xxxxx
      previousStatus: ONLINE
      status: OFFLINE
    type: core.ThingStatusChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "3"
    configuration:
      type: application/javascript
      script: >-
        var logger = log('Restarting Apple Things');
        var thingMgr = osgi.getService('org.openhab.core.thing.ThingManager');
        var ThingUID = Java.type('org.openhab.core.thing.ThingUID');
        logger.info('disable iCloud Account and iPhone');
        thingMgr.setEnabled(new ThingUID('icloud:account:xxxxxx'), false);
        thingMgr.setEnabled(new ThingUID('icloud:device:xxxxx'), false);
        java.lang.Thread.sleep(3000);
        logger.info('Enable iCloud Account and iPhone');
        thingMgr.setEnabled(new ThingUID('icloud:account:xxxxx'), true);
        thingMgr.setEnabled(new ThingUID('icloud:device:xxxxx'), true);
    type: script.ScriptAction

hmm … i installed icloud binding on OH4.1
The first installation went flawless. Got 2FA-code etc. It worked for some days.

  • then the account suddenly turned offline

I tried to delete the account thing (defined through UI) and reinstall

  • but now i never get the 2FA code on my phone or macbook ?!?

I tried delete&reinstall gain. Also binding.
I tried to disable&enable account thing.
nothing makes the 2FA-code show on iphone again,

Did you find a solution for this by any chance, Peter? I have the exact same problem since a few days…

yeah, it works now :slight_smile:
Sadly i am not shure excactly why - because i did a lot of things due to other problems. But mainly:

I restored an old backup,
disable + wait 10 sec + reactivate the account thing
Then the message for the code showed in iphone/mac

Thanks for your response Peter! Very strange, I didn’t change anything, it just stopped working a week ago. Whatever I try now, I never get the 2FA on any off my Apple devices. I also tried with another Apple Account and that’s also not working :frowning: I guess I’ll need to do some more digging…

just an idea:
do you have an old back of the sd-card?

for debugging - try to restore “everything” with that backup. If it still fails, it might somehow be a flaw on apples side

same here.
It was working for months - now the two-factor-dialogue does not popup on my iPhone anymore.

Quick update from my side: I didn’t change anything, just kept trying every now and then and this night I received the MFA code again and could enable the iCloud things again… :man_shrugging:

lucky you :slight_smile:
For me it is still not working (anymore).