Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
Moderators: leecollings, remb0
-
- Posts: 46
- Joined: Thursday 19 January 2017 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
It is very important and usefull function. It was in oldest version and I don't know why now is not.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
Could you check the result of this dzVents script ?
Is this the Global Table you want ? If not can you please elaborate a bit more on what exactly you are looking for ?
Is this the Global Table you want ? If not can you please elaborate a bit more on what exactly you are looking for ?
- Spoiler: show
Last edited by waaren on Thursday 17 May 2018 23:55, edited 1 time in total.
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
-
- Posts: 46
- Joined: Thursday 19 January 2017 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
I'm sorry but I don't use dzVent script.
My problem is:
1. My harware invoke scripts (http) like: <domoticz_IP>/json.htm?type=command¶m=udevices&script=d10.lua&s=1, with 5s interval.
2. Domoticz use d10.lua file (from LUA_parsers directory) to execute script (to read variable s as 1 and save to domoticz by domoticz_updateDevice procedure)
but before domoticz_updateDevice, script checked actual state of sensors and make domoticz_updateDevice only when the state was different.
Now, global tables like otherdevice_svalue are empty. The examples from wiki (LUA Parsers examples) not working too.
DzVent can catch the domoticz_updateDevice procedure and check the actual status before make changes in domoticz databases ?
My problem is:
1. My harware invoke scripts (http) like: <domoticz_IP>/json.htm?type=command¶m=udevices&script=d10.lua&s=1, with 5s interval.
2. Domoticz use d10.lua file (from LUA_parsers directory) to execute script (to read variable s as 1 and save to domoticz by domoticz_updateDevice procedure)
but before domoticz_updateDevice, script checked actual state of sensors and make domoticz_updateDevice only when the state was different.
Now, global tables like otherdevice_svalue are empty. The examples from wiki (LUA Parsers examples) not working too.
DzVent can catch the domoticz_updateDevice procedure and check the actual status before make changes in domoticz databases ?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
@boe666
my approach would be to change the json to send the your sensor data to User variable in Domoticz (User variables do not store history in database)
Code: Select all
http://192.xxx.xxx.xxx:yyyy/json.htm?type=command¶m=updateuservariable&vname=tempParse&vtype=2&vvalue=12.65
- Spoiler: show
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
-
- Posts: 46
- Joined: Thursday 19 January 2017 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
how i can define uservariables ?
Where can I find some examples of this dzVent triggers ?
Where can I find some examples of this dzVent triggers ?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
If you press the show button after the word spoiler in my previous post you will see a dzVents script that will execute every time the user variable is updated.
You can read everything needed on dzVents in the wiki
For uservariables please have a look here
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
-
- Posts: 46
- Joined: Thursday 19 January 2017 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
I write some code in my script:
commandArray = {}
print ("Write to test1");
local alarm_ruch = uri['a'];
print ("Variable val:");print(alarm_ruch);
commandArray['Variable:test1'] = tostring(alarm_ruch);
print ("End Writing");
but value of my variable (defined in domoticz in uservariable section) has no change.
i think lua_parsers script has no access to commandArray table.....
How can I send this value to the uservariable with json method ?
I use json.htm?type=command¶m=udevices&script=d10.lua&s=1&a=5&f=5... because i can send many variables in one pass, and my harware (http gateway) has limit of char in url (255 chars).
commandArray = {}
print ("Write to test1");
local alarm_ruch = uri['a'];
print ("Variable val:");print(alarm_ruch);
commandArray['Variable:test1'] = tostring(alarm_ruch);
print ("End Writing");
but value of my variable (defined in domoticz in uservariable section) has no change.
i think lua_parsers script has no access to commandArray table.....
How can I send this value to the uservariable with json method ?
I use json.htm?type=command¶m=udevices&script=d10.lua&s=1&a=5&f=5... because i can send many variables in one pass, and my harware (http gateway) has limit of char in url (255 chars).
-
- Posts: 46
- Joined: Thursday 19 January 2017 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
Any body know WHY access to global tables and global variables is disables in LUA_Parsers script ????
-
- Posts: 46
- Joined: Thursday 19 January 2017 16:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Access to Global Tables (ie. otherdevice_svalue) in LUA_Parsers scripts.
OK, it was my mistake.... I'm sorry for my indolence...
my scripts has no access to global tables becouse i don't turn on this function....
my scripts has no access to global tables becouse i don't turn on this function....
Who is online
Users browsing this forum: No registered users and 1 guest