I have Hubitat in my RV which has a Cradlepoint router that provides a live GPS location streamed to a port on the lan. I was able to write a driver to read that GPS coordinates and I can compare it to the Hub location to see if they're different now I just need help trying to update the Hub location from this driver. I've tried location.setLatitude/setLongitude but that doesn't seem to do anything.
def generateEvents(Map results) {
def hubLat = location.getLatitude()
def hubLon = location.getLongitude()
double wiggle = distanceInMeters(results["Latitude"].doubleValue(), hubLat, results["Longitude"].doubleValue(), hubLon, 0, 0)
if (wiggle > 15) {
log.debug "Parsed: ${results}"
log.debug "Wiggle: ${wiggle}"
results.each { name, value ->
if (state[name] != value) {
state[name] = value
sendEvent(name: name, value: value)
log.debug "Value Updated: ${name}:${value}"
}
}
log.debug "Old Hub Lat: ${hubLat}"
log.debug "Old Hub Lon: ${hubLon}"
location.setLatitude(results["Latitude"].doubleValue())
location.setLongitude(results["Longitude"].doubleValue())
log.debug "Hub Location Updated!"
}
return null
}