Page 1 of 1

[solved] MOES Scene Remote switches light off after several seconds - little help needed

Posted: Sunday 23 May 2021 16:49
by Sjonnie2017
I have a MOES Scene Remote with 4 buttons that all have three modes: short press, double press and long press. I am trying to assign each button mode to "toggle" a light. Unfortunately the remote sends an "Off" command after a few seconds and as a result the light/device switches off. So I am looking for a method where the device/light acts on the press of a button but ignores the automated power off of the remote.

I have created a dzVents script that successfully turns on the light and switches the light off if I press the button for the second time before the automated trigger steps in.

How do I prevent the light(s) from acting on the automated power off?

The (almost) working script:

Code: Select all

--Control several lights using MOES Scene Remote 

return
{

    on =
    {
        devices =
        {
            'Scene Remote',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Scene Remote',
    },

    execute = function(dz, item)
        if item.state == 'B1' and dz.devices('Test WCD').state == 'Off' then
            dz.devices('Test WCD').switchOn()
        else
            dz.devices('Test WCD').switchOff()
        end
        dz.log(item.state, dz.LOG_DEBUG)
    end
}
Note that I have the coding skills of a Kangaroo so please be gentle :mrgreen:

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Sunday 23 May 2021 19:06
by waaren
Sjonnie2017 wrote: Sunday 23 May 2021 16:49 How do I prevent the light(s) from acting on the automated power off?
Could look like below.

Code: Select all

--Control several lights using MOES Scene Remote

return
{
    on =
    {
        devices =
        {
            'Scene Remote',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Scene Remote',
    },

    execute = function(dz, item)
        local fewSeconds = 10 -- Change to the amount of seconds required.

        dz.log(item.name .. ' State = ' .. item.state, dz.LOG_DEBUG)

        if item.state == 'B1' then
            dz.devices('Test WCD').switchOn().checkFirst()
        elseif item.state == 'Off' and item.lastUpdate.secondsAgo > fewSeconds then
            dz.devices('Test WCD').switchOff()
        end

    end
}

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Monday 24 May 2021 12:10
by Sjonnie2017
Hi waaren,

Thanks for your help. Your suggestion works the first time but the remote refuses cooperation the second time I test. I have tried with different values for fewSeconds. Best results I got were with 2 or 3 seconds. The first test round worked.

Test scenario:
Verify switch "Test WCD' is off
Press button once to switch light on
Wait 10 to 15 seconds
Press button once to switch light off
wait for 10 to 15 seconds
Press button once to switch light on
Wait 10 to.... Darn! the light switches off already! :shock:

Logs:

Code: Select all

fewSeconds = 10 =>

2021-05-24 11:39:04.718 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:39:04.856 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:39:04.856 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:39:04.856 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:39:04.857 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:39:04.857 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:39:04.857 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:39:04.857 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:39:06.074 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:39:06.161 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:39:06.162 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:39:06.162 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:39:06.162 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:39:25.211 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:39:25.350 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:39:25.350 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:39:25.350 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:39:25.351 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:39:25.351 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:39:25.351 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:39:26.081 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:39:26.215 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:39:26.216 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:39:26.216 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:39:26.216 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote

fewSeconds = 9 =>
 2021-05-24 11:43:39.075 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/DzV - MOES Scene Remote.lua
2021-05-24 11:43:43.393 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:43:43.480 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:43:43.480 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:43:43.480 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:43:43.481 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:43:43.481 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:43:43.481 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:43:43.481 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:43:46.062 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:43:46.151 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:43:46.151 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:43:46.151 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:43:46.151 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:44:09.476 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:44:09.619 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:44:09.620 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:44:09.620 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:44:09.621 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:44:09.621 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:44:09.621 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:44:16.065 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:44:16.149 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:44:16.149 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:44:16.149 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:44:16.149 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote 

fewSeconds = 5 =>

 2021-05-24 11:54:01.365 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/DzV - MOES Scene Remote.lua
2021-05-24 11:54:06.916 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:54:07.001 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:54:07.001 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:54:07.002 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:54:07.002 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:54:07.002 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:54:07.002 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:54:07.002 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:54:16.055 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:54:16.139 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:54:16.140 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:54:16.140 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:54:16.140 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:54:16.140 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 11:54:16.141 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote 

fewSeconds = 2 =>

 2021-05-24 11:48:47.513 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/DzV - MOES Scene Remote.lua
2021-05-24 11:48:54.665 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:48:54.751 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:48:54.751 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:48:54.751 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:48:54.752 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:48:54.752 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:48:54.752 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:48:54.752 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:48:56.091 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:48:56.237 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:48:56.237 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:48:56.237 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:48:56.237 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:49:10.129 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:49:10.267 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:49:10.267 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:49:10.267 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:49:10.268 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:49:10.268 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:49:10.268 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:49:16.085 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:49:16.226 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:49:16.226 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:49:16.226 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:49:16.227 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:49:16.227 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 11:49:16.227 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:49:58.909 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:49:59.037 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:49:59.037 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:49:59.037 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:49:59.038 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:49:59.038 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:49:59.038 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:49:59.038 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:50:06.070 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:50:06.208 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:50:06.208 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:50:06.208 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:50:06.208 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:50:06.208 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 11:50:06.209 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote 

fewSeconds = 3 =>

2021-05-24 11:51:48.688 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/DzV - MOES Scene Remote.lua
2021-05-24 11:51:54.820 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:51:54.906 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:51:54.906 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:51:54.906 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:51:54.907 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:51:54.907 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:51:54.907 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:51:54.907 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:51:56.070 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:51:56.206 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:51:56.207 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:51:56.207 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:51:56.207 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:52:08.427 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:52:08.515 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:52:08.516 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:52:08.516 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:52:08.516 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:52:08.516 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:52:08.517 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:52:16.076 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:52:16.161 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:52:16.162 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:52:16.162 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:52:16.162 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:52:16.162 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 11:52:16.162 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:52:21.901 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 11:52:22.042 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 11:52:22.042 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:52:22.042 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1
2021-05-24 11:52:22.042 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:52:22.042 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:52:22.042 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 11:52:22.043 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 11:52:26.077 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 11:52:26.214 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 11:52:26.214 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 11:52:26.214 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off
2021-05-24 11:52:26.215 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 11:52:26.215 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 11:52:26.215 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote 
Is it possible to register only the button press? Totally ignoring the Off command the remote sends? Would it work if I used the buttonevent of the device? If so how would I do that?

Logs of buttonevents:

Code: Select all

2021-05-24 11:56:37.183 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 1002, 'lastupdated': '2021-05-24T09:56:37.143'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:57:04.919 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 1004, 'lastupdated': '2021-05-24T09:57:04.890'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:57:24.062 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 1003, 'lastupdated': '2021-05-24T09:57:24.011'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:57:35.289 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 2002, 'lastupdated': '2021-05-24T09:57:35.271'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:58:09.974 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 2004, 'lastupdated': '2021-05-24T09:58:09.923'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:58:20.274 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 2003, 'lastupdated': '2021-05-24T09:58:20.239'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:58:26.483 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 3002, 'lastupdated': '2021-05-24T09:58:26.439'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:58:32.062 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 3004, 'lastupdated': '2021-05-24T09:58:32.026'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:58:42.252 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 3003, 'lastupdated': '2021-05-24T09:58:42.241'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:58:50.385 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 4002, 'lastupdated': '2021-05-24T09:58:50.332'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:58:54.246 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 4004, 'lastupdated': '2021-05-24T09:58:54.211'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'}
2021-05-24 11:59:07.190 ConBee2: (ConBee2) ### WebSocket Data : {'e': 'changed', 'id': '57', 'r': 'sensors', 'state': {'buttonevent': 4003, 'lastupdated': '2021-05-24T09:59:07.149'}, 't': 'event', 'uniqueid': '60:a4:23:ff:fe:d2:23:2e-01-0006'} 
Looking forward to your reply!

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Monday 24 May 2021 13:13
by waaren
Sjonnie2017 wrote: Monday 24 May 2021 12:10 I have tried with different values for fewSeconds.
Hmm..

don't get a complete picture what happens here. Can you change the logline
from

Code: Select all

dz.log(item.name .. ' State = ' .. item.state, dz.LOG_DEBUG)
to

Code: Select all

        dz.log(item.name .. ' State = ' .. item.state .. ' ;lastUpdate.secondsAgo: ' .. item.lastUpdate.secondsAgo .. ' ;fewSeconds: ' .. fewSeconds, dz.LOG_DEBUG)

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Monday 24 May 2021 13:33
by Sjonnie2017
Well let's see...

Scenario:
I pressed the button once
The light turns on
Light turns off automatically after a few secconds
Pressed button once
after 2 or three seconds pressed the button again
Nothing happens
Press button again and then I lost count :(

Code: Select all

 2021-05-24 13:30:59.927 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 13:31:00.066 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 13:31:00.066 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:00.066 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 234 ;fewSeconds: 5
2021-05-24 13:31:00.067 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 13:31:00.067 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 13:31:00.067 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 13:31:00.067 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:31:06.095 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 13:31:06.212 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 13:31:06.212 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:06.212 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 7 ;fewSeconds: 5
2021-05-24 13:31:06.213 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 13:31:06.213 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 13:31:06.213 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:31:11.434 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 13:31:11.590 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 13:31:11.590 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:11.590 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 5 ;fewSeconds: 5
2021-05-24 13:31:11.591 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 13:31:11.591 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 13:31:11.591 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 13:31:11.591 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:31:14.608 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 13:31:14.754 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 13:31:14.754 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:14.755 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 3 ;fewSeconds: 5
2021-05-24 13:31:14.755 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 13:31:14.755 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 13:31:14.755 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:31:16.080 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 13:31:16.166 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 13:31:16.166 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:16.167 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 2 ;fewSeconds: 5
2021-05-24 13:31:16.167 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:31:32.286 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 13:31:32.447 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 13:31:32.447 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:32.447 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 16 ;fewSeconds: 5
2021-05-24 13:31:32.448 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 13:31:32.448 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 13:31:32.448 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:31:36.058 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 13:31:36.142 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 13:31:36.142 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:36.142 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 4 ;fewSeconds: 5
2021-05-24 13:31:36.142 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:31:57.515 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 13:31:57.600 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 13:31:57.600 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:31:57.600 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 21 ;fewSeconds: 5
2021-05-24 13:31:57.601 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 13:31:57.601 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 13:31:57.601 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 13:32:06.070 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 13:32:06.157 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 13:32:06.157 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 13:32:06.157 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 9 ;fewSeconds: 5
2021-05-24 13:32:06.157 Status: dzVents: Debug: Scene Remote: Processing device-adapter for Test WCD: Switch device adapter
2021-05-24 13:32:06.158 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 13:32:06.158 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote 
It almost looks like the Off command is send irregularly by the remote. Most of the times the command is send after 5 seconds but not all the times. But I could be mistaken (said the Kangaroo :mrgreen: )

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Monday 24 May 2021 13:53
by waaren
Sjonnie2017 wrote: Monday 24 May 2021 13:33 It almost looks like the Off command is send irregularly by the remote. Most of the times the command is send after 5 seconds but not all the times. But I could be mistaken (said the Kangaroo :mrgreen: )
Would it help to ignore first 'Off' after an 'On' regardless the delay ?
Let me know and I will try to code that (will take some time)

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Monday 24 May 2021 14:07
by Sjonnie2017
That might do the trick. On the other hand: would it be possible to always ignore the "Off" signal/command sent by the remote and use the button press as a toggle? Then "we" would have to check the state of the light and issue the correct command to the light. Not sure if that can be done though.

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Monday 24 May 2021 15:16
by Sjonnie2017
Hi waaren,

I studied the wiki and guessed it would be just as much fun trying something "Out of the Box" (well at least my box :mrgreen: ).

So I changed the script to this (after I made a group called WCDTest):

Code: Select all

--Control several lights using MOES Scene Remote

return
{
    on =
    {
        devices =
        {
            'Scene Remote',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Scene Remote',
    },

    execute = function(dz, item)
        local fewSeconds = 5 -- Change to the amount of seconds required.

                dz.log(item.name .. ' State = ' .. item.state .. ' ;lastUpdate.secondsAgo: ' .. item.lastUpdate.secondsAgo .. ' ;fewSeconds: ' .. fewSeconds, dz.LOG_DEBUG)

--        if item.state == 'B1' then
--            dz.devices('Test WCD').switchOn().checkFirst()
--        elseif item.state == 'Off' and item.lastUpdate.secondsAgo > fewSeconds then
--            dz.devices('Test WCD').switchOff()
--        end
        if item.state == 'B1' then
            dz.groups('WCDTest').toggleGroup()
        end
    end
}
It seams to be working! I can turn on the light and it stays on untill I press the button again. Then it switches off. I waited quite some time to check if the "Off" command of the remote did not step in. It seems not to :)

The logs:

Code: Select all

 2021-05-24 15:06:05.114 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/DzV - MOES Scene Remote.lua
2021-05-24 15:06:08.394 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 15:06:08.394 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:06:08.394 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 302 ;fewSeconds: 5
2021-05-24 15:06:08.395 Status: dzVents: Debug: Scene Remote: Processing device-adapter for WCDTest: Group device adapter
2021-05-24 15:06:08.395 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 15:06:08.395 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:06:16.156 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 15:06:16.156 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:06:16.156 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 8 ;fewSeconds: 5
2021-05-24 15:06:16.157 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:06:35.190 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 15:06:35.191 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:06:35.191 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 19 ;fewSeconds: 5
2021-05-24 15:06:35.191 Status: dzVents: Debug: Scene Remote: Processing device-adapter for WCDTest: Group device adapter
2021-05-24 15:06:35.191 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 15:06:35.191 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:06:36.213 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 15:06:36.213 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:06:36.213 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 1 ;fewSeconds: 5
2021-05-24 15:06:36.213 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:06:40.704 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 15:06:40.704 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:06:40.704 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 4 ;fewSeconds: 5
2021-05-24 15:06:40.705 Status: dzVents: Debug: Scene Remote: Processing device-adapter for WCDTest: Group device adapter
2021-05-24 15:06:40.705 Status: dzVents: Debug: Scene Remote: Constructed timed-command: On
2021-05-24 15:06:40.705 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:06:46.053 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 15:06:46.185 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 15:06:46.186 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:06:46.186 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 6 ;fewSeconds: 5
2021-05-24 15:06:46.186 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:07:47.809 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 10, 'sValue': '10'}
2021-05-24 15:07:47.959 Status: dzVents: Info: Handling events for: "Scene Remote", value: "B1"
2021-05-24 15:07:47.959 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:07:47.959 Status: dzVents: Debug: Scene Remote: Scene Remote State = B1 ;lastUpdate.secondsAgo: 61 ;fewSeconds: 5
2021-05-24 15:07:47.960 Status: dzVents: Debug: Scene Remote: Processing device-adapter for WCDTest: Group device adapter
2021-05-24 15:07:47.960 Status: dzVents: Debug: Scene Remote: Constructed timed-command: Off
2021-05-24 15:07:47.960 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:07:56.056 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'nValue': 0, 'sValue': 'Off'}
2021-05-24 15:07:56.141 Status: dzVents: Info: Handling events for: "Scene Remote", value: "Off"
2021-05-24 15:07:56.141 Status: dzVents: Info: Scene Remote: ------ Start internal script: DzV - MOES Scene Remote: Device: "Scene Remote (ConBee2)", Index: 388
2021-05-24 15:07:56.141 Status: dzVents: Debug: Scene Remote: Scene Remote State = Off ;lastUpdate.secondsAgo: 9 ;fewSeconds: 5
2021-05-24 15:07:56.141 Status: dzVents: Info: Scene Remote: ------ Finished DzV - MOES Scene Remote
2021-05-24 15:08:14.728 ConBee2: (ConBee2) ### Update device (Scene Remote) : {'BatteryLevel': 100, 'nValue': 0, 'sValue': 'Off'}, IGNORED , no changes ! 
Downside is that I will have to make 12 groups. The up side is that I can now modify the behavior of the remote by simply adjusting the "contents" of the group(s).

I will be expanding the script to see if there is something else going wrong. Report back later!

For now: thanks a bundle for your help and guidance. Much appreciated!

EDIT1:
Expanded the script with all twelve button states. It is not pretty but it does the job:

Code: Select all

--Control several lights using MOES Scene Remote

return
{
    on =
    {
        devices =
        {
            'Scene Remote',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Scene Remote',
    },

    execute = function(dz, item)

        dz.log(item.name .. ' State = ' .. item.state, dz.LOG_DEBUG)

        if item.state == 'B1' then
            dz.groups('Scene Remote B1').toggleGroup()
        end
        if item.state == 'B2' then
            dz.groups('Scene Remote B2').toggleGroup()
        end
        if item.state == 'B3' then
            dz.groups('Scene Remote B3').toggleGroup()
        end        
        if item.state == 'B4' then
            dz.groups('Scene Remote B4').toggleGroup()
        end
        if item.state == 'D1' then
            dz.groups('Scene Remote D1').toggleGroup()
        end
        if item.state == 'D2' then
            dz.groups('Scene Remote D2').toggleGroup()
        end
        if item.state == 'D3' then
            dz.groups('Scene Remote D3').toggleGroup()
        end
        if item.state == 'D4' then
            dz.groups('Scene Remote D4').toggleGroup()
        end
        if item.state == 'L1' then
            dz.groups('Scene Remote L1').toggleGroup()
        end
        if item.state == 'L2' then
            dz.groups('Scene Remote L2').toggleGroup()
        end
        if item.state == 'L3' then
            dz.groups('Scene Remote L3').toggleGroup()
        end
        if item.state == 'L4' then
            dz.groups('Scene Remote L4').toggleGroup()
        end
    end
}
Would be nice to be able to use a variable instead of twelve if-then-end statements. Going to investigate so if you have any pointers... ;)

Unfortunately the toggleGrooups() does not allow me to interrupt the opening or closing of my roller shutters. I'll think of something ;)

EDIT2: For lights I can also use "toggleSwitch" but that does not seem to work with roller shutters. So for now I will stick with the "toggleGroups".

Re: MOES Scene Remote switches light off after several seconds - little help needed

Posted: Monday 24 May 2021 20:37
by waaren
Sjonnie2017 wrote: Monday 24 May 2021 15:16 So I changed the script to this (after I made a group called WCDTest):
}
Nice !!
Would be nice to be able to use a variable instead of twelve if-then-end statements. Going to investigate so if you have any pointers... ;)
Like below?

Code: Select all

--Control several lights using MOES Scene Remote

return
{
    on =
    {
        devices =
        {
            'Scene Remote',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Scene Remote',
    },

    execute = function(dz, item)

        dz.log(item.name .. ' State = ' .. item.state, dz.LOG_DEBUG)

        if item.state ~= 'Off' then
            dz.groups('Scene Remote ' .. item.state).toggleGroup()
        end
    end
}

Re: MOES Scene Remote switches light off after several seconds - little help needed  [Solved]

Posted: Tuesday 25 May 2021 17:59
by Sjonnie2017
waaren wrote: Monday 24 May 2021 20:37
Like below?
Yup! Spot on! Works like a charm!

Thanks!