Selector: issue with off mode  [Solved]

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

Moderator: leecollings

Post Reply
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Selector: issue with off mode

Post by Number8 »

Hello
Say Level 2 is selected (hence the bulb is on). Then click on the bulb: it switches to Off but selector Level 2 remains selected instead of being set to Off (see attachment) which seems to me what one could expect. Any thoughts?
Selecteur.png
Selecteur.png (51.45 KiB) Viewed 738 times
Running 2020.2 12485
Thank you
Debian buster on NUC and three RPi with buster.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Selector: issue with off mode

Post by waaren »

Number8 wrote: Tuesday 11 May 2021 0:14 Hello
Say Level 2 is selected (hence the bulb is on). Then click on the bulb: it switches to Off but selector Level 2 remains selected instead of being set to Off) which seems to me what one could expect. Any thoughts?
This is by design. Check this topic
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Selector: issue with off mode

Post by Number8 »

Thanks @waaren. OK I got it, but what I want is to get the selection action attached to level 0 executed. When .silent() is removed an infinite loop is created. How to get it executed only once?
Debian buster on NUC and three RPi with buster.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Selector: issue with off mode  [Solved]

Post by waaren »

Number8 wrote: Tuesday 11 May 2021 7:36 Thanks @waaren. OK I got it, but what I want is to get the selection action attached to level 0 executed. When .silent() is removed an infinite loop is created. How to get it executed only once?
Use something like below

Code: Select all

return
{
    on =
    {
        devices =
        {
            'mySelector'
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG ,
        marker = 'selector',
    },

    execute = function(dz, item)
        if item.nValue == 0 and item.level ~= 0 then
           item.switchSelector('Off')
           dz.log('Action required (nValue == 0 and level left at '.. item.level ..')' ,dz.LOG_DEBUG)
        elseif item.nValue == 0 then
             dz.log('No action required (nValue and level both 0)' ,dz.LOG_DEBUG)
        else
            dz.log('No action required (nValue ~= 0) ',dz.LOG_DEBUG)
        end

    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Selector: issue with off mode

Post by Number8 »

Thank you
Debian buster on NUC and three RPi with buster.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest