sorry for the late reply; I´m quite busy processing the feedback from the code review from the binding . Unfortunately the binding is only compatible with the upcomming OH 2.2 release; it will not work properly with OH 2.1 anymore.
A short update to all: The code review for the binding is in process and I hope it will make it into the OH 2.2 release. Thanks to all who helped with testing. Some important information: The release version of the binding is a “reduced to the max” version, that does not support address lookup anymore. This funcionality was considered not specific to the binding and might be implemented later in a more generic way to make it available for all coordinates.
Also the “refresh” mechanism will use the standard OH refresh; thus the specific channel will be gone. But a refresh can be triggered by sending a refresh command to a device channel.
I´m happy to report that the 1st version of the binding was merged to OH 2.2 and will be part of the release . Once more a big thank to @ThomDietrich, @Kai, @martinvw, @hmerk for their patience and help. Without them the binding would not be possible.
Also many thanks to all who tested early versions of the binding and provided valuable feedback.
I have one small request: Documenting is not my strongest part; thus if you have improvements for the readme that would be beneficial for new users please provide me feedback. Prefered in a form that I can directly use in the document to improve it .
I am getting a problem calling the distanceFrom method from the PointType class.
My Rule:
rule Sophia_Home_Distance
when
Item ICloud_Sophia_Location changed
or
Item Home_Coordinates changed
or
System started
then
logInfo(Sophia_Home_Distance.name, "Current Location: {}", ICloud_Sophia_Location.state.class)
logInfo(Sophia_Home_Distance.name, "Home Location: {}", Home_Coordinates.state.class)
var DecimalType distanceType = ICloud_Sophia_Location.state.distanceFrom(Home_Coordinates.state)
var long km = distanceType.intValue / 1000
logInfo(Sophia_Home_Distance.name, "Distance: {}", km)
Sophia_Home_Distance.sendCommand(km)
end
Log Output:
2017-12-19 15:04:45.264 [INFO ] [me.model.script.Sophia_Home_Distance] - Current Location: class org.eclipse.smarthome.core.library.types.PointType
2017-12-19 15:04:10.773 [INFO ] [me.model.script.Sophia_Home_Distance] - Home Location: class org.eclipse.smarthome.core.library.types.PointType
2017-12-19 15:04:10.775 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Sophia_Home_Distance': 'distanceFrom' is not a member of 'org.eclipse.smarthome.core.library.types.PointType'; line 316, column 35, length 65
Can somebody tell me why this method should not be available? Other peoples are using them as well and in the sourcecode i can see this method.
Correction: it needs an update. @patrik_gfeller are you going to do that?
Here you go:
val PointType location = iPhone_Location.state as PointType
val PointType home = new PointType(new DecimalType(48.123456), new DecimalType(11.123456))
if (location.distanceFrom(home).intValue() < 150) {
...
}
My explanation which (without checking) might be wrong: .state will return a generic type. This generic type doesn’t offer the distanceFrom function. If that is the case you can probably leave out the second “as PointType” because it’s implicit.
until today I used an older binding from iCloud. It is a fantastic binding for my presence detection, thanks a lot for that.
But today, after updating the openHAB 2.2 from snapshot to the official release, I also wanted to switch to the official icloud binding.
I noticed that some channels were missing in the offical binding to earlier one.
I am not Patrick but might be able to answer on this.
Missing channels have been removed by intention, as those reflected not binding specific functionality, especially distance from home.
We have started discussing a more global approach.