What do you guys think about adding the twitter api so that your station can tweet the weather conditions you choose at a specified interval. I tested the Cumulus app from sandaysoft.com while waiting for a replacement usb stick for the meteohub and it had that twitter feature. I have to admit I am very fond of that feature. I think it would be a great addition to the meteohub application on all platforms.
later guys,
kd4ngc..out
Twitter API
Moderator: Mattk
Re: Twitter API
That's the one feature I'd love to see
. I'm often out on the farm away from my station or PC. To fire up twitter on a mobile phone and see the last weather tweet would be so much faster than starting a mobile web browser and loading a page with graphs and images.
Maybe in the next update??
http://homepages.vodafone.co.nz/~p-flem ... local.html

Maybe in the next update??
http://homepages.vodafone.co.nz/~p-flem ... local.html
Re: Twitter API
I already do that, so I don´t know, if you need Boris to accomplish your wish.
My twitter:
http://twitter.com/honsolgen
My former meteohub hardware platform NSLU2 running now on Debian Etch and does the complete creation of my brothers webcam archive.
And the old hardware is yet good enough to feed my twitter site with updated weather info from my meteohub system.
To publish your weather data on twitter you simply need the linux command/tool curl
in my case:
[/b][/color]
The variables starting with a $ contain the weather data.
I´m picking that data from a html-file updated every ten minutes by meteohub and stored on my webspace.
But you could also use this command in a shellscript to write your complete sensor data into a single textfile:
nc localhost 5558 > sensordata.txt
Here´s the complete script.
My twitter:
http://twitter.com/honsolgen
My former meteohub hardware platform NSLU2 running now on Debian Etch and does the complete creation of my brothers webcam archive.
And the old hardware is yet good enough to feed my twitter site with updated weather info from my meteohub system.
To publish your weather data on twitter you simply need the linux command/tool curl
in my case:
Code: Select all
curl -u USER:PASSWORD -d status="$TIME > temp $T | dew $DEW |rain $REGEN l | wind $WIND / $WINDDIR || greenhouse $TGH | SOL $SOL | UV-I $UV" http://twitter.com/statuses/update.xml
The variables starting with a $ contain the weather data.
I´m picking that data from a html-file updated every ten minutes by meteohub and stored on my webspace.
But you could also use this command in a shellscript to write your complete sensor data into a single textfile:
nc localhost 5558 > sensordata.txt
Here´s the complete script.
Code: Select all
DAY1=$(date -d today +%A)
lynx -dump 'http://www.myway.de/honsolgen/m.htm' >wshonsolgen.txt
DATUM=$(date +'%d/%m/%Y')
TIME=$(date +'%H:%M')
echo $TIME
ZUSTAND=$(awk 'NR==9 { print $1,$2 }' wombuchloe.txt)
FEUCHTE=$(awk 'NR==10 { print $1,$2,$3 }' wombuchloe.txt)
SICHTWEITE=$(awk 'NR==11 { print $1,$2,$3 }' wombuchloe.txt)
WIND=$(awk 'NR==14 { print $2,$3 }' wombuchloe.txt)
BOE=$(awk 'NR==15 { print $1,$2 }' wombuchloe.txt)
WINDIR=$(awk 'NR==15 { print $1,$2,$3 }' wombuchloe.txt)
BARO=$(awk 'NR=15 { print $1,$2,$3 }' wombuchloe.txt)
BAROTREND=$(awk 'NR=15 { print $1,$2,$3 }' wombuchloe.txt)
T=$(awk 'NR==2 { print $2,$3 }' wshonsolgen.txt)
DEW=$(awk 'NR==3 { print $2,$3 }' wshonsolgen.txt)
TMIN=$(awk 'NR==4 { print $2,$3 }' wshonsolgen.txt)
TMAX=$(awk 'NR==5 { print $2,$3 }' wshonsolgen.txt)
TSOIL=$(awk 'NR==7 { print $1,$2,$3 }' wshonsolgen.txt)
TWZ=$(awk 'NR==8 { print $2,$3 }' wshonsolgen.txt)
TGH=$(awk 'NR==11 { print $2,$3 }' wshonsolgen.txt)
SOL=$(awk 'NR==13 { print $3,$4 }' wshonsolgen.txt)
UV=$(awk 'NR==14 { print $3 }' wshonsolgen.txt)
WIND=$(awk 'NR==19 { print $4,$5 }' wshonsolgen.txt)
WINDDIR=$(awk 'NR==20 { print $3 }' wshonsolgen.txt)
REGEN=$(awk 'NR==21 { print $5 }' wshonsolgen.txt)
curl -u USER:PASSWORD -d status="$TIME > temp $T | dew $DEW |rain $REGEN l | wind $WIND / $WINDDIR || greenhouse $TGH | SOL $SOL | UV-I $UV"
http://twitter.com/statuses/update.xml
Re: Twitter API
Hi wfpost,
I've got twitter updates from my meteohub NSLU2 using the following script with a cron job.
included the script for anyone that's interested.
Thanks for the help.
I've got twitter updates from my meteohub NSLU2 using the following script with a cron job.
included the script for anyone that's interested.
Thanks for the help.
Code: Select all
#!/bin/bash
# Meteohub - Twitter API update script
# curl command needs to be all on one line
# replace username:password with your twitter username and password
#
DAY1=$(date -d today +%A)
nc localhost 5558 > sensordata.txt
DATUM=$(date +'%d/%m/%Y')
TIME=$(date +'%H:%M')
echo $TIME
actual_th0_temp_c=$(awk 'NR==64 { print $2 }' sensordata.txt)
last24h_th0_tempmin_c=$(awk 'NR==961 { print $2 }' sensordata.txt)
last24h_th0_tempmax_c=$(awk 'NR==963 { print $2 }' sensordata.txt)
actual_wind0_chill_c=$(awk 'NR==112 { print $2 }' sensordata.txt)
hour1_thb1_press_trend=$(awk 'NR==588 { print $2 }' sensordata.txt)
actual_tbh1_sealevel_hpa=$(awk 'NR==92 { print $2 }' sensordata.txt)
actual_wind0_speed_kmh=$(awk 'NR==108 { print $2 }' sensordata.txt)
actual_wind0_dir_en=$(awk 'NR==101 { print $2 }' sensordata.txt)
last24h_rain0_total_mm=$(awk 'NR==882 { print $2 }' sensordata.txt)
actual_th0_hum_rel=$(awk 'NR==66 { print $2 }' sensordata.txt)
curl -u user:password -d status="Temp $actual_th0_temp_c, min/max $last24h_th0_tempmin_c / $last24h_th0_tempmax_c°C, chill $actual_wind0_chill_c°C, Wind $actual_wind0_speed_kmh km/h $actual_wind0_dir_en,
Baro $actual_tbh1_sealevel_hpa hPa trend: $hour1_thb1_press_trend hPa/hr, Rain 24hrs $last24h_rain0_total_mm mm,
Hum $actual_th0_hum_rel%" http://twitter.com/statuses/update.xml
Re: Twitter API
Hi Philip,
just opened your twitter. It´s working. Fine!
Funny, we have now 30-35°C, a very hot July, indeed the hottest July since weather recordings started and in NZ 10°C. Looking and feeeling like winter in the Southern hemisphere
BTW:
1. You could comment that line out. I had it only for testing reason checking whether the date/time format is correct.
# echo $TIME
2. With the math functions available in a shell script, it would be possible to calculate the baro trend and translate it into either text or arrows, following the Davis vantage algorithm. I´ll do that when it´s getting colder here in Bavaria and let you know.

cu,
Wolfgang
just opened your twitter. It´s working. Fine!
Funny, we have now 30-35°C, a very hot July, indeed the hottest July since weather recordings started and in NZ 10°C. Looking and feeeling like winter in the Southern hemisphere

BTW:
1. You could comment that line out. I had it only for testing reason checking whether the date/time format is correct.
# echo $TIME
2. With the math functions available in a shell script, it would be possible to calculate the baro trend and translate it into either text or arrows, following the Davis vantage algorithm. I´ll do that when it´s getting colder here in Bavaria and let you know.

cu,
Wolfgang
Re: Twitter API
After twitter shut down Basic Authentication 4 weeks ago, the simple User/password approach did not work anymore.
I was looking for getting it to working again with the new oAuth method, but all the solutions needed in some way PHP,Perl, etc.
I´ve now found a way to do it with sticking on shellscript and my twitter is updated again
http://twitter.com/honsolgen
If someone is interested, I can put together the steps to get it working again with oAuth.
Doesn´t take you longer then ten minutes to change and add a few parts to the old settings ...
I was looking for getting it to working again with the new oAuth method, but all the solutions needed in some way PHP,Perl, etc.
I´ve now found a way to do it with sticking on shellscript and my twitter is updated again

http://twitter.com/honsolgen
If someone is interested, I can put together the steps to get it working again with oAuth.
Doesn´t take you longer then ten minutes to change and add a few parts to the old settings ...
Last edited by wfpost on Thu Sep 23, 2010 5:57 pm, edited 1 time in total.
Re: Twitter API
I was wondering how to change the settings. If you could post the changes I'd appreciate that,
Be glad to get twitter working again. Thanks.
Be glad to get twitter working again. Thanks.
Re: Twitter API
okay,
This was the info I used:
Tony Finch - Simple shell scripting for Twitter
So you need two small programs:
Fetch Jef Poskanzer's oauth_sign and http_post packages.
Use these make commands for the two packages:
Typing make should be enough to build oauth_sign;
for
http_post you probably want make SSL_DEFS="-DUSE_SSL" SSL_LIBS="-lssl -lcrypto"
I did a make install for both as well. I guess that´s needed, otherwise you have to copy the two compiled programs yourself to the correct bin folder ...
---
To get on going you need to register your own app with http://dev.twitter.com/
final result

This was the info I used:
Tony Finch - Simple shell scripting for Twitter
So you need two small programs:
Fetch Jef Poskanzer's oauth_sign and http_post packages.
Use these make commands for the two packages:
Typing make should be enough to build oauth_sign;
for
http_post you probably want make SSL_DEFS="-DUSE_SSL" SSL_LIBS="-lssl -lcrypto"
I did a make install for both as well. I guess that´s needed, otherwise you have to copy the two compiled programs yourself to the correct bin folder ...
---
To get on going you need to register your own app with http://dev.twitter.com/
and last step >> here´s the altered script >>To use oauth you must register an application. Go to http://dev.twitter.com/ -> Your apps -> Register a new app. Fill in the form. Tell it the app is a client app and give it read+write permission.
When you have done that you will be presented with your application's settings page. The interesting parts are the "consumer key" and the "consumer secret" which are the half of your app's oauth credentials which authenticate the application to Twitter. The other half of the credentials prove that your app may do something to a particular person's Twitter account. In order to obtain the second half oauth normally requires a fairly complicated dance. Happily, for simple cases where you want to script your own account, Twitter provides a shortcut.
On your application's settings page, click the "My Access Token" link. This gives you a page containing your "access token" and "access token secret" which together with your "consumer key" and "consumer secret" allow your app to post to your Twitter account.
#!/bin/bash
# Meteohub - Twitter API OAUTH update script
# oauth_sign and http_post packages need to be installed
# replace keys with the ones you get from dev.twitter.com
#
DAY1=$(date -d today +%A)
nc localhost 5558 > sensordata.txt
DATE=$(date +'%d/%m/%Y')
TIME=$(date +'%H:%M')
#echo $TIME
actual_th0_temp_c=$(awk 'NR==64 { print $2 }' sensordata.txt)
last24h_th0_tempmin_c=$(awk 'NR==961 { print $2 }' sensordata.txt)
last24h_th0_tempmax_c=$(awk 'NR==963 { print $2 }' sensordata.txt)
actual_wind0_chill_c=$(awk 'NR==112 { print $2 }' sensordata.txt)
hour1_thb1_press_trend=$(awk 'NR==588 { print $2 }' sensordata.txt)
actual_tbh1_sealevel_hpa=$(awk 'NR==92 { print $2 }' sensordata.txt)
actual_wind0_speed_kmh=$(awk 'NR==108 { print $2 }' sensordata.txt)
actual_wind0_dir_en=$(awk 'NR==101 { print $2 }' sensordata.txt)
last24h_rain0_total_mm=$(awk 'NR==882 { print $2 }' sensordata.txt)
actual_th0_hum_rel=$(awk 'NR==66 { print $2 }' sensordata.txt)
if [ $hour1_thb1_press_trend = 1 ]
then
hour1_thb1_press_trend="⇑ rising ⇑"
elif [ $hour1_thb1_press_trend = 0 ]
then
hour1_thb1_press_trend="⇒ steady ⇒"
else
hour1_thb1_press_trend="⇓ falling ⇓"
fi
consumer_key="your consumer_key"
consumer_secret="your consumer_secret"
access_token="your access_token"
access_secret="your access_secret"
url="https://api.twitter.com/statuses/update.xml"
/usr/local/bin/http_post -h Authorization "$(/usr/local/bin/oauth_sign \
$consumer_key $consumer_secret \
$access_token $access_secret \
POST "$url" status="Temp $actual_th0_temp_c, min/max $last24h_th0_tempmin_c / $last24h_th0_tempmax_c°C · chill $actual_wind0_chill_c°C · Wind $actual_wind0_speed_kmh km/h $actual_wind0_dir_en · Baro $actual_tbh1_sealevel_hpa hPa $hour1_thb1_press_trend · Rain 24hrs $last24h_rain0_total_mm mm, Hum $actual_th0_hum_rel%")" \
"$url" status="Temp $actual_th0_temp_c, min/max $last24h_th0_tempmin_c / $last24h_th0_tempmax_c°C · chill $actual_wind0_chill_c°C · Wind $actual_wind0_speed_kmh km/h $actual_wind0_dir_en · Baro $actual_tbh1_sealevel_hpa hPa $hour1_thb1_press_trend · Rain 24hrs $last24h_rain0_total_mm mm, Hum $actual_th0_hum_rel%"
final result

Re: Twitter API
This is an old thread, but still relevant for those of us interested in using Twitter with Meteohub!
I'll admit to being a Windows person, so I'm not used to running 'make' with a collection of files. I found a Windows version of the utility but I'm guessing that won't work for 'making' these two pieces? I don't think I have console access to the Meteohub so I'm not sure where to go here. Maybe it's simpler than it seems to be.
Any guidance would be appreciated!
I'll admit to being a Windows person, so I'm not used to running 'make' with a collection of files. I found a Windows version of the utility but I'm guessing that won't work for 'making' these two pieces? I don't think I have console access to the Meteohub so I'm not sure where to go here. Maybe it's simpler than it seems to be.
Any guidance would be appreciated!