Dynamically update Domoticz' location from GPS

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Lomax
Posts: 32
Joined: Monday 18 May 2015 17:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Dynamically update Domoticz' location from GPS

Post by Lomax »

My use-case is a little different to the typical Domoticz installation, because I'm running it on a houseboat! It would be really nice if there was a way to update the Domoticz lat/lng setting from my GPS receiver, and to log these changes in the Domoticz database (for future reference). This should make it possible to automatically get weather reports for my actual location etc, and perhaps do nifty things with the historical data later. Sound feasible?
bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sorø, DK
Contact:

Re: Dynamically update Domoticz' location from GPS

Post by bjacobse »

Maybe if the latitude/longitude is stored in domoticz.db then make a script with the following pseudo code that could run every hour:

Read current GPS coordinates from GPS receiver
read gps_file.txt file containing last GPS coordinates
if current GPS == last GPS then quit
else:
stop Domoticz
backup domoticz.db to new backup name increment with 1 in filename
insert current GPS coordinate into domotcz.db (example something like this: sqlite> INSERT OR REPLACE INTO Cars VALUES(4, 'Volvo', 29000);)
Write current GPS coord into gps_file.txt
start Domoticz
exit script
Lomax
Posts: 32
Joined: Monday 18 May 2015 17:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: Dynamically update Domoticz' location from GPS

Post by Lomax »

bjacobse wrote:Maybe if the latitude/longitude is stored in domoticz.db then make a script with the following pseudo code that could run every hour
Many thanks, that sounds like a viable approach. Since I've already started getting into how the Domoticz scripting engine works I might give it a go. Thinking about it though, maybe it's better to have a "virtual sensor" which stores the lat/lng values, and update the Domoticz setting from this. That way I would automagically get historical data, while the actual setting could be updated at a much slower rate (say once per hour). I just need to figure out how to have a sensor that accepts multiple values. Maybe later this can be used to put a map on the dashboard!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest