DzVents doesn't trigger

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

Moderator: leecollings

Post Reply
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

DzVents doesn't trigger

Post by slom »

I have domoticz installed on QNAP NAS everything work properly besides DzVents scripts, I could trigger events blocly and lua but DzVents doesn't work and doesn't log anything (also in debug mode).
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: DzVents doesn't trigger

Post by waaren »

Are events and dzVents both enabled in [setup] [system] [other] and did you apply these settings ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

Yes, I have in a script line:
active = true,
and enable it and saved.
Exacly the same way as with lua and blocly script (those work properly)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: DzVents doesn't trigger

Post by waaren »

slom wrote: Wednesday 03 October 2018 8:34 Yes, I have in a script line:
active = true,
and enable it and saved.
Exacly the same way as with lua and blocly script (those work properly)
Sorry that I was not clear enough but that is not what I meant.
On the domoticz main page (with the default theme) you see some buttons. The most right one is labeled [settings] (if your language is English) Press that and you will be presented a dropdown menu. Choose [settings] and you will see another screen. On that screen press button [other]
You will get another screen where you need to scroll to the bottom to enable both the [EventSystem (Lua/Blockly/Scripts)] and [dzVents]. Don't forget to apply this setting by pressing the button [Apply settings] on the top right corner of that screen.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

I understand and I have this settings on for all events type (Lua/Blockly/Scripts) and dzVents. For testing I set debug log level.
I also I tried to refreshed this setting by switch off and save and switch on and save.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: DzVents doesn't trigger

Post by waaren »

slom wrote: Wednesday 03 October 2018 9:09 I understand and I have this settings on for all events type (Lua/Blockly/Scripts) and dzVents. For testing I set debug log level.
I also I tried to refreshed this setting by switch off and save and switch on and save.
Can you try this script and report back what you see in the log ?

Code: Select all

-- Alive.lua 

return {
    on      =   {   timer           =   { "every minute" }},
                
    logging =   {   level     =   domoticz.LOG_INFO,
                    marker    =   "I am alive....."    },

    execute = function(dz)
        
        dz.log("You will see this every minute until you deactivate", dz.LOG_FORCE) 
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

I tried this script and can't see anything in logs.
I noticed that I can change state of switch so scripts DzVents work but I cannot see anything in logs (also from your example).
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

Code: Select all

 return {
    	active = true,
    	on = {
	    	devices = {
	    		't3'
    		},
    	logging =   {   level = domoticz.LOG_INFO,
                    marker = "I am alive....."    },
                
    	},
    	execute = function(domoticz, switch)
    		if (switch.state == 'On') then
    			domoticz.log('Hey! I am on!')
    			domoticz.devices('t2').switchOn()
    			domoticz.notify('Hey!', 'I am on!')
    		else
    			domoticz.log('Hey! I am off!')
    			domoticz.devices('t2').switchOff()
    			domoticz.notify('Hey!', 'I am off!')
    		end
    	end
}
My logs:
2018-10-03 13:13:19.068 (Akwarium_test) Light/Switch (t3)
2018-10-03 13:13:19.200 (Akwarium_test) Light/Switch (t2)
2018-10-03 13:13:20.150 Notification sent (pushbullet) => Success
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: DzVents doesn't trigger

Post by waaren »

Can you change the script to

Code: Select all

 return {
    	active = true,
    	on = {
	    	devices = {
	    		't3'
    		},
    	logging =   {   level = domoticz.LOG_INFO,
                    marker = "I am alive....."    },
                
    	},
    	execute = function(domoticz, switch)
    		if (switch.state == 'On') then
    			domoticz.log('Hey! I am on!',domoticz.LOG_FORCE)
    			domoticz.devices('t2').switchOn()
    			domoticz.notify('Hey!', 'I am on!')
    		else
    			domoticz.log('Hey! I am off!',domoticz.LOG_FORCE)
    			domoticz.devices('t2').switchOff()
    			domoticz.notify('Hey!', 'I am off!')
    		end
    	end
}
If that does not give you anything in the log, I suspect that some setting in the domoticz startscript is playing tricks on you. Don't know how domoticz on QNAP is started but if you can find that startscript it might be interesting what command is used.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

I changed code and I have the same effect, I tried change language settings to English and effect is still the same.

2018-10-03 21:49:48.671 Notification sent (pushbullet) => Success
2018-10-03 21:50:34.311 Active notification Subsystems: pushbullet (1/13)
2018-10-03 21:51:14.711 (Akwarium_test) Light/Switch (t3)
2018-10-03 21:51:14.832 (Akwarium_test) Light/Switch (t2)
2018-10-03 21:51:15.694 Notification sent (pushbullet) => Success
2018-10-03 21:51:19.338 (Akwarium_test) Light/Switch (t3)
2018-10-03 21:51:19.487 (Akwarium_test) Light/Switch (t2)
2018-10-03 21:51:20.274 Notification sent (pushbullet) => Success
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

I hope maybe tomorrow I'll get some information about start script on QNAP, now I haven't any idea.
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

This is start script on QNAP NAS

Code: Select all

#!/bin/sh
CONF=/etc/config/qpkg.conf
QPKG_NAME="domoticz"
QPKG_ROOT=`/sbin/getcfg $QPKG_NAME Install_Path -f ${CONF}`
APACHE_ROOT=`/sbin/getcfg SHARE_DEF defWeb -d Qweb -f /etc/config/def_share.info`
export QNAP_QPKG=$QPKG_NAME


export QPKG_ROOT
export QPKG_NAME
export SHELL=/bin/sh
export LC_ALL=en_US.UTF-8
export USER=admin
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export TERM=xterm

export HOME=$QPKG_ROOT
export DIR=$QPKG_ROOT
#export PATH=$QPKG_ROOT/bin:$PATH
export LD_LIBRARY_PATH=$QPKG_ROOT/lib:$LD_LIBRARY_PATH

case "$1" in
  start)
    ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
    if [ "$ENABLED" != "TRUE" ]; then
        echo "$QPKG_NAME is disabled."
        exit 1
    fi

/bin/ln -sf $QPKG_ROOT /opt/$QPKG_NAME
cd $QPKG_ROOT
./Domoticz -www 8855 -wwwbind 0.0.0.0 -startupdelay 15 -log $QPKG_ROOT/var/log/domoticz.log -loglevel normal -daemon


    ;;

  stop)

killall -9 Domoticz
rm -rf /opt/$QPKG_NAME

    ;;

  restart)
    $0 stop
    $0 start
    ;;

  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

exit 0

User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: DzVents doesn't trigger

Post by waaren »

slom wrote: Thursday 04 October 2018 8:42 This is start script on QNAP NAS

Code: Select all

......
./Domoticz -www 8855 -wwwbind 0.0.0.0 -startupdelay 15 -log $QPKG_ROOT/var/log/domoticz.log -loglevel normal -daemon
...
Is there a way that you can get to the CLI (command line interface) and look in the $QPKG_ROOT/var/log/domoticz.log ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

Yes, in this file is the same as is in domoticz web log

Code: Select all

2018-10-03 21:49:47.643  (Akwarium_test) Light/Switch (t3)
2018-10-03 21:49:47.790  (Akwarium_test) Light/Switch (t2)
2018-10-03 21:49:48.671  Notification sent (pushbullet) => Success
2018-10-03 21:50:34.311  Active notification Subsystems: pushbullet (1/13)
2018-10-03 21:51:14.711  (Akwarium_test) Light/Switch (t3)
2018-10-03 21:51:14.832  (Akwarium_test) Light/Switch (t2)
2018-10-03 21:51:15.694  Notification sent (pushbullet) => Success
2018-10-03 21:51:19.338  (Akwarium_test) Light/Switch (t3)
2018-10-03 21:51:19.487  (Akwarium_test) Light/Switch (t2)
2018-10-03 21:51:20.274  Notification sent (pushbullet) => Success
2018-10-04 00:00:01.259  Sunrise: 06:57:00 SunSet: 18:24:00
2018-10-04 00:00:01.259  Day length: 11:27:00 Sun at south: 12:05:00
2018-10-04 00:00:01.259  Civil twilight start: 06:24:00 Civil twilight end: 18:57:00
2018-10-04 00:00:01.259  Nautical twilight start: 05:46:00 Nautical twilight end: 19:35:00
2018-10-04 00:00:01.259  Astronomical twilight start: 05:07:00 Astronomical twilight end: 20:14:00
2018-10-04 08:08:01.439  (Akwarium_test) Light/Switch (t1)

slom
Posts: 10
Joined: Wednesday 03 October 2018 8:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents doesn't trigger

Post by slom »

OK, everything is OK now I have log like this:

Code: Select all

 2018-10-04 12:51:53.290 Status: User: Admin initiated a switch command (6/t3/Off)
2018-10-04 12:51:53.336 Status: dzVents: Info: Handling events for: "t3", value: "Off"
2018-10-04 12:51:53.336 Status: dzVents: Info: ------ Start internal script: test: Device: "t3 (Akwarium_test)", Index: 6
2018-10-04 12:51:53.336 Status: dzVents: !Info: Hey! I am off!
2018-10-04 12:51:53.337 Status: dzVents: Info: ------ Finished test
2018-10-04 12:51:53.392 Status: EventSystem: Script event triggered: /share/CACHEDEV1_DATA/.qpkg/domoticz/dzVents/runtime/dzVents.lua
2018-10-04 12:51:53.409 Status: Notification: Hey!
2018-10-04 12:51:54.506 Notification sent (pushbullet) => Success 
I changed start script on qnap to:

./Domoticz -www 8855 -wwwbind 0.0.0.0 -startupdelay 15 -log $QPKG_ROOT/var/log/domoticz.log -loglevel normal,status,error -daemon
Post Reply

Who is online

Users browsing this forum: NaTuRaL and 1 guest