Page 1 of 1

Scene active/inactiv switch

Posted: Sunday 18 May 2025 18:36
by swen
hi,
I would like to be able to switch a scene between active and inactive with a dummy switch.
I have tested this with this dzVents script:

Code: Select all

--Dummy Switch: 'Beschattung Automatik'  Idx: 4269
--Scene       : 'TestSzene'              Idx:   22

local dz        = domoticz

return {
    logging = {
        level = domoticz.LOG_INFO,
        marker = '-----'
    },

    on = {
        devices = { 'Beschattung Automatik' }
    },

   	execute = function(dz, switch)
        if (dz.devices(4269).active) then     
            dz.scenes('TestSzene').active = true
            dz.log('scene true')
        else
            dz.scenes('TestSzene').active = false
            dz.log('scene false')
        end
    end
}
But it doesn't work, the scene is always active.
The dummy switch works correct. I can see this in the log.

Does anyone know a solution?

Re: Scene active/inactiv switch

Posted: Sunday 18 May 2025 18:47
by jvdz
I haven't tested it but think it should be something like this:

Code: Select all

--Dummy Switch: 'Beschattung Automatik'  Idx: 4269
--Scene       : 'TestSzene'              Idx:   22

local dz        = domoticz

return {
    logging = {
        level = domoticz.LOG_INFO,
        marker = '-----'
    },

    on = {
        devices = { 'Beschattung Automatik' }
    },

   	execute = function(dz, switch)
        if (switch.state == 'On') then
            dz.scenes('TestSzene').switchOn()
            dz.log('scene true')
        else
            dz.scenes('TestSzene').switchOff()
            dz.log('scene false')
        end
    end
}

Re: Scene active/inactiv switch

Posted: Sunday 18 May 2025 18:58
by swen
Hi,
I've already tested it. Also after

Code: Select all

dz.scenes('TestScene').switchOff()
the timer triggers the scene.
But that's exactly what I want to prevent.

Re: Scene active/inactiv switch

Posted: Sunday 18 May 2025 19:08
by waltervl
You cannot inactivate a scene. It can only be activated (switched on). A group can be switched on/off.
https://wiki.domoticz.com/Managing_Devi ... or_Groups)

Re: Scene active/inactiv switch

Posted: Sunday 18 May 2025 21:55
by swen
Hi, thanks for the info.
I did some more tests and found no other solution.
groups are also unsuitable.
So I will program my five scenes and their timers in dzVenzts.

Thanks and bye