Page 2 of 2
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Wednesday 30 January 2019 11:55
by Freemann
In de case of the Z-wave Off command, no change.
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Wednesday 30 January 2019 21:19
by Freemann
Did some testing with the Z-Wave device and created an secundary script which triggers on the 2 UserVariable changes.
The original script to set the UserVariables send an email notification and the UserVariable change script also send a notification;

- Screenshot - 30_01_2019 , 21_15_43.png (66.24 KiB) Viewed 745 times
The On command generates an email for both the UserVar's changes, the Off command not...
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Thursday 31 January 2019 8:53
by Freemann
Here's the script I use to test the UserVariables, no rocket science.:
Code: Select all
return {
on = {
variables = {'BadkVerwarmingOffTime','BadkVerwarmingOnTime'}
},
logging = {
level = domoticz.LOG_DEBUG, -- change to LOG_ERROR after you tested the script
marker = "Return::on::variables::"
},
execute = function(dz, item, info )
local function logWrite(str,level) -- Support function for shorthand debug log statements
dz.log(tostring(str),level or dz.LOG_DEBUG)
dz.notify(tostring(str))
end
logWrite('UserVarTestScript:'..item.name..' :: changed to:'..item.value)
end
}
Here another test with the strange behaviour of the
Z-Wave device and the expected behaviour of the
"Badkamer verlichting2" dummy device;

- Screenshot - 31_01_2019 , 08_58_02.png (51.92 KiB) Viewed 738 times
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Thursday 31 January 2019 9:31
by waaren
Freemann wrote: Thursday 31 January 2019 8:53
Here's the script I use to test the UserVariables, no rocket science.:
Have to admit I am intrigued by this. Can you try and switch names of the Zwave and virtual device and check again ? This to see if the issue is caused by the name or by the different device types ?
TIA
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Thursday 31 January 2019 13:46
by Freemann
Looks like it has something to do with the lenght of the devicename;
Devicename "Badkamer verlichtin" is working is expected
Devicename "Badkamer verlichting" is not working as expected

- Screenshot - 31_01_2019 , 13_41_46.png (64.79 KiB) Viewed 730 times
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Thursday 31 January 2019 17:24
by waaren
Freemann wrote: Thursday 31 January 2019 13:46
Looks like it has something to do with the lenght of the devicename;
Devicename "Badkamer verlichtin" is working is expected
Devicename "Badkamer verlichting" is not working as expected
On my system the length of the devicename does not influence the behavior
- Spoiler: show
Code: Select all
-- isDevice check
return {
on = { devices = { "isDevice Test with quite a very long name" }}, -- 433 is sensor / isDevice Test switch
logging = {
level = domoticz.LOG_DEBUG, -- change to LOG_ERROR after you tested the script
marker = "isDevice check"
},
execute = function(dz, item, info )
local function logWrite(str,level) -- Support function for shorthand debug log statements
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local trigger = item.name
local state = item.state
if info.trigger then
trigger = info.trigger
state = "N/A"
end
logWrite("triggered by " .. trigger .. "; state: " .. state .. "; isDevice " .. tostring(item.isDevice ))
logWrite("triggered by " .. trigger .. "; state: " .. state .. "; isVariable " .. tostring(item.isVariable ))
logWrite("triggered by " .. trigger .. "; state: " .. state .. "; isScene " .. tostring(item.isScene))
logWrite("triggered by " .. trigger .. "; state: " .. state .. "; isGroup " .. tostring(item.isGroup))
logWrite("triggered by " .. trigger .. "; state: " .. state .. "; isTimer " .. tostring(item.isTimer))
logWrite("triggered by " .. trigger .. "; state: " .. state .. "; isSecurity " .. tostring(item.isSecurity))
logWrite("triggered by " .. trigger .. "; state: " .. state .. "; isHTTPResponse " .. tostring(item.isHTTPResponse))
if item.isDevice then
if item.state == "Off" then
logWrite("triggered by " .. trigger .. "; state: " .. state )
logWrite("setting uservar BadkVerwarmingOnTime to " .. os.time())
dz.variables("BadkVerwarmingOnTime").set(os.time())
else
logWrite("triggered by " .. trigger .. "; state: " .. state )
logWrite("setting uservar BadkVerwarmingOffTime to " .. os.time())
dz.variables("BadkVerwarmingOffTime").set(os.time())
end
end
end
}
Code: Select all
2019-01-31 17:15:56.622 (Virtual2) Light/Switch (isDevice Test with quite a very long name)
2019-01-31 17:15:56.866 Status: dzVents: Info: Handling events for: "isDevice Test with quite a very long name", value: "On"
2019-01-31 17:15:56.866 Status: dzVents: Info: isDevice check: ------ Start external script: dumper103.lua: Device: "isDevice Test with quite a very long name (Virtual2)", Index: 1477
2019-01-31 17:15:56.868 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On; isDevice true
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On; isVariable false
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On; isScene false
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On; isGroup false
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On; isTimer false
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On; isSecurity false
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On; isHTTPResponse false
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: On
2019-01-31 17:15:56.869 Status: dzVents: Debug: isDevice check: setting uservar BadkVerwarmingOffTime to 1548951356
2019-01-31 17:15:56.871 Status: dzVents: Info: isDevice check: ------ Finished dumper103.lua
2019-01-31 17:15:56.883 Status: Set UserVariable BadkVerwarmingOffTime = 1548951356
2019-01-31 17:16:05.613 (Virtual2) Light/Switch (isDevice Test with quite a very long name)
2019-01-31 17:16:05.843 Status: dzVents: Info: Handling events for: "isDevice Test with quite a very long name", value: "Off"
2019-01-31 17:16:05.843 Status: dzVents: Info: isDevice check: ------ Start external script: dumper103.lua: Device: "isDevice Test with quite a very long name (Virtual2)", Index: 1477
2019-01-31 17:16:05.844 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off; isDevice true
2019-01-31 17:16:05.844 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off; isVariable false
2019-01-31 17:16:05.844 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off; isScene false
2019-01-31 17:16:05.844 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off; isGroup false
2019-01-31 17:16:05.844 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off; isTimer false
2019-01-31 17:16:05.845 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off; isSecurity false
2019-01-31 17:16:05.845 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off; isHTTPResponse false
2019-01-31 17:16:05.845 Status: dzVents: Debug: isDevice check: triggered by isDevice Test with quite a very long name; state: Off
2019-01-31 17:16:05.845 Status: dzVents: Debug: isDevice check: setting uservar BadkVerwarmingOnTime to 1548951365
2019-01-31 17:16:05.846 Status: dzVents: Info: isDevice check: ------ Finished dumper103.lua
2019-01-31 17:16:05.883 Status: Set UserVariable BadkVerwarmingOnTime = 1548951365

- uservar set by isDevice test
- uservar.png (39.7 KiB) Viewed 727 times
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Thursday 31 January 2019 19:22
by Freemann
Don't known if its matter, but thats a virtual/dummy device and i'm using a Z-Wave device.
When I use a dummy device with the name "Badkamer verlichting3", then it's also working fine;

- Screenshot - 31_01_2019 , 19_22_27.png (29.35 KiB) Viewed 725 times
And the strange thing is... When I add a
* the the "on" trigger in the script; "Badkamer verlichting*" both
Z-wave "Badkamer verlichting"
and
Dummy "Badkamer verlichting3"
are working as expected...
So;
Code: Select all
return {
on = {
--timer = {"every minute"},
devices = {
--237,
"Badkamer verlichting*"
}}, -- 433 is sensor / isDevice Test switch
Results in;

- Screenshot - 31_01_2019 , 19_36_02.png (58.7 KiB) Viewed 722 times
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Thursday 07 February 2019 18:48
by Freemann
Any idea what's causing it?
Re: UserVariables not always set after Device Trigger Off[edit]
Posted: Thursday 07 February 2019 20:45
by waaren
Freemann wrote: Thursday 07 February 2019 18:48
Any idea what's causing it?
I am sorry but no. I cannot reproduce the issue even with the exact same names. Until now no other forum member reported a similar issue with zwave devices so not much to work on either. Maybe if you switch on debug mode in dzVents and log to an OS file to show all relevant lines we will see more.