Add shutdown script

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
diman27
Posts: 6
Joined: Sunday 30 August 2020 16:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Russian
Contact:

Add shutdown script

Post 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
}
diman27
Posts: 6
Joined: Sunday 30 August 2020 16:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Russian
Contact:

Re: Add shutdown script

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest