Upload to Twitter?
Posted: Sat Mar 19, 2011 4:24 pm
Would it be possible to embed a function into Meteohub to send a small weather update to Twitter?
honsolgen
09:30 ☛ leicht bewölkt |T: 4.1°C ▪ min -2.8° max 3.9° | 6 km/h - E | ⇑ 1036.1 hPa | ☂0.00 l
The max/min temperatures are not recalculated before tweeting. So the actual temperature is higher / lower than the min max if it ist still rising / falling. Is there any way to force recalculation? Otherwise I'm thinking of editing the script in a manner like "if temp-max < temp-act than temp-max == temp-act fi" - that would do the trick without a big hazzle, but probably there is a clean way to manage this.WetterQuickborn
#Wetter #Quickborn Temp Grad Celsius heute: 9.1 | 0.5 | 8.8 (akt|min|max) - Baro 1036.1 hpa konstant - Wind 1.2 bft SSW - Regen/24h 0.00 mm
Code: Select all
if [ "$actual_wind0_speed_bft" = "0.00" ]; then actual_wind0_dir_en=; fi
if ( expr $last24h_th0_tempmin_c \> $actual_th0_temp_c >/dev/null ); then last24h_th0_tempmin_c="$actual_th0_temp_c" ; fi
if ( expr $last24h_th0_tempmax_c \< $actual_th0_temp_c >/dev/null ); then last24h_th0_tempmax_c="$actual_th0_temp_c" ; fi
Code: Select all
baro1=$(grep actual_thb0_press_hpa <sensordata.txt | awk 'NR==1 { print $2 }')
grep seqhour1_thb0_press_hpa <sensordata.txt | awk 'NR==1 { print $2 }' >baro.out
sed -i "s/_/ /g" baro.out
baro3=$(awk 'NR==1 { print $4 }' baro.out)
BAROVP=$(bc << EOF
$baro1-$baro3
EOF)
if (( $(bc <<< "$BAROVP >= -0.7") > 0 )); then BAROTREND="⇔"; fi
if (( $(bc <<< "$BAROVP >= 0.7") > 0 )); then BAROTREND="⇑"; fi
if (( $(bc <<< "$BAROVP <= -0.7") > 0 )); then BAROTREND="⇓"; fi
Thanks a lot! I noticed, that the trend was always (mh, well, 6x in a row) constant and planned to have a look on the code this evening - now I copy & pasted your code and can have a cold beer!wfpost wrote:BTW:
Your barotrend is wrong, because meteohubs barotrend variables have a bug, and do not reflect reasonable pressure changes.
That´s why meteohub shows for baro trend most of the time: steady
viewtopic.php?f=18&t=5651&p=8580&hilit= ... rend#p8580
Because of this, I do the barotrend calc with the shellscript as well
But my script isn't working properly:wfpost wrote: So, I need as well alter my script with your changes.
Code: Select all
meteohub:~# echo $last24h_th0_tempmax_c
14.9
meteohub:~# echo $actual_th0_temp_c
5.5
meteohub:~# if ( expr $last24h_th0_tempmax_c \< $actual_th0_temp_c); then echo $last24h_th0_tempmax_c ist kleiner $actual_th0_temp_c; fi
1
14.9 ist kleiner 5.5
meteohub:~# echo $last24h_th0_tempmin_c
0.5
meteohub:~# if ( expr '$last24h_th0_tempmin_c' \> '$actual_th0_temp_c' >/dev/null ); then echo $last24h_th0_tempmin_c ist groesser $actual_th0_temp_c ; fi
0.5 ist groesser 5.5
Code: Select all
if [ "`echo "$last24h_th0_tempmin_c > $actual_th0_temp_c" | bc -l`" = "1" ] ; then last24h_th0_tempmin_c="$actual_th0_temp_c" ; fi
if [ "`echo "$last24h_th0_tempmax_c < $actual_th0_temp_c" | bc -l`" = "1" ] ; then last24h_th0_tempmax_c="$actual_th0_temp_c" ; fi