How to override a scene timer?

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

Moderator: leecollings

Post Reply
JeroenG
Posts: 27
Joined: Monday 06 January 2020 20:57
Target OS: Raspberry Pi / ODroid
Domoticz version: 20231
Contact:

How to override a scene timer?

Post 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
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: How to override a scene timer?

Post 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.
- RFXtrx433E,
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.

for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: How to override a scene timer?

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
MartinManders
Posts: 23
Joined: Tuesday 24 July 2018 9:23
Target OS: Linux
Domoticz version: 2023.2
Location: Netherlands

Re: How to override a scene timer?

Post 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....
- Reliability means:
never have to say i am sorry -
Rpi's 3B 1x RFX com + 20 dev 1x ZWave + 130 dev + rpi 4 remote
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest