Hi ALl,
I use several local variables in some dzVent Scripts. Is it possible to change those local variables from outside the script itself?
Cheers
Peter
Change local variable from other script [Solved]
Moderator: leecollings
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Change local variable from other script
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Change local variable from other script
No.poudenes wrote: Saturday 22 June 2019 22:32 I use several local variables in some dzVent Scripts. Is it possible to change those local variables from outside the script itself?
dzVents has global_data.lua to handles these kind of requirements. You could also store your values in a domoticz uservariable or in various fields in devices. (description field in most devices, text field in text-device, etc..)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Change local variable from other script [Solved]
Yes, I used it before in uservariable. Now put those in the scripts itself. Easier to handle. (ok till now because of this question)
I will take a look to add them in global_data.
Thanks for aswering
I will take a look to add them in global_data.
Thanks for aswering
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Change local variable from other script
Solved:
Added this in global_data:
And then I can access the data in script with:
Now I can read the variables from other scripts 
Added this in global_data:
Code: Select all
data = {
LuxEvening = { initial = 0 },
LuxMorning = { initial = 0 },
HomePeter = { initial = 0 },
HomeKay = { initial = 0 },
KodiPlayVar = { initial = 0 },
KodiStopVar = { initial = 0 }
},Code: Select all
if (domoticz.globalData.KodiPlayVar == 0) then
domoticz.globalData.KodiPlayVar = 1
endRPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Who is online
Users browsing this forum: No registered users and 1 guest