Page 1 of 1

Getting setting info to script

Posted: Saturday 03 May 2025 20:31
by madpatrick
Hi,

I like to read out the LAT and LAT from the settings menu in to a Dzvents script
Is this possible and how can i do this ?

Code: Select all

local lat = tostring(domoticz.settings.latitude)
local lon = tostring(domoticz.settings.longitude)
SOemthing like this, but that doesn't work

Re: Getting setting info to script

Posted: Saturday 03 May 2025 22:43
by jvdz
According the docs in the Wiki: domoticz.settings.location.latitude

Re: Getting setting info to script

Posted: Sunday 04 May 2025 9:32
by madpatrick
Thanks. I must have overlooked that one

Re: Getting setting info to script

Posted: Sunday 17 August 2025 15:44
by Barberousse
Hello,

domoticz.log(tostring(domoticz.settings.location.latitude)) and domoticz.log(tostring(domoticz.settings.location.longitude)) send back "0" instead of configured values in Domoticz (Domoticz 2025.1, french locale, same if I switch to English), anyone seeing this too?

Thank you.

Re: Getting setting info to script

Posted: Saturday 23 August 2025 8:18
by gizmocuz
I created a dzVents script based on a dummy switch, when pressed it will log the latitude:

Code: Select all

return {
	on = {
		devices = {
			'MyDummy'
		}
	},
	logging = {
		level = domoticz.LOG_DEBUG,
		marker = 'test_template',
	},
	execute = function(domoticz, device)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
		domoticz.log('latitude:  ' .. domoticz.settings.location.longitude, domoticz.LOG_INFO)
	end
}
The script output is:

Code: Select all

2025-08-23 08:17:36.520  dzVents: test_template: ------ Start internal script: Script #1: Device: "MyDummy (Dummy)", Index: 10640
2025-08-23 08:17:36.520  dzVents: test_template: Device MyDummy was changed
2025-08-23 08:17:36.521  dzVents: test_template: latitude:  5.1368
2025-08-23 08:17:36.521  dzVents: test_template: ------ Finished Script #1