#!/usr/sbin/blassic ' /home/pi/Alexa-gpio/alexa_actions.bas - intercept new web GET strings and run root scripts i=0 LABEL StartAgain i = i + 1 IF I > 200 THEN GOSUB ShowAlive ' flash the led to show /home/pi/Alexa-gpio/alexa_actions.bas is running PAUSE 20 ON ERROR GOTO StartAgain ' /var/www/ramdisk/alexa_link.txt may not be present OPEN "/var/www/ramdisk/alexa_link.txt" FOR INPUT AS #1 : INPUT #1,alexa_command$ : CLOSE #1 PRINT "The Alexa Command is ",alexa_command$ SHELL "/home/pi/IPAddress/remove_alexa_command.sh" IF alexa_command$ = "command1" THEN GOSUB command1 IF alexa_command$ = "command2" THEN GOSUB command2 IF alexa_command$ = "longreport" THEN GOSUB longreport IF alexa_command$ = "report" THEN GOSUB report GOTO StartAgain SYSTEM LABEL command1 SHELL "gpio -g write 27 1" PAUSE 500 SHELL "gpio -g write 27 0" RETURN LABEL command2 SHELL "gpio -g write 27 1" PAUSE 1000 SHELL "gpio -g write 27 0" PAUSE 500 SHELL "gpio -g write 27 1" PAUSE 1000 SHELL "gpio -g write 27 0" RETURN LABEL longreport SHELL "/home/pi/Alexa-gpio/sound/get_i2c72temp_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b0_potpounds_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b1_tmp36_pool-air_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b2_panel_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b3_pool_latest.sh > /dev/null 2>&1" OPEN "/var/www/ramdisk/i2c72temp_latest.txt" FOR INPUT AS #1 : INPUT #1,i2c72temp_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b0_potpounds_latest.txt" FOR INPUT AS #1 : INPUT #1,potpounds_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b1_tmp36_pool-air_latest.txt" FOR INPUT AS #1 : INPUT #1,tmp36_pool_air_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b2_panel_latest.txt" FOR INPUT AS #1 : INPUT #1,panel_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b3_pool_latest.txt" FOR INPUT AS #1 : INPUT #1,pool_latest$ : CLOSE #1 PRINT "i2c72temp_latest$ = ";i2c72temp_latest$ PRINT "potpounds_latest$ = ";potpounds_latest$ PRINT "tmp36_pool_air_latest$ = ";tmp36_pool_air_latest$ PRINT "panel_latest$ = ";panel_latest$ PRINT "pool_latest$ = ";pool_latest$ report1$ = " The pool temperature is " + pool_latest$ + " degrees and it is " + i2c72temp_latest$ + " degrees outside" report2$ = " The pool panel is now " + panel_latest$ + " degrees and the air in the big greenhouse is " + tmp36_pool_air_latest$ + " degrees" report3$ = " The beehive balance reads " + potpounds_latest$ + " pounds " SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report1$ PAUSE 200 SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report2$ PAUSE 200 SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report3$ RETURN LABEL report SHELL "/home/pi/Alexa-gpio/sound/get_i2c72temp_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b0_potpounds_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b1_tmp36_pool-air_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b2_panel_latest.sh > /dev/null 2>&1" SHELL "/home/pi/Alexa-gpio/sound/get_4b3_pool_latest.sh > /dev/null 2>&1" OPEN "/var/www/ramdisk/i2c72temp_latest.txt" FOR INPUT AS #1 : INPUT #1,i2c72temp_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b0_potpounds_latest.txt" FOR INPUT AS #1 : INPUT #1,potpounds_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b1_tmp36_pool-air_latest.txt" FOR INPUT AS #1 : INPUT #1,tmp36_pool_air_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b2_panel_latest.txt" FOR INPUT AS #1 : INPUT #1,panel_latest$ : CLOSE #1 OPEN "/var/www/ramdisk/4b3_pool_latest.txt" FOR INPUT AS #1 : INPUT #1,pool_latest$ : CLOSE #1 PRINT "i2c72temp_latest$ = ";i2c72temp_latest$ PRINT "potpounds_latest$ = ";potpounds_latest$ PRINT "tmp36_pool_air_latest$ = ";tmp36_pool_air_latest$ PRINT "panel_latest$ = ";panel_latest$ PRINT "pool_latest$ = ";pool_latest$ reporttitle$ = " Here is the short report " report1$ = " Pool " + pool_latest$ report2$ = " Outside " + i2c72temp_latest$ report3$ = " Panel " + panel_latest$ report4$ = " Big greenhouse air " + tmp36_pool_air_latest$ report5$ = " Beehive " + potpounds_latest$ + " pounds " SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ reporttitle$ PAUSE 100 SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report1$ PAUSE 100 SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report2$ PAUSE 100 SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report3$ PAUSE 100 SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report4$ PAUSE 100 SHELL "/home/pi/Alexa-gpio/sound/speech100plus.sh "+ report5$ RETURN LABEL ShowAlive i = 0 SHELL "gpio -g write 27 1" PAUSE 20 SHELL "gpio -g write 27 0" PAUSE 200 RETURN