Page 1 of 1

Add shutdown script

Posted: Sunday 20 September 2020 16:43
by diman27
Hello to all. Who will help the script to finalize so that the light would burn for 20 minutes and when the light is turned off in some way, I have 3 of them (xiaomi wireless off, button, Yandex Alice) - the sensor would no longer work until the next time zone

Code: Select all

return {
    active = true,
    on = {
        devices = {
              'hall sensor'
        }
    },
    logging = {
        level = domoticz.LOG_ERROR
    },
    execute = function(domoticz, device)
       
         local Light = domoticz.devices('hall 1', 'hall 2', 'hall 3')
         local t     = domoticz.time
     
        if (device.state == 'On') then
               if (Light.state == 'Off') then
                    if (t.matchesRule('at 19:00-08:00')) then 
                        Light.dimTo(100)
                        domoticz.log('step in the hall - Свет 100%')
                    end
               end
        else
            if (Light.state ~= 'Off') then
                Light.switchOff()
            end
        end     
    end
}

Re: Add shutdown script

Posted: Tuesday 22 September 2020 1:45
by diman27
Are there really no specialists who can solve this problem? Fix that the light is turned off earlier than by the sensor and do not turn it on by the sensor until the next day.