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
Global USer Variables type
Moderators: leecollings, remb0
- 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
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Global USer Variables type
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':
In a dzVents script:
or something like that. You can do all of this in domoticz gui.
In a script 'my-config':
Code: Select all
return {
setting1 = 10,
setting2 = 20
}
Code: Select all
return {
..
execute = function(dz, item)
local config = require('my-config.lua')
print(config.setting1)
end
}
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
- 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
This is EXACTLY what I was looking for
Thanks so much!!


Thanks so much!!
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Global USer Variables type
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.
Who is online
Users browsing this forum: No registered users and 1 guest