Code: Select all
['timer'] = { 'at ' .. domoticz.devices("selectorSwitch").levelName }
Moderator: leecollings
Code: Select all
['timer'] = { 'at ' .. domoticz.devices("selectorSwitch").levelName }
It can be emulated with below example
Code: Select all
local scriptVar = 'selector controlled'
local selector = 'selectorSwitch'
return
{
on =
{
timer =
{
'at 00:01',
},
devices =
{
selector,
},
customEvents =
{
scriptVar,
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = scriptVar,
},
execute = function(dz, item)
local selector = dz.devices(selector)
if item.isTimer or item.isDevice then
local setTime = selector.levelName
dz.log('Emit event at '.. setTime, dz.LOG_DEBUG)
dz.emitEvent(scriptVar, selector.levelName).at(setTime)
elseif item.isCustomEvent and item.data == selector.levelName then
selector.switchSelector(0).silent() -- EDIT changed to the more appropriate switchSelector ( was dimTo() )
dz.log('-- rest of script', dz.LOG_DEBUG) -- rest of script behind this line
else
dz.log('No action needed now', dz.LOG_DEBUG)
end
end
}
Code: Select all
2020-12-21 11:57:18.831 Error: dzVents: Error: (3.0.19) selector controlled: An error occurred when calling event handler zzz
2020-12-21 11:57:18.831 Error: dzVents: Error: (3.0.19) selector controlled: /home/pi/domoticz/dzVents/runtime/Utils.lua:151: attempt to perform arithmetic on a nil value (local 'hours')
There is no cancel EmitEvent possible and there can be multiple emitEvents active.EddyG wrote: Monday 21 December 2020 22:45 Is there also a cancelemitEvent, or is there just 1 emitEvent active?
I don't know if implementing cancelEmitEvent() is possible / easy (@MrHobbes74 ?) but the script(s) dealing with the customEvents at hand could check the conditions leading to a situation that the customEvent should no longer perform any follow up action.EddyG wrote: Wednesday 23 December 2020 10:07 Would not it be nice to have a cancelEmitEvent function too?
Are they kept in memory or saved in the database? If so where?
P.S. the dimTo should be switchSelector, I think.
that should not happen as the script checks if the time of the selectorLevel == item.data of the customEventEddyG wrote: Wednesday 23 December 2020 11:47 My problem is that when a emitevent cannot be canceled, a click on 07:00 and subsequent click on 07:30 the lights still go on at 07:00 and again at 07:30
Code: Select all
elseif item.isCustomEvent and item.data == selector.levelName then
NoIs there an enum of all outstanding emitevents?
Users browsing this forum: No registered users and 1 guest