Device stays On after 1 minute  [Solved]

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

Moderator: leecollings

Post Reply
kroonp
Posts: 43
Joined: Friday 17 July 2020 11:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Device stays On after 1 minute

Post by kroonp »

When my PIR is active I want to turn on 2 lights for 1 minute.
Im my script with only Bijkeuken it works.
If I add the Bollamp that I want to color red, the Bollamp stays on. Is there another way to do this?
Thanks,
Peter

Code: Select all

return {
    on = {
        devices = {
            'PIR 1 buiten'
        }
    },
    execute = function(domoticz, device)
     
        myHue = domoticz.devices('Bollamp')
        if(device.active) then
            

            if(domoticz.devices('Schemer').state == 'On' and domoticz.devices('Thuis').state == 'On')  then
                domoticz.devices('Bijkeuken').switchOn().forMin(1)
                myHue.setRGB(255, 0, 0).switchOn().forMin(1)
                 
            end
           
        end
    end
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Device stays On after 1 minute  [Solved]

Post by waaren »

kroonp wrote: Wednesday 12 August 2020 23:27 When my PIR is active I want to turn on 2 lights for 1 minute.
Can you try this ?

Code: Select all

return {
    on = {
        devices = {
            'PIR 1 buiten'
        }
    },
    execute = function(domoticz, device)

        myHue = domoticz.devices('Bollamp')
        if(device.active) then


            if(domoticz.devices('Schemer').state == 'On' and domoticz.devices('Thuis').state == 'On')  then
                domoticz.devices('Bijkeuken').switchOn().forMin(1)
                myHue.setRGB(255, 0, 0)
                myHue.switchOff().afterSec(60)

            end

        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
kroonp
Posts: 43
Joined: Friday 17 July 2020 11:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Device stays On after 1 minute

Post by kroonp »

I tryed en YES it works.
Thank You
Peter
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest