Page 1 of 1

Device stays On after 1 minute

Posted: Wednesday 12 August 2020 23:27
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
}

Re: Device stays On after 1 minute  [Solved]

Posted: Thursday 13 August 2020 0:27
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
}

Re: Device stays On after 1 minute

Posted: Thursday 13 August 2020 0:49
by kroonp
I tryed en YES it works.
Thank You
Peter