All my blockly scripts stopped working after an update

Moderator: leecollings

Post Reply
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

All my blockly scripts stopped working after an update

Post by RduPre »

Hi,

All my blockly scripts stopped working after an update I did this week.

Lua scripts are working without any problem.

I tried to create a new Blockly script which does not work either.
Nothing in de logs :-(

Please help because I have a lot of Blockly scripts

Thanks,
Rien

Version: 4.11474
Build Hash: 12feb06f1
Compile Date: 2019-11-08 16:33:53
dzVents Version: 2.5.0
Python Version: 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: All my blockly scripts stopped working after an update

Post by Geitje »

Is eventsystem ticked (under settings-> other)?

I had something like that after a major update, in my case: some old blockies did not work, exact new copies did, still do not know what the problem was.
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by RduPre »

Geitje wrote: Friday 08 November 2019 21:02 Is eventsystem ticked (under settings-> other)?
Yes it is, LUA scripts are running normally
Geitje wrote: Friday 08 November 2019 21:02 I had something like that after a major update, in my case: some old blockies did not work, exact new copies did, still do not know what the problem was.
If I create a new one, it still doesn't work :oops:
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by waaren »

RduPre wrote: Friday 08 November 2019 22:45 If I create a new one, it still doesn't work :oops:
If you create a new one and save it you should see something in the log like 2019-11-08 22:58:09.619 Status: EventSystem: reset all events...
Do you see that ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by RduPre »

waaren wrote: Friday 08 November 2019 22:59
RduPre wrote: Friday 08 November 2019 22:45 If I create a new one, it still doesn't work :oops:
If you create a new one and save it you should see something in the log like 2019-11-08 22:58:09.619 Status: EventSystem: reset all events...
Do yoyusee that ?
Yes !!
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by waaren »

RduPre wrote: Friday 08 November 2019 23:00 Yes !!
OK,

you can check what is in the database. What do you see doing this ? (if you have not installed sqlite3 yet, install it first using

Code: Select all

sudo apt install sqlite3

Then (on the CLI)

Code: Select all

cd <domoticz  dir>
sudo cp domoticz.db safecopy.db
sudo sqlite3 safecopy.db
sqlite> .he on
sqlite> .ta
sqlite> select ID, Name, Type , Status from EventMaster where interpreter = 'Blockly';
sqlite> select * from eventRules where EMID in (select ID from EventMaster where interpreter = 'Blockly');
sqlite> .q
sudo rm safecopy.db
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by RduPre »

This is what I get.

Looks good to me, but I'm no expert ;)

Code: Select all

sqlite> .ta
BackupLog             Meter                 SceneTimers         
Cameras               Meter_Calendar        Scenes              
CamerasActiveDevices  MobileDevices         SetpointTimers      
CustomImages          MultiMeter            SharedDevices       
DeviceStatus          MultiMeter_Calendar   Temperature         
DeviceToPlansMap      MySensors             Temperature_Calendar
EnoceanSensors        MySensorsChilds       TimerPlans          
EventMaster           MySensorsVars         Timers              
EventRules            Notifications         ToonDevices         
Fan                   Percentage            UV                  
Fan_Calendar          Percentage_Calendar   UV_Calendar         
FibaroLink            Plans                 UserSessions        
Floorplans            Preferences           UserVariables       
GooglePubSubLink      PushLink              Users               
Hardware              Rain                  WOLNodes            
HttpLink              Rain_Calendar         Wind                
LightSubDevices       SceneDevices          Wind_Calendar       
LightingLog           SceneLog              ZWaveNodes          
sqlite> select ID, Name, Type , Status from EventMaster where interpreter = 'Blockly';
ID|Name|Type|Status
1|Alarm Disarmed by Night|All|1
2|Alarm Arm Home|All|1
3|Alarm Arm Away|All|1
4|Kantoor Verlichting On|All|1
5|Kantoor Verlichting Off|All|1
7|Day On/off|All|1
8|Alarm Disarmed at Day|All|1
9|Huis Verlichting aan bij beweging voordeur|All|1
10|Huisverlichting uit bij geen beweging voordeur|All|1
12|Lichten aan bij Alarm|All|1
13|Woonkamer verlichting uit bij Zonsopkomst|All|1
14|Verlichting uit bij niet thuis|All|1
15|Tuin verlichting bij openen poort|All|1
19|Script #1|All|1
20|Script #2|All|1
21|Script #3|All|1
sqlite> select * from eventRules where EMID in (select ID from EventMaster where interpreter = 'Blockly');
ID|EMID|Conditions|Actions|SequenceNo
7|9|(device[1352] == "On"  and  device[1264] == "Off")|commandArray[660]="On"|1
8|10|(device[1352] == "Off"  and  (device[1264] == "Off"  and  (timeofday  >  0  and  timeofday  <  420)))|commandArray[660]="Off"|1
11|12|device[1391] == "On"|commandArray[Group:8]="On"|1
19|14|(securitystatus  ==  2  and  timeofday  ==  1390)|commandArray[Group:8]="Off",commandArray[Group:10]="Off",commandArray[Group:9]="Off"|1
20|15|device[1425] == "On"|commandArray[532]="On FOR 10"|1
22|3|securitystatus  ==  2|commandArray[Group:8]="Off",commandArray[Group:9]="Off",commandArray[1474]="Off"|1
23|2|securitystatus  ==  1|commandArray[Group:8]="Off",commandArray[Group:9]="Off",commandArray[1474]="Off"|1
24|8|(securitystatus  ==  0  and  device[1264] == "On")|commandArray[522]="Off",commandArray[1391]="Off",commandArray[1474]="On"|1
25|1|(securitystatus  ==  0  and  device[1264] == "Off")|commandArray[1225]="On",commandArray[1236]="On",commandArray[906]="On",commandArray[907]="On",commandArray[906]="On",commandArray[1391]="Off",commandArray[1474]="On"|1
26|4|device[1224] == "On"|commandArray[1038]="On"|1
27|5|device[1224] == "Off"|commandArray[1038]="Off",commandArray[549]="Off"|1
29|19|device[1224] == "On"|commandArray[1038]="On"|1
30|13|timeofday  ==  @Sunrise|commandArray[Group:6]="Off",commandArray[660]="Off"|1
31|20|timeofday  ==  1194|commandArray[Group:6]="Off",commandArray[660]="Off"|1
32|21|device[1474] == "Off"|commandArray["WriteToLogText"]="Dit is een test"|1
sqlite> 
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by waaren »

RduPre wrote: Saturday 09 November 2019 7:58 Looks good to me, but I'm no expert ;)
Yes. that looks OK.

Can you also do

Code: Select all

cd <domoticz  dir>
sudo cp domoticz.db safecopy.db
sudo sqlite3 safecopy.db
sqlite> .he on
sqlite> select key, nValue from preferences where key in ('EnableEventScriptSystem','DisableDzVentsSystem'); 
sqlite> .q
sudo rm safecopy.db
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by RduPre »

Here you go

Code: Select all

SQLite version 3.16.2 2017-01-06 16:32:41
Enter ".help" for usage hints.
sqlite> .he on
sqlite> select key, nValue from preferences where key in ('EnableEventScriptSystem','DisableDzVentsSystem'); 
Key|nValue
EnableEventScriptSystem|1
DisableDzVentsSystem|0
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by waaren »

RduPre wrote: Saturday 09 November 2019 10:51 EnableEventScriptSystem|1
DisableDzVentsSystem|0
That is what it should be.
Can you stop domoticz and start it from the CLI with

Code: Select all

cd <domoticz dir>
sudo ./domoticz -loglevel  normal,status,error,debug --debuglevel normal,eventsystem 
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by RduPre »

Hmmm,

It seems to work when I start domoticz from the CLI, any clues why ?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by waaren »

RduPre wrote: Saturday 09 November 2019 11:06 Hmmm,

It seems to work when I start domoticz from the CLI, any clues why ?
Not directly but maybe if you show the relevant parts of /etc/init.d/domoticz.sh (if you use that to start)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by RduPre »

I don't know what's relevant, so here is the whole file

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides:          domoticz
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Home Automation System
# Description:       This daemon will start the Domoticz Home Automation System
### END INIT INFO

# Do NOT "set -e"

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DESC="Domoticz Home Automation System"
NAME=domoticz
USERNAME=pi
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

DAEMON=/home/pi/domoticz/$NAME
DAEMON_ARGS="-daemon"
#DAEMON_ARGS="$DAEMON_ARGS -daemonname $NAME -pidfile $PIDFILE"
DAEMON_ARGS="$DAEMON_ARGS -www 8081"
DAEMON_ARGS="$DAEMON_ARGS -sslwww 0"
#DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.txt"
#DAEMON_ARGS="$DAEMON_ARGS -syslog"

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

pidof_domoticz() {
    # if there is actually a domoticz process whose pid is in PIDFILE,
    # print it and return 0.
    if [ -e "$PIDFILE" ]; then
        if pidof domoticz | tr ' ' '\n' | grep -w $(cat $PIDFILE); then
            return 0
        fi
    fi
    return 1
}

#
# Function that starts the daemon/service
#
do_start()
{
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon --chuid $USERNAME --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
                || return 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
                $DAEMON_ARGS \
                || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
        # needed by services started subsequently.  A last resort is to
        # sleep for some time.
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  status)
      status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
        ;;
reload)
        log_daemon_msg "Reloading $DESC" "$NAME"
        PID=$(pidof_domoticz) || true
        if [ "${PID}" ]; then
                kill -HUP $PID
                log_end_msg 0
        else
                log_end_msg 1
        fi
        ;;
  restart)
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload}" >&2
        exit 3
        ;;
esac

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

Re: All my blockly scripts stopped working after an update

Post by waaren »

RduPre wrote: Saturday 09 November 2019 11:34 I don't know what's relevant, so here is the whole file
I don't know either what is relevant but the differences between starting from the CLI and starting with /etc/init.d/domoticz.sh


user: domoticz.sh uses PI; CLI uses sudo
www: domoticz.sh uses port 8081; CLI uses 8080 (default)
slwww: domoticz.sh uses port 0 (disabled) ; CLI uses 443(default)

log : domoticz.sh use internal logging only ; CLI use logging to terminal
loglevel: domoticz.sh use none; CLI use normal,eventSystem

Maybe you can see what happens in more detail if you change

Code: Select all

#DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.txt"
in /etc/init.d/domotizc.sh

to

Code: Select all

DAEMON_ARGS="$DAEMON_ARGS -log /var/log/domoticz.log"
DAEMON_ARGS="$DAEMON_ARGS -loglevel normal,status,error,debug" 
DAEMON_ARGS="$DAEMON_ARGS -debuglevel normal,eventsystem" 
and then

Code: Select all

sudo systemctl daemon-reload
sudo service domoticz stop
sudo service domoticz start
sudo tail -100f /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
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by RduPre »

I don't see anything in the logs that might be suspicious

I have set the default ports in the domoticz.sh (8080 and 443) but this is not the solution

Any other hints or tips ?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: All my blockly scripts stopped working after an update

Post by waaren »

RduPre wrote: Saturday 09 November 2019 13:57 I don't see anything in the logs that might be suspicious
I have set the default ports in the domoticz.sh (8080 and 443) but this is not the solution
Any other hints or tips ?
You could try with username=root and update to latest beta.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest