Based on the data, I want to get a few works done. At the moment, I have a couple of job running and the third one is planned.
i. Bash: executes audio warning when the heat index goes beyond certain value (my place gets too hot with high humidity) ii. Bash: push email notification when there is heavy wind or rain iii. Bash: this is yet to be done: When the temperature difference (outdoor vs indoor) exceeds 5 degrees (oC) during the night then my bedroom AC turns on (although a window is always open for airflow, still the room gets hotter than outside) Is there any skin that has an interactive graph? at the moment what I see is just an image graph. This is my bash script #!/bin/bash > > >> var=$(cat /var/www/html/PWS/realtime.txt) > > vars=( $var ) > > MPHR=60 # Minutes per hour. > > current_time=$(date +%s) > > #echo "Temperature: '${vars[2]}'" > > #echo "Heat index: '${vars[41]}'" > > #echo "Wind speed: '${vars[5]}'" > > #echo "Rain rate: '${vars[8]}'" > > #echo "Rain fall: '${vars[9]}'" > > heat_index=${vars[41]%.*} #convert into integer >> > if (("$heat_index" > 32 && "$heat_index" < 39)) > > then > > last_run=$(cat /home/pi/bin/announcements/heat_index_1) > > last_run_minutes=$(( ($current_time - $last_run) / $MPHR )) > > if (("$last_run_minutes" > 60)) > > then > > /home/pi/bin/relay_on_off on > > /bin/sleep 1 > > /usr/bin/omxplayer -o local /home/pi/Music/announcement.mp3 > > /usr/bin/espeak -s 150 -g 30mS blablabla > > /home/pi/bin/relay_on_off off > > echo "Heat index: '${vars[41]}'" > > /bin/date +%s > /home/pi/bin/announcements/heat_index_1 > > else > > echo "Ran less than $last_run_minutes minutes" > > fi > > elif (("$heat_index" > 38 && "$heat_index" < 45)) > > then > > last_run=$(cat /home/pi/bin/announcements/heat_index_2) > > last_run_minutes=$(( ($current_time - $last_run) / $MPHR )) > > if (("$last_run_minutes" > 30)) > > then > > /home/pi/bin/relay_on_off on > > /bin/sleep 1 > > /usr/bin/espeak xxxxxxxxxxxx > > /home/pi/bin/relay_on_off off > > echo "Heat index: '${vars[41]}'" > > /bin/date +%s > /home/pi/bin/announcements/heat_index_2 > > else > > echo "Ran less than $last_run_minutes minutes" > > fi > > elif (("$heat_index" > 45)) > > then > > last_run=$(cat /home/pi/bin/announcements/heat_index_3) > > last_run_minutes=$(( ($current_time - $last_run) / $MPHR )) > > if (("$last_run_minutes" > 15)) > > then > > /home/pi/bin/relay_on_off on > > /bin/sleep 1 > > /usr/bin/espeak xxxxxxxxxxx > > /home/pi/bin/relay_on_off off > > echo "Heat index: '${vars[41]}'" > > /bin/date +%s > /home/pi/bin/announcements/heat_index_3 > > else > > echo "Ran less than $last_run_minutes minutes" > > fi > > else > > true > > fi > > rain_rate=${vars[8]%.*} #convert into integer > > if (("$rain_rate" > 1 && "$heat_index" < 2)) > > then > > last_run=$(cat /home/pi/bin/announcements/rain_rate_1) > > last_run_minutes=$(( ($current_time - $last_run) / $MPHR )) > > if (("$last_run_minutes" > 60)) > > then > > printf "Subject: Light Rain $rain_rate at MIR\n\nIt's raining" | ssmtp >> email > > /bin/date +%s > /home/pi/bin/announcements/rain_rate_1 > > else > > echo "Ran less than $last_run_minutes minutes" > > fi > > elif (("$rain_rate" > 2 && "$heat_index" < 7)) > > then > > last_run=$(cat /home/pi/bin/announcements/rain_rate_2) > > last_run_minutes=$(( ($current_time - $last_run) / $MPHR )) > > if (("$last_run_minutes" > 30)) > > then > > printf "Subject: Moderate Rain $rain_rate at MIR\n\nIt's raining" | ssmtp >> email > > /bin/date +%s > /home/pi/bin/announcements/rain_rate_2 > > else > > echo "Ran less than $last_run_minutes minutes" > > fi > > elif (("$rain_rate" > 7 && "$heat_index" < 20)) > > then > > last_run=$(cat /home/pi/bin/announcements/rain_rate_3) > > last_run_minutes=$(( ($current_time - $last_run) / $MPHR )) > > if (("$last_run_minutes" > 15)) > > then > > printf "Subject: Heavy Rain $rain_rate at MIR\n\nIt's raining" | ssmtp >> email > > /bin/date +%s > /home/pi/bin/announcements/rain_rate_3 > > else > > echo "Ran less than $last_run_minutes minutes" > > fi > > elif (("$rain_rate" > 20)) > > then > > last_run=$(cat /home/pi/bin/announcements/rain_rate_4) > > last_run_minutes=$(( ($current_time - $last_run) / $MPHR )) > > if (("$last_run_minutes" > 15)) > > then > > printf "Subject: Violent Rain $rain_rate at MIR\n\nIt's raining" | ssmtp >> email > > /bin/date +%s > /home/pi/bin/announcements/rain_rate_4 > > else > > echo "Ran less than $last_run_minutes minutes" > > fi > > else > > true > > fi > > > On Wednesday, October 9, 2019 at 1:36:08 AM UTC+5:30, Pila wrote: > > You still did not say do you really need only notification or want > something done based on that data! > > My Zero today took the sunset time and external temperature directly from > WeeWX report, and since it was less than 15C, closed shutters, emailed us > and logged that fact. > > Did not need alarm.Py, no extensions, no Home automation server, no > Node-Red, no MQTT. All in my tiny script. Plus of course WeeWX. > > In the morning (after the sunrise), when it gets over 18C, it will open > shutters. Unless it rains, of course. > > If you need something like that, I can help. > > > Na 8. listopada 2019. 18:30:38 CEST, Ramesh Rasappan <prra...@gmail.com > <javascript:>> wrote: >> >> thank you all, I got it working in a couple of ways; i. use in-built >> alarm.py ii. install extension crt: Cumulus Real-Time to get real-time data >> and parse it with a bash script. I am sharing here my work (could be useful >> for some noob like me!). >> >> My earlier post got deleted where I did share my bash script and >> installation guidelines >> >> >> On Tuesday, October 8, 2019 at 9:55:25 PM UTC+5:30, Ramesh Rasappan wrote: >>> >>> @Pilla, although I got it working (see above), I am still interested to >>> see your script! maybe you are handling it in a better way! (you could send >>> it to me: chittukuruvii at. gmail) >>> >>> >>> >>> On Monday, October 7, 2019 at 6:22:01 PM UTC+5:30, Pila wrote: >>>> >>>> If you really want just to send a notification, use alarm.Py. >>>> >>>> If you want to base automation on this data, I can provide example how >>>> I did it. But you would still need to solve sending e-mails on your own >>>> since my RPI Zero uses my router to do so. >>>> >>>> Na 5. listopada 2019. 18:34:06 CEST, Ramesh Rasappan <prra...@gmail.com> >>>> wrote: >>>>> >>>>> do you parse the html page? could you please share the shell script? >>>>> thanks >>>>> >>>>> On Friday, October 4, 2019 at 5:19:09 PM UTC+5:30, Pila wrote: >>>>>> >>>>>> If you really want notification, it can generate email. >>>>>> >>>>>> I use data to close shutters if it rains from the west half. I simply >>>>>> parse generated page and extract data I need. All from shell script. 5 >>>>>> lines of code to extract 8 variables. My Zero jest closed shutters since >>>>>> it >>>>>> was sunset. >>>>>> >>>>>> Na 3. listopada 2019. 16:01:58 CEST, Ramesh Rasappan < >>>>>> prra...@gmail.com> wrote: >>>>>>> >>>>>>> My current setup pulls weather data from Offset console using >>>>>>> weewx-wh23xx driver. I want to run a bash script that can get the >>>>>>> current >>>>>>> weather and send me a notification if it meets the criteria. >>>>>>> >>>>>>> >>>>>>> I could probably get the weather data directly from PWS console >>>>>>> using weewx-wh23xx driver but I can't figure out this!! Of course one >>>>>>> could >>>>>>> use sqlite3 to pull the data from either weewx database >>>>>>> (/var/lib/weewx/weewx.sdb) but it looks complicated for me that I have >>>>>>> to >>>>>>> run some complex script to retrieve the current data! >>>>>>> >>>>>>> >>>>>>> Can you share some script that can pull the current data from either >>>>>>> weewx database or from the console? thank you >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> -- >>>>>> Poslano sa mog Android uređaja sa K-9 Mail. Molim vas oprostite na >>>>>> mojoj sažetosti. >>>>>> >>>>> -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/3aa0edc5-7ec9-4502-bcea-61a3e3b62842%40googlegroups.com.