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 (32.43 KiB) Viewed 787 times
Knipsel6.JPG (45.58 KiB) Viewed 787 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?
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
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
}
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 )
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 (127.79 KiB) Viewed 780 times
how can i use then the idx instead of the name in a script if the idx can exist more time's?
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
}
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.
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
}
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
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.