I use this script for my 86 years old grandfather to manage his lights (cant hardly walk)
i made a dummy selector switch(alarm clock) with options
0 = 'uit'
10 = '10:30'
20 = '10:35'
When i select the RED button from the dummy switch i like this switch to show option 0 = uit.
Current situation is that when you push the button, not selecting a value 10 or 20), the button switches the device off but still shows the previous value. Sort of a bug i think...
My grandfather does not understands that and thinks it is still on ...
So i like the selector switch shows 'uit' when pushing the device button from te selector switch
my code does not seems to work at this point.
The timer works great by the way....
Code: Select all
-- timers mogen niet op t exacte moment draaien, dus 5mn verschil
--
local timer_on1 = 'at 10:30'
local timer_on2 = 'at 10:35'
return {
on = { timer = {timer_on1,timer_on2},
devices = {'Alarm clock'},
},
logging = {
level = domoticz.LOG_ERROR ,
},
execute = function(dz,item,info)
_G.logMarker = _G.moduleLabel
local now = os.time(os.date('*t'))
local messageTable = {}
local schakeltime = 'at ' .. dz.devices('Alarm clock').state
if (
(item.isDevice and item.Name == 'Alarm clock')
) then
if item.state == 'Off' then -- als je m uit zet, dan staat de waarde mogelijk nog op een tijd
dz.devices('Alarm clock').switchSelector('uit') --- DIT WERKT NIET
end
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SCHAKELKLOK: aanpassing gedaan op de schakelklok... ')
elseif (item.isTimer) and schakeltime == item.trigger then
--dz.devices('Sfeerverlichting').switchOn()
dz.devices('test').switchOn()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SCHAKELKLOK: schakelklok wordt ingeschakeld ... ')
else
-- doe niets
end
dz.helpers.globalMessage2(dz,item,info,messageTable,'chg') -- dump
end
}