There is no group or scene

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

Moderator: leecollings

Post Reply
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

There is no group or scene

Post by Gianni »

hello

after rebuild my system i try to get my scripts back to work.
The most is done but i have a problem with my scene's
I get this error

Code: Select all

There is no group or scene with that name or id: test. If you just created the scene or group you may have to restart Domoticz to make it become visible to dzVents.
but they exist
I have restart my system within domoticz and putty but still got this error.
If i look in the dzvenst hardware tab there are no scenes only my devices
Knipsel5.JPG
Knipsel5.JPG (32.43 KiB) Viewed 792 times
Knipsel6.JPG
Knipsel6.JPG (45.58 KiB) Viewed 792 times

i would try to use the idx instead of the name but i notice that idx 1 en 2 exist in domoticz and controller?
Is this normal?

Code: Select all

 2019-09-09 08:24:34.520 Status: User: Admin initiated a switch command (7/Alles_Uit_Living/On)
2019-09-09 08:24:34.613 Status: dzVents: Debug: Dumping domoticz data to /home/gianni/domoticz/scripts/dzVents/domoticzData.lua
2019-09-09 08:24:34.671 Status: dzVents: Debug: Processing device-adapter for Alles_Uit_Living: Switch device adapter
2019-09-09 08:24:34.671 Status: dzVents: Debug: dzVents version: 2.4.19
2019-09-09 08:24:34.671 Status: dzVents: Debug: Event triggers:
2019-09-09 08:24:34.671 Status: dzVents: Debug: - Device: Alles_Uit_Living
2019-09-09 08:24:34.696 Status: dzVents: Info: Handling events for: "Alles_Uit_Living", value: "On"
2019-09-09 08:24:34.697 Status: dzVents: Info: ------ Start internal script: Gaan_Slapen: Device: "Alles_Uit_Living (Controller)", Index: 7
2019-09-09 08:24:34.697 Status: dzVents: Error (2.4.19): There is no group or scene with that name or id: test. If you just created the scene or group you may have to restart Domoticz to make it become visible to dzVents.
2019-09-09 08:24:34.697 Status: dzVents: Error (2.4.19): An error occured when calling event handler Gaan_Slapen
2019-09-09 08:24:34.697 Status: dzVents: Error (2.4.19): ...moticz/scripts/dzVents/generated_scripts/Gaan_Slapen.lua:8: attempt to index a nil value
2019-09-09 08:24:34.697 Status: dzVents: Info: ------ Finished Gaan_Slapen 
This is the script

Code: Select all

return {
            on = { 
                devices = {"Alles_Uit_Living"}}, -- Change to the name of the switch that you want to use for controlling the group 
    
    execute = function(dz,item)
        local myScene = "test"              -- Change to the name of the group that you want to control 
        if item.state == "On" then
            dz.groups(myScene).switchOff()             
            item.switchOff().afterSec(3).silent()       -- Masterswitch will return to On state after 3 seconds without triggering any script
        else
            dz.groups(myScene).switchOn()
        end
    end
}
Knipsel6.JPG
Knipsel6.JPG (45.58 KiB) Viewed 792 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: There is no group or scene

Post by waaren »

Gianni wrote: Monday 09 September 2019 8:33 I get this error

Code: Select all

There is no group or scene with that name or id: test. If you just created the scene or group you may have to restart Domoticz to make it become visible to dzVents.
Can you try after changing dz.groups to dz.scenes in your script ?
i would try to use the idx instead of the name but i notice that idx 1 en 2 exist in domoticz and controller?
Is this normal?
Yes. Groups and devices have both their own range of ID's starting with 1 (same for uservariables, cameras, scripts, etc )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: There is no group or scene

Post by Gianni »

hey Waaren

i try that already
The only difference is that the switch (alles uit living) is initiated and go on but not go off

Code: Select all

 2019-09-09 08:56:57.698 Status: User: Admin initiated a switch command (7/Alles_Uit_Living/On)
2019-09-09 08:56:57.795 Status: dzVents: Debug: Dumping domoticz data to /home/gianni/domoticz/scripts/dzVents/domoticzData.lua
2019-09-09 08:56:57.840 Status: dzVents: Debug: Processing device-adapter for Alles_Uit_Living: Switch device adapter
2019-09-09 08:56:57.841 Status: dzVents: Debug: dzVents version: 2.4.19
2019-09-09 08:56:57.841 Status: dzVents: Debug: Event triggers:
2019-09-09 08:56:57.841 Status: dzVents: Debug: - Device: Alles_Uit_Living
2019-09-09 08:56:57.865 Status: dzVents: Info: Handling events for: "Alles_Uit_Living", value: "On"
2019-09-09 08:56:57.865 Status: dzVents: Info: ------ Start internal script: Gaan_Slapen: Device: "Alles_Uit_Living (Controller)", Index: 7
2019-09-09 08:56:57.865 Status: dzVents: Error (2.4.19): There is no group or scene with that name or id: test. If you just created the scene or group you may have to restart Domoticz to make it become visible to dzVents.
2019-09-09 08:56:57.865 Status: dzVents: Error (2.4.19): An error occured when calling event handler Gaan_Slapen
2019-09-09 08:56:57.865 Status: dzVents: Error (2.4.19): ...moticz/scripts/dzVents/generated_scripts/Gaan_Slapen.lua:8: attempt to index a nil value
2019-09-09 08:56:57.865 Status: dzVents: Info: ------ Finished Gaan_Slapen 
these ar all the devices in the dzvents
Knipsel7.JPG
Knipsel7.JPG (127.79 KiB) Viewed 785 times
how can i use then the idx instead of the name in a script if the idx can exist more time's?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: There is no group or scene

Post by waaren »

Gianni wrote: Monday 09 September 2019 8:59 how can i use then the idx instead of the name in a script if the idx can exist more time's?
Because you never use it in isolation. dz.devices(1) is something else as dz.groups(1) or dz.variables(1)

Can you try this ?

Code: Select all

return {
            on = { 
                devices = {"Alles_Uit_Living"}}, -- Change to the name of the switch that you want to use for controlling the group 
    
    execute = function(dz,item)
        local myScene = 2              -- Change to the name of the group that you want to control 
        
        dz.log('Name of dz.scenes(myScene): "' .. dz.scenes(myScene) .. '"',dz.LOG_FORCE )    
            
        if item.state == "On" then
            -- dz.scenes(myScene).switchOff()   -- You cannot switch a scene to Off, only groups and devices
            item.switchOff().afterSec(3).silent()       -- Masterswitch will return to On state after 3 seconds without triggering any script
        else
            dz.scenes(myScene).switchOn()
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: There is no group or scene

Post by Gianni »

Code: Select all

 2019-09-09 10:45:12.311 Status: User: Admin initiated a switch command (7/Alles_Uit_Living/On)
2019-09-09 10:45:12.397 Status: dzVents: Debug: Dumping domoticz data to /home/gianni/domoticz/scripts/dzVents/domoticzData.lua
2019-09-09 10:45:12.470 Status: dzVents: Debug: Processing device-adapter for Alles_Uit_Living: Switch device adapter
2019-09-09 10:45:12.470 Status: dzVents: Debug: dzVents version: 2.4.19
2019-09-09 10:45:12.470 Status: dzVents: Debug: Event triggers:
2019-09-09 10:45:12.470 Status: dzVents: Debug: - Device: Alles_Uit_Living
2019-09-09 10:45:12.494 Status: dzVents: Info: Handling events for: "Alles_Uit_Living", value: "On"
2019-09-09 10:45:12.494 Status: dzVents: Info: ------ Start internal script: Gaan_Slapen: Device: "Alles_Uit_Living (Controller)", Index: 7
2019-09-09 10:45:12.495 Status: dzVents: Debug: Processing device-adapter for test: Scene device adapter
2019-09-09 10:45:12.495 Status: dzVents: Error (2.4.19): An error occured when calling event handler Gaan_Slapen
2019-09-09 10:45:12.495 Status: dzVents: Error (2.4.19): ...moticz/scripts/dzVents/generated_scripts/Gaan_Slapen.lua:8: attempt to concatenate a table value
2019-09-09 10:45:12.495 Status: dzVents: Info: ------ Finished Gaan_Slapen 
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: There is no group or scene

Post by waaren »

Gianni wrote: Monday 09 September 2019 10:45 2019-09-09 10:45:12.495 Status: dzVents: Error (2.4.19): ...moticz/scripts/dzVents/generated_scripts/Gaan_Slapen.lua:8: attempt to concatenate a table value
My bad. forgot the .name attribute. The error does already reveal that there is an object. Bug fixed in code below.

Code: Select all

return {
            on = { 
                devices = {"Alles_Uit_Living"}}, -- Change to the name of the switch that you want to use for controlling the group 
    
    execute = function(dz,item)
        local myScene = 2              -- Change to the name of the group that you want to control 
        
        dz.log('Name of dz.scenes(myScene): "' .. dz.scenes(myScene).name .. '"',dz.LOG_FORCE )    
            
        if item.state == "On" then
            -- dz.scenes(myScene).switchOff()   -- You cannot switch a scene to Off, only groups and devices
            item.switchOff().afterSec(3).silent()       -- Masterswitch will return to On state after 3 seconds without triggering any script
        else
            dz.scenes(myScene).switchOn()
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: There is no group or scene

Post by Gianni »

made some progress
the switch(Alles_Uit_Living/) go on and off but the scene is not triggered
The light living will not go off

this is my testscene
Knipsel8.JPG
Knipsel8.JPG (91.98 KiB) Viewed 771 times

Code: Select all

 2019-09-09 11:47:47.597 Status: User: Admin initiated a switch command (7/Alles_Uit_Living/On)
2019-09-09 11:47:47.685 Status: dzVents: Debug: Dumping domoticz data to /home/gianni/domoticz/scripts/dzVents/domoticzData.lua
2019-09-09 11:47:47.747 Status: dzVents: Debug: Processing device-adapter for Alles_Uit_Living: Switch device adapter
2019-09-09 11:47:47.747 Status: dzVents: Debug: dzVents version: 2.4.19
2019-09-09 11:47:47.748 Status: dzVents: Debug: Event triggers:
2019-09-09 11:47:47.748 Status: dzVents: Debug: - Device: Alles_Uit_Living
2019-09-09 11:47:47.773 Status: dzVents: Info: Handling events for: "Alles_Uit_Living", value: "On"
2019-09-09 11:47:47.774 Status: dzVents: Info: ------ Start internal script: Gaan_Slapen: Device: "Alles_Uit_Living (Controller)", Index: 7
2019-09-09 11:47:47.774 Status: dzVents: Debug: Processing device-adapter for test: Scene device adapter
2019-09-09 11:47:47.774 Status: dzVents: !Info: Name of dz.scenes(myScene): "test"
2019-09-09 11:47:47.775 Status: dzVents: Debug: Constructed timed-command: Off
2019-09-09 11:47:47.775 Status: dzVents: Debug: Constructed timed-command: Off AFTER 3 SECONDS
2019-09-09 11:47:47.775 Status: dzVents: Debug: Constructed timed-command: Off AFTER 3 SECONDS NOTRIGGER
2019-09-09 11:47:47.775 Status: dzVents: Info: ------ Finished Gaan_Slapen
2019-09-09 11:47:47.775 Status: dzVents: Debug: Commands sent to Domoticz:
2019-09-09 11:47:47.775 Status: dzVents: Debug: - Alles_Uit_Living = Off AFTER 3 SECONDS NOTRIGGER 
may i ask,are you a programmer irl of did you learn this all by yourself :-)
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: There is no group or scene

Post by Gianni »

i think it's works now
I add this to th cocde

Code: Select all

  if item.state == "On" then
            dz.scenes(myScene).switchOn()-- You cannot switch a scene to Off, only groups and devices
              item.switchOff().afterSec(3).silent()       -- Masterswitch will return to On state after 3 seconds without triggering any script
log

Code: Select all

 2019-09-09 12:18:26.055 Status: dzVents: Debug: Processing device-adapter for Alles_Uit_Living: Switch device adapter
2019-09-09 12:18:26.055 Status: dzVents: Debug: dzVents version: 2.4.19
2019-09-09 12:18:26.055 Status: dzVents: Debug: Event triggers:
2019-09-09 12:18:26.055 Status: dzVents: Debug: - Device: Alles_Uit_Living
2019-09-09 12:18:26.082 Status: dzVents: Info: Handling events for: "Alles_Uit_Living", value: "On"
2019-09-09 12:18:26.082 Status: dzVents: Info: ------ Start internal script: Gaan_Slapen: Device: "Alles_Uit_Living (Controller)", Index: 7
2019-09-09 12:18:26.082 Status: dzVents: Debug: Processing device-adapter for test: Scene device adapter
2019-09-09 12:18:26.083 Status: dzVents: !Info: Name of dz.scenes(myScene): "test"
2019-09-09 12:18:26.083 Status: dzVents: Debug: Constructed timed-command: On
2019-09-09 12:18:26.083 Status: dzVents: Debug: Constructed timed-command: Off
2019-09-09 12:18:26.083 Status: dzVents: Debug: Constructed timed-command: Off AFTER 3 SECONDS
2019-09-09 12:18:26.083 Status: dzVents: Debug: Constructed timed-command: Off AFTER 3 SECONDS NOTRIGGER
2019-09-09 12:18:26.083 Status: dzVents: Info: ------ Finished Gaan_Slapen
2019-09-09 12:18:26.083 Status: dzVents: Debug: Commands sent to Domoticz:
2019-09-09 12:18:26.083 Status: dzVents: Debug: - Scene:test = On
2019-09-09 12:18:26.083 Status: dzVents: Debug: - Alles_Uit_Living = Off AFTER 3 SECONDS NOTRIGGER
2019-09-09 12:18:26.083 Status: dzVents: Debug: =====================================================
2019-09-09 12:18:26.084 Status: EventSystem: Script event triggered: /home/gianni/domoticz/dzVents/runtime/dzVents.lua
2019-09-09 12:18:26.139 Status: dzVents: Debug: Dumping domoticz data to /home/gianni/domoticz/scripts/dzVents/domoticzData.lua
2019-09-09 12:18:26.182 Status: dzVents: Debug: Processing device-adapter for test: Scene device adapter
2019-09-09 12:18:26.183 Status: dzVents: Debug: dzVents version: 2.4.19
2019-09-09 12:18:26.183 Status: dzVents: Debug: Event triggers:
2019-09-09 12:18:26.183 Status: dzVents: Debug: - Scene: test
2019-09-09 12:18:26.209 Status: dzVents: Debug: Scene-event for: test value: On
2019-09-09 12:18:26.255 Status: dzVents: Debug: Dumping domoticz data to /home/gianni/domoticz/scripts/dzVents/domoticzData.lua
2019-09-09 12:18:26.296 Status: dzVents: Debug: Processing device-adapter for Licht_Living: Switch device adapter
2019-09-09 12:18:26.297 Status: dzVents: Debug: Processing device-adapter for Licht_Eetplaats: Switch device adapter
2019-09-09 12:18:26.297 Status: dzVents: Debug: dzVents version: 2.4.19
2019-09-09 12:18:26.297 Status: dzVents: Debug: Event triggers:
2019-09-09 12:18:26.297 Status: dzVents: Debug: - Device: Licht_Living
2019-09-09 12:18:26.297 Status: dzVents: Debug: - Device: Licht_Eetplaats
2019-09-09 12:18:26.324 Status: dzVents: Info: Handling events for: "Licht_Living", value: "Off"
2019-09-09 12:18:26.324 Status: dzVents: Info: ------ Start internal script: Wissel_Living: Device: "Licht_Living (Controller)", Index: 6
2019-09-09 12:18:26.326 Status: dzVents: Debug: Processing device-adapter for Wissel_Living: Switch device adapter
2019-09-09 12:18:26.326 Status: dzVents: Debug: Constructed timed-command: Off
2019-09-09 12:18:26.326 Status: dzVents: Debug: Constructed timed-command: Off NOTRIGGER
2019-09-09 12:18:26.326 Status: dzVents: Info: ------ Finished Wissel_Living
2019-09-09 12:18:26.326 Status: dzVents: Debug: Commands sent to Domoticz:
2019-09-09 12:18:26.326 Status: dzVents: Debug: - Wissel_Living = Off NOTRIGGER
2019-09-09 12:18:26.326 Status: dzVents: Debug: ===================================================== 
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: There is no group or scene

Post by waaren »

Gianni wrote: Monday 09 September 2019 12:19 i think it's works now
👍
And to answer your earlier question. Irl I am a retired IT guy who did a minor on programming in a previous life (around 1990). Only used that back then professional for a couple of months as a side job. So now only hobby. I am picking it up using Google and looking at domoticz sources and dzVents runtime modules.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest