I have installed iCloud binding to monitor location of my devices. Since a few days I get the following error when I apply my rule to convert the location to the address:
Can you help me on that one?
This is my current rule:
rule "Distance from home"
when
Item iPhone_Location changed
then
Home_Location.state = new PointType(new DecimalType(50), new DecimalType(4))
Distance_From_Home_iPhone.postUpdate(Home_Location.distanceFrom(iPhone_Location) as Number)
val _url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + iPhone_Location.state + "&key=some_key"
val _geocodeJSON = sendHttpGetRequest(_url)
val _address = transform("JSONPATH", "$.results[0].formatted_address", _geocodeJSON)
iPhone_Location_Address.postUpdate(_address)
Found it my self, rule needs to be changed as follows:
rule "Distance from home”
when Item iPhone_Location changed
then
Home_Location.state = new PointType(new DecimalType(50), new DecimalType(4))
Distance_From_Home_iPhone.postUpdate(Home_Location.distanceFrom(iPhone_Location) as Number)
val tmp_loc = new PointType(new DecimalType(iPhone_Location.state.toString.split(",").get(0)), new DecimalType(iPhone_Location.state.toString.split(",").get(1)))
val _url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + tmp_loc.toString() + "&key=some_key"
val _geocodeJSON = sendHttpGetRequest(_url)
val _address = transform("JSONPATH", "$.results[0].formatted_address", _geocodeJSON) iPhone_Location_Address.postUpdate(_address)
end
Hi @martinvw
could you please share an information why the altitude was added?
The value is always zero and doesn´t change at all…
The PR only mentions the lowbattery channel and some french descriptions but not a change at the location.
Do we really need an altitude when the value is empty and is it possible to remove this value?
I just noticed that iCloud API made this information available, and as LocationType is able to handle it, I did add it.
Given that it can only be removed in a next stable revision (or in the snapshot but it was added there already on the 11th of november) I don’t think it makes any sense to remove it, because by then all people will have updated there rules. And given its returned in the response it might contain valid / relevant details for some users or in the near future.