invalid on = section, logging = {  [SOLVED]

Moderator: leecollings

Post Reply
User avatar
Varazir
Posts: 360
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

invalid on = section, logging = {

Post by Varazir »

Version: 2020.2 (build 12442)
Build Hash: 9834d993a-modified
Compile Date: 2020-10-02 17:21:24
dzVents Version: 3.0.14
Python Version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]

Hello after I updated to latest beta I started to get an error on all my dzVents scripts.
2020-10-03 09:36:35.086 Error: dzVents: Error: (3.0.14) Internal script SoligtSovrum.lua has an invalid on = section; please check the wiki. Skipping it until fixed.

2020-10-03 09:51:31.916 Status: dzVents: !Info: You entered "logging" in the on = section. Maybe you meant "devices"?
it was saying that this section was wrong,


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

If I remove the logging section the error goes away.

Edit: I have checked https://github.com/domoticz/domoticz/tr ... umentation and https://www.domoticz.com/wiki/DzVents:_ ... ptional.29 couldn't se any wrong with my script.
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: invalid on = section, logging = {

Post by waaren »

Varazir wrote: Saturday 03 October 2020 9:55 couldn't see anything wrong with my script.
Can you please share the script giving the error (the part from line 1 until execute = ) ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Varazir
Posts: 360
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: invalid on = section, logging = {

Post by Varazir »

waaren wrote: Saturday 03 October 2020 10:43
Varazir wrote: Saturday 03 October 2020 9:55 couldn't see anything wrong with my script.
Can you please share the script giving the error (the part from line 1 until execute = ) ?

Code: Select all

return {
	on = {
		scenes = {
			'Sovrum*'
		},
		    logging =   { 
            level           = domoticz.LOG_DEBUG, 
            marker          = 'ScenesSovrum'
        }

	},
	execute = function(dz, scene)
        local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end
        if scene.name == 'SovrumGN' then
            dz.helpers.join(dz,"domoticz=:=scenes=:=SovrumGN")
            -- dz.helpers.join(dz,"group.all","domoticz","SovrumGN")
            -- dz.notify("Scenes Sovrum","domoticz=:=scenes=:=SovrumGN",dz.PRIORITY_NORMAL,dz.NSS_HTTP)
        else 
            dz.helpers.join(dz,"domoticz=:=scenes=:=SovrumGM")
            -- dz.notify("Scenes Sovrum","domoticz=:=scenes=:=SovrumGM",dz.PRIORITY_NORMAL,dz.NSS_HTTP)
        end
    
	end
}
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: invalid on = section, logging = {  [SOLVED]

Post by waaren »

Varazir wrote: Saturday 03 October 2020 11:09 couldn't see anything wrong with my script.
Nice to see that the extra control I added in recent Beta's works :D

The way you placed your }, makes that Lua makes logging part of the on = section. This often made mistake is one of the reason I always align my opening- and closing ( curly ) brackets.

see below for the corrected script.

Code: Select all

return 
{
    on = 
    {
        scenes = 
        {
            'Sovrum*',
        },
    },
    
    logging = 
    { 
        level = domoticz.LOG_DEBUG, 
        marker = 'ScenesSovrum',
    },

    execute = function(dz, scene)
        local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end
        if scene.name == 'SovrumGN' then
            dz.helpers.join(dz,"domoticz=:=scenes=:=SovrumGN")
            -- dz.helpers.join(dz,"group.all","domoticz","SovrumGN")
            -- dz.notify("Scenes Sovrum","domoticz=:=scenes=:=SovrumGN",dz.PRIORITY_NORMAL,dz.NSS_HTTP)
        else 
            dz.helpers.join(dz,"domoticz=:=scenes=:=SovrumGM")
            -- dz.notify("Scenes Sovrum","domoticz=:=scenes=:=SovrumGM",dz.PRIORITY_NORMAL,dz.NSS_HTTP)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Varazir
Posts: 360
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: invalid on = section, logging = {

Post by Varazir »

waaren wrote: Saturday 03 October 2020 11:21
Varazir wrote: Saturday 03 October 2020 11:09 couldn't see anything wrong with my script.
Nice to see that the extra control I added in recent Beta's works :D

The way you placed your }, makes that Lua makes logging part of the on = section. This often made mistake is one of the reason I always align my opening- and closing ( curly ) brackets.

see below for the corrected script.

Code: Select all

return 
{
    on = 
    {
        scenes = 
        {
            'Sovrum*',
        },
    },
    
    logging = 
    { 
        level = domoticz.LOG_DEBUG, 
        marker = 'ScenesSovrum',
    },

    execute = function(dz, scene)
        local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end
        if scene.name == 'SovrumGN' then
            dz.helpers.join(dz,"domoticz=:=scenes=:=SovrumGN")
            -- dz.helpers.join(dz,"group.all","domoticz","SovrumGN")
            -- dz.notify("Scenes Sovrum","domoticz=:=scenes=:=SovrumGN",dz.PRIORITY_NORMAL,dz.NSS_HTTP)
        else 
            dz.helpers.join(dz,"domoticz=:=scenes=:=SovrumGM")
            -- dz.notify("Scenes Sovrum","domoticz=:=scenes=:=SovrumGM",dz.PRIORITY_NORMAL,dz.NSS_HTTP)
        end
    end
}
Thanks I can never get the hang of when to add a , or not.
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: invalid on = section, logging = {

Post by waaren »

Varazir wrote: Saturday 03 October 2020 12:15 Thanks I can never get the hang of when to add a , or not.
This was not about a misplaced comma. It was about a misplaced curly bracket.

A comma need to placed between items in a table. After the last item in a table ( just before the closing curly bracket ) it can be left out but it is not an error when you also use it there.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Varazir
Posts: 360
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: invalid on = section, logging = {

Post by Varazir »

waaren wrote: Saturday 03 October 2020 12:43
Varazir wrote: Saturday 03 October 2020 12:15 Thanks I can never get the hang of when to add a , or not.
This was not about a misplaced comma. It was about a misplaced curly bracket.

A comma need to placed between items in a table. After the last item in a table ( just before the closing curly bracket ) it can be left out but it is not an error when you also use it there.
I see it now, thanks.
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest