I used 'gpsd' running on linux, along with node-red (with the node-red-contrib-gpsd
node to make a GPS to MQTT bridge.
[{"id":"b4379a23.82767","type":"gpsd","z":"8b68a913.550af","name":"","hostname":"localhost","port":"2947","tpv":true,"sky":false,"info":false,"device":false,"gst":false,"att":false,"x":170,"y":140,"wires":[["c728e491.f15918"]]},{"id":"c381f35a.3cd8d","type":"debug","z":"8b68a913.550af","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":470,"y":140,"wires":[]},{"id":"a41acb7e.7d2798","type":"mqtt out","z":"8b68a913.550af","name":"","topic":"gps/tpv","qos":"2","retain":"true","broker":"1767f3ec.d1e33c","x":480,"y":180,"wires":[]},{"id":"c728e491.f15918","type":"function","z":"8b68a913.550af","name":"","func":"var lock = [ \"n/a\", \"No Fix\", \"2D Fix\", \"3D Fix\"];\n\nmsg.payload.speed *= 2.23694;\nmsg.payload.lock = lock[msg.payload.mode];\nmsg.payload.latitude = msg.payload.lat;\nmsg.payload.longitude = msg.payload.lon;\ndelete msg.payload.lon;\ndelete msg.payload.lat;\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":140,"wires":[["a41acb7e.7d2798","c381f35a.3cd8d"]]},{"id":"1767f3ec.d1e33c","type":"mqtt-broker","z":"","name":"prime.rv","broker":"172.16.22.2","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"gateway/availability","birthQos":"2","birthRetain":"true","birthPayload":"online","closeTopic":"gateway/availability","closeQos":"2","closeRetain":"true","closePayload":"offline","willTopic":"gateway/availability","willQos":"2","willRetain":"true","willPayload":"offline"}]
sensor:
- platform: mqtt
name: GPS
expire_after: 10
state_topic: "gps/tpv"
value_template: "{{ value_json.lock }}"
json_attributes_topic: "gps/tpv"
icon: "mdi:crosshairs-gps"
availability_topic: "gateway/availability"
payload_available: online
payload_not_available: offline
alias: 'Helper: Move Home'
description: ''
trigger:
- platform: template
value_template: '{{ is_state("sensor.gps", "3D Fix") and distance( "sensor.gps",
"zone.home" ) | float > 1 }}'
condition:
- condition: template
value_template: '{{ state_attr("sensor.gps","speed") | float < 5 }}'
action:
- data_template:
message: RV to Home distance of {{ distance( "sensor.gps", "zone.home" ) | round(2)
}} miles, changing Home location.
notification_id: movedhome
title: Moved Home
service: persistent_notification.create
- data_template:
latitude: '{{ state_attr("sensor.gps","latitude") }}'
longitude: '{{ state_attr("sensor.gps","longitude") }}'
service: homeassistant.set_location
- data: {}
service: homeassistant.reload_core_config
Hope this helps!
After you call the homeassistant.set_location and the homeassistant.reload_core_config services, does your home assistant timezone {{ now().tzinfo }} update based on the new location?
My location gets updated and verified on the HA -> Configuration -> General page which shows a map of my updated location, but the HA timezone (as shown on the same page) remains unchanged. The timezone if not specified in the configuration.yaml, so I would expect it to be updated based on the new location. Restarting HA has not effect. Thanks