Hi again, another update. I’m trying to use the following to automatically set latitude and longitude values but when i’m testing it in the developer " services" screen i get a error " invalid latitude for dictionary value @ data[‘latitude’] "
The JSON data i’m using is
{
“latitude”: " {{ states.device_tracker.life360_caravan.attributes.latitude }}" ,
“longitude”: " {{ states.device_tracker.life360_caravan.attributes.longitude }}"
}
Am i on the right track here or am i just making bad guesses ? and any help on the error please
…but it seems redundant since your lat/lon source appears to be a device_tracker that’s already integrated into HA (should already update your location automatically).
I also have Home Assistant installed in my RV. I’m using the homeassistant.set_location to set my location based on GPS coordinates. That works as expected and the map on the Configuration->General page updates accordingly.
But the HA timezone does not update based on the new location. I have no time zone specified in the configuration.yaml so that HA would automatically computed the time zone based on my location. I have tried calling homeassistant.reload_core_config hoping this would update the time zone based on the new location, but no luck. I also don’t see a service that I can call to specify a new time zone.
Is there a way to update the time zone within an automation?
I got sick of using my phone GPS to trigger the home location of my caravan so i recently got a USB GPS receiver which i plugged into a different Raspberry Pi to what my Home assistant is running.
I couldn’t get the HA GPSD intergration to work so took a detour to that approach.
From the GPS RPI i then had to send that data to the HA RPI. I did that by installing gpsd on the GPS pi and then wrote the following python code which takes the gpsd data from one pi and sends it via MQTT to Home Assistant on the config / state and attributes topics.
The code i wrote can be found on my Github page if it’s of interest to anyone.
Details on usage are in the docstring (top of the file) outlining the basics of how to get it going. However the general idea is to download the gpsdata.py file to the RPI that has the GPS receiver on it.
On that RPi install…
sudo apt-get update
then
sudo apt install gpsd
and
sudo apt install gpsdclient
Then follow the info in the code such as setting mqtt username and password etc.
Edit your configuration.yaml as per instructions in file
create a automation in HA as per instructions in file
create a cron task as per instructions in file
All going well HA should now see your new device tracker and auto update the home location accordingly.
Hope that helps anyone that got stuck with using the GPSD integration on HA or is running the gps from a different device.
Perhaps a bit late for those who had asked installing gpsd (and GPS receiver) on the same RPi as HA. Yes you can do this. I’ve had this running for a few years.