Page 1 of 1

How to override a scene timer?

Posted: Tuesday 16 June 2020 23:06
by JeroenG
I have a scene which switches off all the lights around 23:30 (working fine).

But sometimes I want to stay watching a movie or and prevent the lights from switching off. I made a dummy switch to override the automatic execution of the scene, but my script is not working, it fails on the if statement but I don't see the error :( .

Code: Select all

return {
	on = {
		scenes = {
			'Test scene'
		}
    },
    execute = function(domoticz, scene)
	if domoticz.device.('Niet naar bed').status == 'Off'
	then
		domoticz.log('Scene ' .. scene.name .. ' was switched off', domoticz.LOG_INFO)
	else
	 	domoticz.log('Scene ' .. scene.name .. ' was blocked', domoticz.LOG_INFO)
	
	end
}
Thanks a lot!

Jeroen

Re: How to override a scene timer?

Posted: Tuesday 16 June 2020 23:34
by Treve
I have the same condition now working for a few years and solved it with a simple blockly.

-Make a dummy switch ‘override’
-Make a device ping (ping the television)
-Make a if-then blockly

This will only work of course if the television has a Ethernet connection.

Re: How to override a scene timer?

Posted: Tuesday 16 June 2020 23:50
by waaren
JeroenG wrote: Tuesday 16 June 2020 23:06 I have a scene which switches off all the lights around 23:30 (working fine).

But sometimes I want to stay watching a movie or and prevent the lights from switching off. I made a dummy switch to override the automatic execution of the scene, but my script is not working, it fails on the if statement but I don't see the error :( .
To correct the syntax you can do like below. But it will not block the automatic switch of the scene. I don't know of a way to block a timer with a script.

Code: Select all

return
{
    on =
    {
        scenes =
        {
            'Test scene',
        },
    },

    execute = function(domoticz, scene)
        if domoticz.device.('Niet naar bed').status == 'Off' then
            domoticz.log('Scene ' .. scene.name .. ' was switched off', domoticz.LOG_INFO)
        else
            domoticz.log('Scene ' .. scene.name .. ' was blocked', domoticz.LOG_INFO)
        end
    end
}

Re: How to override a scene timer?

Posted: Saturday 20 June 2020 16:57
by MartinManders
Hey,

Maybe the best solution is to make the timer part of your script?

If triggered by timer AND not ‘Niet naar bed’ then Switch off, else do nothing....