Missing logs (Solved)

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

Moderator: leecollings

Post Reply
iganin
Posts: 47
Joined: Tuesday 28 October 2014 17:55
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Location: Aalter, Belgium
Contact:

Missing logs (Solved)

Post by iganin »

I have set domoticz.LOG_DEBUG in the script and "error only" in the Domoticz settings.

Code: Select all

return {
    	on =    {
	    	devices =   {
                'Bathroom 2nd Floor PIR',
                'Bathroom 2nd Floor Door Sensor'
    		            },
    	logging    =    {   
                        level       =  domoticz.LOG_DEBUG,   
                        marker      =  'WC' 
                        },
    	        },	
However, I see no logs. Dz version 2020.2
Can someone help me out?
Last edited by iganin on Monday 07 December 2020 21:52, edited 1 time in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Missing logs

Post by waaren »

iganin wrote: Monday 07 December 2020 9:36 I have set domoticz.LOG_DEBUG in the script and "error only" in the Domoticz settings. However, I see no logs.
Can you try again after setting the loglevel for dzVents like below?

log settings.png
log settings.png (24.58 KiB) Viewed 1010 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
iganin
Posts: 47
Joined: Tuesday 28 October 2014 17:55
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Location: Aalter, Belgium
Contact:

Re: Missing logs

Post by iganin »

Now I see all logs from all scripts.
Odd, the one mentioned above shows without the marker

Code: Select all

2020-12-07 10:05:38.757 Status: dzVents: Info: Handling events for: "Bathroom 2nd Floor Door Sensor", value: "Open"
2020-12-07 10:05:38.757 Status: dzVents: Info: ------ Start internal script: Bathroom 2nd Floor Heating Off New: Device: "Bathroom 2nd Floor Door Sensor (Zigbee)", Index: 1050
2020-12-07 10:05:38.759 Status: dzVents: Info: ------ Finished Bathroom 2nd Floor Heating Off New
2020-12-07 10:05:38.759 Status: dzVents: Info: ------ Start internal script: Light 2nd floor WC New: Device: "Bathroom 2nd Floor Door Sensor (Zigbee)", Index: 1050
2020-12-07 10:05:38.759 Status: dzVents: Info: Device Bathroom 2nd Floor Door Sensor was changed
2020-12-07 10:05:38.760 Status: dzVents: Info: Hey! Light to be OFF
2020-12-07 10:05:38.761 Status: dzVents: Info: ------ Finished Light 2nd floor WC New
iganin
Posts: 47
Joined: Tuesday 28 October 2014 17:55
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Location: Aalter, Belgium
Contact:

Re: Missing logs

Post by iganin »

Maybe i was not clear, the feature to see logs only from the script which has "level = domoticz.LOG_DEBUG" while the rest of scripts work silence
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Missing logs

Post by waaren »

iganin wrote:Maybe i was not clear, the feature to see logs only from the script which has "level = domoticz.LOG_DEBUG" while the rest of scripts work silence
The marker should be in the message. Can you share the complete script?
To prevent all other dzVents scripts from sending something to the log:
You can set the EventSystem and dzVents settings to
log.png
log.png (17.95 KiB) Viewed 986 times
and set logging = { level = domoticz.LOG_ERROR }, -- in the logging section for all scripts

and use dz.log('your message ', dz.LOG_FORCE ) -- for all messages in the script you do want to investigate
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
iganin
Posts: 47
Joined: Tuesday 28 October 2014 17:55
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Location: Aalter, Belgium
Contact:

Re: Missing logs

Post by iganin »

The idea to have an automated light in the bathroom using a door and a PIR sensors.
It's quite challenging, taking into account that someone from the family uses WC without closing the door during night hours or do not close the door when leave the bathroom or temporary leave the bathroom, etc.

Unfortunately, i could find a script example, so I have to made mine.


Of course, having the loges only from this particular script will help me to fine-tune it.



Code: Select all


return {
    	on =    {
	    	devices =   {
                'Bathroom 2nd Floor PIR',
                'Bathroom 2nd Floor Door Sensor'
    		            },
    	logging    =    {   
                        level       =  domoticz.LOG_DEBUG,   
                        marker      =  'WC' 
                        },
    	        },	
	execute = function(domoticz, device)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
   		if (device.name == 'Bathroom 2nd Floor PIR' and device.active)   then
    		    domoticz.devices('Bathroom 2nd Floor Light').switchOn().checkFirst()
    			domoticz.log('Hey! I got Light')
    		elseif (domoticz.devices('Bathroom 2nd Floor PIR').state == 'Off')   then
    		    domoticz.log('Hey! Stay Light On')
    		elseif (domoticz.devices('Bathroom 2nd Floor Door Sensor').state == 'Open' and (domoticz.devices('Bathroom 2nd Floor PIR').state == 'On')) then
    		    domoticz.log('Hey! Light to be OFF')
    		    domoticz.devices('Bathroom 2nd Floor Light').switchOff().afterSec(160)
    		elseif (domoticz.devices('Bathroom 2nd Floor Door Sensor').state == 'Open' and (domoticz.devices('Bathroom 2nd Floor PIR').state == 'Off')) then
    		    domoticz.log('Hey! Light to be OFF')
    		    domoticz.devices('Bathroom 2nd Floor Light').switchOff()
    		else
    			domoticz.log('Not definded!')
 
    		end		
	end
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Missing logs

Post by waaren »

iganin wrote: Monday 07 December 2020 20:04 Of course, having the log only from this particular script will help me to fine-tune it.
See my previous post and this script. (you misplaced one of the } )

Code: Select all

return
{
       on =
    {
        devices =
        {
            'Bathroom 2nd Floor PIR',
            'Bathroom 2nd Floor Door Sensor',
        },
    },
    logging =
    {
        level =  domoticz.LOG_ERROR,
        marker = 'WC',
    },

    execute = function(dz, device)
        local PIR = dz.devices('Bathroom 2nd Floor PIR')
        local door = dz.devices('Bathroom 2nd Floor Door Sensor')
        local light = dz.devices('Bathroom 2nd Floor Light')

        dz.log('Device ' .. device.name .. ' was changed to ' .. device.state, dz.LOG_FORCE)
        if device == PIR and device.active then
            light.switchOn().checkFirst()
            dz.log('Hey! I got Light', dz.LOG_FORCE)
        elseif PIR.state == 'Off' then
            dz.log('Hey! Stay Light On', dz.LOG_FORCE)
        elseif door.state == 'Open' and PIR.state == 'On' then
            dz.log('Hey! Light to be OFF', dz.LOG_FORCE)
            light.switchOff().afterSec(160)
        elseif door.state == 'Open' and PIR.state == 'Off' then
            dz.log('Hey! Light to be OFF', dz.LOG_FORCE)
            light.switchOff()
        else
            dz.log('Not definded!', dz.LOG_FORCE)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
iganin
Posts: 47
Joined: Tuesday 28 October 2014 17:55
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Location: Aalter, Belgium
Contact:

Re: Missing logs

Post by iganin »

Indeed. My bad. Thanks for the help!!!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest