fortunately I was able to figure out most of the stuff; discovery, parsing & thing handling works in the prototype. But I´ve no idea how far I´m from best practices (e.g. if such code has a chance ever to see the OH2 repo). Thus I would appreciate some feedback prior to going to the work of declaring all the channels.
@patrik_gfeller
Hi Patrick,
if you can update your fork with your latest results, I can do a first review later this evening.
You can even create a PR an mark it as [WIP]…
We can then directly comment on your code.
From What I see in your screenshot, this lokks excellent and is a good result in such a short time.
the fork is up-to-date … curious if it is useable; as I´m not working with java and those frameworks usually.
Depending on your feedback we´ll see how to continue best.
Sure, that is totally OK.
By a signing it Work in progress you are telling the maintainers that there is no need to review the code already. However by having it posted as a PR others could help you.
Copied jar file into addon directory and restarted OH2, but can’t get the binding online. (ID and password applied of course)
Note: just copied the file using samba, do I need to run chmod / chown on the jar file ?
Question 1:
As for now I am on OH 2.1 stable, do I need to upgrade to 2.2 snapshot or should the binding run on the stable version as well?
Error message:
2017-09-11 12:16:15.771 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing handler factory 'org.openhab.binding.icloud.internal.iCloudBridgeHandlerFactory@16db7f5': For input string: "d7a65448"
java.lang.NumberFormatException: For input string: "d7a65448"
Second: (original number exchanged against 1234567890123)
2017-09-11 12:31:22.829 [ERROR] [g.icloud.handler.iCloudBridgeHandler] - java.lang.NumberFormatException: Expected an int but was 1234567890123 at line 1 column 858 path $.serverContext.prefsUpdateTime
Question 2:
While the script was running well I wonder if I may use the items listed in the first post as well? Is there a need to create additional items or things (as for the “owner” for instance)?
Question 3:
I want to setup binding for two different accounts, could you please give me a hint how that needs to be configured?
Thanks for putting this into a binding @patrik_gfeller! Would it be possible to add another channel that gives the distance from any arbitrary location point (instead of just from Home)? This would then make it easy to test for whether the device is at specific places, such as work/schools etc.
that would be possible - but how many locations should the binding support. This can be achieved quite easily with a rule (distance calculations) … thus I propose to do additional distances there. Let me know if you need help with how to do this in a rule.
This kind of logic should not be part of a binding. It was discussed more than once, that a binding should provide data and allow interaction but higher evaluation logic should happen in a rule. @smar a rule to check the distance between two locations can be found in the first posting of this thread
Thanks - I see that we have a distanceFrom built in into the location type, which of course removes the need for adding this sort of functionality to the binding. Ignore my earlier post…
those are most likely bugs in the binding - as said; early alpha stage … can you send me the logs of the binding in the area where it fails; I’ll have a look into it to fix it. Thanks for acting as a tester
Just installed it out of curiosity as well, unfortunately the bridge is already failing.
Searched for thing, chosen bridge ant entered iCloud credentials.
Log shows:
2017-09-11 15:55:56.498 [hingStatusInfoChangedEvent] - 'icloud:bridge:fb612d65' changed from UNINITIALIZED to INITIALIZING
2017-09-11 15:55:56.511 [hingStatusInfoChangedEvent] - 'icloud:bridge:fb612d65' changed from INITIALIZING to ONLINE
2017-09-11 15:55:57.931 [hingStatusInfoChangedEvent] - 'icloud:bridge:fb612d65' changed from ONLINE to OFFLINE
After activating the Binding I went to Inbox and searched for things via iCloud Binding. I was able to choose between bridge and actual device. I’ve chosen bridge with the above result.
I now bound an item to owner channel of bridge but it remains empty as bridge stays offline.