Page 1 of 1

access longitude/lttitude

Posted: Monday 07 April 2025 21:43
by manjh
In the Domoticz settings, my home longitude/lattitude values are filled in.
How can i access these settings from LUA (so nót dzvents!)?

I would like to use these values to com[are with the values as returned from my car API, so I can see if the car is actually on the driveway or not!

Re: access longitude/lttitude

Posted: Monday 07 April 2025 23:28
by waltervl
Perhaps check globalvariables table?

Re: access longitude/lttitude

Posted: Tuesday 08 April 2025 10:04
by habahabahaba
By using API request - /json.htm?type=settings ?

Re: access longitude/lttitude

Posted: Tuesday 08 April 2025 11:26
by jvdz
Just an example script that uses the url provided by habahabahaba :

Code: Select all

JSON = require 'JSON'
local url = "http://127.0.0.1:8080/json.htm?type=settings"
local handle=assert(io.popen('curl -s ' .. url))
local Dom_Data = handle:read('*all')
handle:close()
local decoded_response = JSON:decode(Dom_Data)
print(os.date("%X").." Latitude="..decoded_response["Location"]["Latitude"] .."   Longitude="..decoded_response["Location"]["Longitude"] )

Re: access longitude/lttitude

Posted: Wednesday 09 April 2025 7:46
by manjh
Thank you! That is exactly what I was looking for!!! :)

Makes me wonder, is there a list of data elements in that settings table?

Re: access longitude/lttitude

Posted: Wednesday 09 April 2025 8:26
by jvdz
Just use the link in a browser and you can see the complete Returned json and its content.

Re: access longitude/lttitude

Posted: Wednesday 09 April 2025 10:28
by manjh
jvdz wrote: Wednesday 09 April 2025 8:26 Just use the link in a browser and you can see the complete Returned json and its content.
Yes, of course. Thanks!