Domoticz V4.10982. RPi 3B+ SanDisc 16GB card, 3A power supply
Until now, I used raspbian Stretch without any problems. Yesterday I went to Buster, and there was a problem with the autostart.
In the home / pi directory, I have a script in bash that runs BLE (chmod 711) iNode.sh
Code: Select all
#!/bin/bash
# iBeacon Scan by Radius Networks
# written by Michał Dobrzyński
# modified by iNode.pl 03.12.2017
declare -i cnt
declare -i dcnt
declare -i bcnt
declare -i tl
declare -i bl
declare -i bc
declare -i bt
declare -i DTYPE
if [[ $1 == "parse" ]]; then
packet=""
capturing=""
count=0
while read line
do
count=$[count + 1]
if [ "$capturing" ]; then
if [[ $line =~ ^[0-9a-fA-F]{2}\ [0-9a-fA-F] ]]; then
packet="$packet $line"
else
#echo RAW: $packet
cnt=0
dcnt=0
bl=0
bt=0
bc=0
np=""
mp=""
DTYPE=0
for i in $packet; do
if [[ "$cnt" -eq "13" ]]; then
tl=`echo "ibase=16; $i"|bc`
#echo TL $tl
fi
if [[ "$cnt" -gt "13" ]]; then
np+=$i
if [[ "$bl" -eq "0" ]]; then
if [[ "$DTYPE" -eq "130" ]]; then # iNode Energy Meter
#echo DTYPE
MAC=`echo $packet | awk '{print $13$12$11$10$9$8}'`
#echo $mp
#CONST
HEX=`echo $mp | awk '{ print $12$11 }'`
DEC=`echo "ibase=16; $HEX"|bc`
CONST=$DEC
#echo CONST $CONST
#WATY
HEX=`echo $mp | awk '{ print $6$5 }'`
DEC=`echo "ibase=16; $HEX"|bc`
#echo MINUTE POWER $DEC
CALC=`echo $DEC $CONST | awk '{ w=(($1*60.0)/$2*1000); printf"%0.2f\n", w }'`
#IMPULSY
HEXIM=`echo $mp | awk '{ print $10$9$8$7 }'`
#echo TOTAL POWER $HEXIM
DECIM=`echo "ibase=16; $HEXIM"|bc`
#echo TOTAL POWER $DECIM
CALCIM=`echo $DECIM $CONST | awk '{ kWh=($1/$2); printf"%0.3f\n", kWh }'`
#echo CALCIM $CALCIM
TODOMOTICZ=`echo $CALCIM | sed -r 's/\.//g'`
#domoticz
/usr/bin/curl -s -o /dev/null "http://192.168.0.10:8080/json.htm?type=command¶m=udevice&idx=109&nvalue=0&svalue=$CALC;$TODOMOTICZ"
#emoncms
#/usr/bin/curl -s -o /dev/null "http://emoncms.org/input/post.json?json={meterpower:$CALC}&apikey=XYZ"
#/usr/bin/curl -s -o /dev/null "http://emoncms.org/input/post.json?json={meterkwh:$CALCIM}&apikey=XYZ"
#logowanie do lokalnego sysloga
logger POWER: $CALC W $CALCIM kWh -p local2.info
#print na ekranie
echo MAC: $MAC POWER: $CALC W TOTAL: $CALCIM kWh | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'
DTYPE=0
fi
if [[ "$dcnt" -lt "$tl" ]]; then
bl=`echo "ibase=16; $i"|bc`
bcnt=0
#echo BL $bl
mp=$i" "
fi
else
if [[ "$bcnt" -eq "0" ]]; then
bc=`echo "ibase=16; $i"|bc`
#echo BC $bc
fi
if [[ "$bc" -eq "255" ]]; then
if [[ "$bcnt" -eq "2" ]]; then
DTYPE=`echo "ibase=16; $i"|bc`
#echo DTYPE $DTYPE
fi
fi
bcnt=$bcnt+1
bl=$bl-1
mp+=$i" "
fi
dcnt=$dcnt+1
fi
cnt=$cnt+1
done
capturing=""
packet=""
fi
fi
if [ ! "$capturing" ]; then
if [[ $line =~ ^\> ]]; then
packet=`echo $line | sed 's/^>.\(.*$\)/\1/'`
capturing=1
fi
fi
done
else
hcitool lescan --duplicates --passive 1>/dev/null &
if [ "$(pidof hcitool)" ]; then
hcidump --raw | ./$0 parse $1
fi
fi
Code: Select all
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
sudo /home/pi/iNode.sh
exit 0
I did the same on Raspbian Buster but the script does not start! When will I issue the command: systemctl status rc-local.service I get what is in the picture below
Can anyone help me?
(The iNode.sh script running manually in the console is working correctly.)