Forum des Objets Communicants et Solutions pour les Libérer...
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Forum des Objets Communicants et Solutions pour les Libérer...


 
AccueilAccueil  GalerieGalerie  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  

 

 Speak the current weather

Aller en bas 
AuteurMessage
racingclub
Lapin nain
Lapin nain



Localisation : Ogmore by Sea, Wales, UK.
Nabaztag : Larry
Nbr de messages : 14
Carottes : 6559

Speak the current weather Empty
MessageSujet: Speak the current weather   Speak the current weather Icon_minitimeMer 10 Mai 2006 - 13:11

Had my first crack at a perl script to read the data from my personal weather station and get Nab to speak the results. (i nicked some of the code from fridgeheads gaim plugin yellownabzsmile )

code was messy its the 1st time Ive touched Perl and havent coded since my Uni days.

You can prob do the same for yourself, but download a METAR instead:

http://weather.noaa.gov/weather/metar.shtml

for example the one for Cardiff airport is here:

http://weather.noaa.gov/pub/data/forecasts/taf/stations/EGFF.TXT

should be easy enought to parse the file yellownabzsmile

For the ultimate geekness I've got my X10 HomeSeer server to launch my script with a keypress on my RF remote, so Nab says the weather on demand yellownabzsmile

script:

Citation :
#!/usr/bin/env perl

use LWP::UserAgent;

$serialno = "xxxxxxxxxxxx"; #serial
$token = "xxxxxxxxxxxxxxx"; #Token

$FILE="C:\\wdisplay\\logfiles\\scriptlog.txt"; #Weather Display Input File
$/=","; #Comma Delimited

open FILE or die "Can't open $FILE for read: $!\n";

@list=<FILE>;

$wind = @list[29]*1;
$gust = @list[30]*1;
$direction = @list[31]*1;
$hum = @list[33]*1;
$in_temp = int(((@list[34]-32)/9)*5);
$out_temp = int(((@list[35]-32)/9)*5);
$baro = int((@list[39]*1)*33.8639);

$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1" . $ua->agent);

$url = "http://www.nabaztag.com/vl/FR/api.jsp?serial=$serialno&token=$token&ttlive=1&tts=outside temperature is $out_temp degrees, inside temperature is $in_temp degrees, windspeed is $wind miles an hour, pressure is $baro millibars and humidity is $hum percent";

my $req=new HTTP::Request GET => $url;
my $res = $ua->request($req);

print $url;
Revenir en haut Aller en bas
 
Speak the current weather
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» WandaJ! Speak to me!
» Weather Service Lights
» le nabaztag speak english ou pas ... ???
» Bunny done nothing but speak what I wrote since I got it
» Weather is Only In Celsius?

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum des Objets Communicants et Solutions pour les Libérer... :: IV. I Don't Speak French! :: Archives :: Rabbit's services-
Sauter vers: