diff --git a/phone_notification_client.sh b/phone_notification_client.sh index 8424518..8ed1102 100755 --- a/phone_notification_client.sh +++ b/phone_notification_client.sh @@ -32,14 +32,18 @@ do done ocounter="$counter" echo "peoplecounter" >&"${COPROC[1]}" - read counter <&"${COPROC[0]}" + read -t 1 counter <&"${COPROC[0]}" + if [ $? -ne 0 ] + then + counter=-1 + fi if [ "$counter" != "$ocounter" ] then logger $0 peoplecounter=$counter echo "neocounter=$counter" | ./redi.sh fi echo "spacestatus" >&"${COPROC[1]}" - read status <&"${COPROC[0]}" + read -t 1 status <&"${COPROC[0]}" if ! [ "$status" = "open" ]; then # do nothing if space is closed continue else diff --git a/setneocolor.py b/setneocolor.py index 1451942..7e77330 100755 --- a/setneocolor.py +++ b/setneocolor.py @@ -134,7 +134,8 @@ if __name__ == '__main__': for j in range(0,60,5): strip.setPixelColor(clockcalc(j), color) # put the current people count as magenta - strip.setPixelColor(clockcalc(myredis.get('neocounter')),Color(10,0,10)) + if myredis.get('neocounter') >= 0: + strip.setPixelColor(clockcalc(myredis.get('neocounter')),Color(10,0,10)) # put the minute hand as red strip.setPixelColor(clockcalc(time.strftime('%M',time.localtime())),Color(30,0,0)) # put the seconds hand as green