Upload to Twitter?
Moderator: Mattk
- WS Grave
- Expert Boarder
- Posts: 103
- Joined: Fri Oct 30, 2009 3:42 pm
- Location: Grave - the Netherlands
- Contact:
Upload to Twitter?
Would it be possible to embed a function into Meteohub to send a small weather update to Twitter?
Re: Upload to Twitter?
viewtopic.php?f=16&t=7978&p=8571&hilit=twitter#p8571
my twitter updates with meteohub
http://twitter.com/#!/honsolgen
my twitter updates with meteohub
http://twitter.com/#!/honsolgen
Re: Upload to Twitter?
I'm using twittermail and parts of your script, wfpost - thanks a lot.
And obviously, we're suffering the same problems:
Danny
Edit: just decided to use the quick & dirty solution:
And obviously, we're suffering the same problems:
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
Danny
Edit: just decided to use the quick & dirty solution:
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
Re: Upload to Twitter?
hi,
thanks for the hint. Wasn´t aware of it.
The day1 variables for max/min are not updated every minute it seems, more likely every half an hour of even every hour, which makes sense in way.
So, I need as well alter my script with your changes.
Thx,
Wolfgang
thanks for the hint. Wasn´t aware of it.
The day1 variables for max/min are not updated every minute it seems, more likely every half an hour of even every hour, which makes sense in way.
So, I need as well alter my script with your changes.
Thx,
Wolfgang
Last edited by wfpost on Tue Mar 22, 2011 8:37 pm, edited 1 time in total.
Re: Upload to Twitter?
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
That works fine and is in line with the VP2 display and the VP2 algorithm --> Barometric Trend (3 hour)
(I do not use the slowly/rapidly definition, only the slowly values reflect a change in pressure with my approach, though it would be easy to alter this, if needed)

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
That works fine and is in line with the VP2 display and the VP2 algorithm --> Barometric Trend (3 hour)
(I do not use the slowly/rapidly definition, only the slowly values reflect a change in pressure with my approach, though it would be easy to alter this, if needed)

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
Last edited by wfpost on Mon Apr 18, 2011 3:53 pm, edited 1 time in total.
Re: Upload to Twitter?
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

Re: Upload to Twitter?
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
Re: Upload to Twitter?
yep, because only bc does handle non-integers