I travel Australia fulltime in a RV/Caravan. As a result my longitude and latitude changes frequently. In the caravan i have a pi 3 B+ with Hassio on it. Rather than manually changing my longitude and latitude readings in config.yaml each time i move from one destination to the next i was wondering if it can be auto updated by using the location of my PI, or router, or something else thats physically in the caravan ?
PS: i’m still a noob so not fully up to speed on the lingo yet but happy to research if you can point me in the right direction please
I don’t think so. As far as I am aware the Lat & Lon are set at startup, either from the supplied config or by IP Geolocation if a config is not defined.
It’s an interesting use case and warrants an enhancement request. There is at least one other user (who’s setup is on a yacht) that would benefit for this.
FWIW, 0.94 is supposed to have some new UI configuration options, including location, so the idea is definitely that these things can change “on the fly.” See this twitter from balloob. If you look closely, you can see that the location settings are in this new UI, and that there’s a DETECT button that will get the info from the Internet (as @tom_l mentioned.) So when you move, maybe all you’ll need to do is to go to this page and click DETECT.
I don’t think much of internet detection of location. Auto detection on my system puts me at my isp’s head office hundreds of miles away.
My solution would be to get a usb gps unit. Have a script that gets GPS location and if it has changed, write the new location to configuration.yaml and restart ha.
I’d be very interested in this as well. I’m a live-aboard sailor and being able to update my location automatically would be fantastic. I have gpsd reading data from my onboard GPS devices, so getting the current location is very easy.
Just adding this as a “me too” with real-world interest.
@Knobee can you share the GPS unit you are using? Was looking at using home assistant for a side project and can’t find much info on a GPS unit that would work.
You would use the service homeassistant.set_location which takes lat/long as parameters.
I am unsure whether this requires a restart.
Also you wouldn’t always want to change the location with every small change in lat/long. Perhaps an automation that runs periodically and checks whether you have moved more than, say 20k, it runs the service and (if needed) restarts ha.
Has anyone tried this? I have an RV and have got to the point that I have entities for LON and LAT now, looking for a way to update my Zone for the RV pi HASSIO. I have a second pi that is using an USB GPS unit.
Now you don’t have to change the configuration.yaml file. There is the homeassistant.set_location service which takes latitude and longitude as parameters
Thanks everyone above! This topic helped me a lot in figuring out how to get things working. I put together a guide for anyone using a USB dongle with Victron systems that may be useful for anyone else visiting this forum topic in future. There were quite a lot of gaps in my knowledge so it took me way longer to figure everything out.