jasch97
(Jannik Schubert)
January 28, 2024, 6:51pm
1
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?
jasch97
(Jannik Schubert)
January 29, 2024, 8:23pm
3
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