Getting setting info to script

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Getting setting info to script

Post 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
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Getting setting info to script

Post by jvdz »

According the docs in the Wiki: domoticz.settings.location.latitude
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Getting setting info to script

Post by madpatrick »

Thanks. I must have overlooked that one
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
Barberousse
Posts: 141
Joined: Wednesday 02 December 2015 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Getting setting info to script

Post 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.
User avatar
gizmocuz
Posts: 2707
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Getting setting info to script

Post 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
Quality outlives Quantity!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest