Page 1 of 1
DzVents doesn't trigger
Posted: Wednesday 03 October 2018 8:15
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).
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 8:25
by waaren
Are events and dzVents both enabled in [setup] [system] [other] and did you apply these settings ?
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 8:34
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)
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 8:52
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.
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 9:09
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.
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 9:19
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
}
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 10:10
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).
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 13:17
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
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 16:55
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.
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 21:55
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
Re: DzVents doesn't trigger
Posted: Wednesday 03 October 2018 21:57
by slom
I hope maybe tomorrow I'll get some information about start script on QNAP, now I haven't any idea.
Re: DzVents doesn't trigger
Posted: Thursday 04 October 2018 8:42
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
Re: DzVents doesn't trigger
Posted: Thursday 04 October 2018 8:54
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 ?
Re: DzVents doesn't trigger
Posted: Thursday 04 October 2018 9:04
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)
Re: DzVents doesn't trigger
Posted: Thursday 04 October 2018 12:54
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