access longitude/lttitude

Moderator: leecollings

Post Reply
manjh
Posts: 748
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

access longitude/lttitude

Post 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!
Hans
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: access longitude/lttitude

Post by waltervl »

Perhaps check globalvariables table?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
habahabahaba
Posts: 233
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: access longitude/lttitude

Post by habahabahaba »

By using API request - /json.htm?type=settings ?
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: access longitude/lttitude

Post 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"] )
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
manjh
Posts: 748
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: access longitude/lttitude

Post 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?
Hans
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: access longitude/lttitude

Post by jvdz »

Just use the link in a browser and you can see the complete Returned json and its content.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
manjh
Posts: 748
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: access longitude/lttitude

Post 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!
Hans
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest