Global USer Variables type

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Global USer Variables type

Post by emme »

Ciao
could it be possible to evaluate to implement new kind of user Variables?
In particular a boolean (True, False) and a json/table object type could be really helpful!

I have few script that uses tables as config paramenters, but since they are within the scripts it is quite unconfortable to edit the script to fine tune parameters

I was looking for a different approach and user variables are the best way, but I have to set them up as strings and then convert into the script....

I would be nice to have them already in this way... unfortunately also a JSON viewer/editor/validator should be implemented

ciao
M
The most dangerous phrase in any language is:
"We always done this way"
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Global USer Variables type

Post by dannybloe »

I know you use dzVents so why not use the gui editor and create a dzvents script (module) with all the values and require that data inside your script?

In a script 'my-config':

Code: Select all

return {
	setting1 = 10, 
	setting2 = 20
}
In a dzVents script:

Code: Select all

return {
	..
	execute = function(dz, item)
		local config = require('my-config.lua')
		print(config.setting1)
	end
}
or something like that. You can do all of this in domoticz gui.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Global USer Variables type

Post by emme »

This is EXACTLY what I was looking for :D :D

Thanks so much!!
The most dangerous phrase in any language is:
"We always done this way"
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Global USer Variables type

Post by dannybloe »

Or better: add some config to global_data.helpers and you don’t have to use require at all. See the docs.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest