From e28bf8e24ac0479871e511039e589536154caa43 Mon Sep 17 00:00:00 2001 From: betateilchen Date: Mon, 26 Oct 2015 00:23:12 +0000 Subject: [PATCH] contrib/98_openweathermap.pm: add support for stationByZip git-svn-id: https://svn.fhem.de/fhem/trunk@9680 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/contrib/98_openweathermap.pm | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index fd94a42e0..108bd25b7 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: contrib/98_openweathermap.pm - add support for stationByZip. + e.g. 76133,de will find weather data for Karlsruhe,Germany - bugfix: 38_CO20: fixed error messages on timeout - feature: codemirror modules now loaded by default: search.js, comment.js dialog.js, autorefresh.js, searchcursor.js, dialog.css diff --git a/fhem/contrib/98_openweathermap.pm b/fhem/contrib/98_openweathermap.pm index 9faf75c85..2bf04b540 100644 --- a/fhem/contrib/98_openweathermap.pm +++ b/fhem/contrib/98_openweathermap.pm @@ -118,7 +118,8 @@ sub OWO_Shutdown($) { sub OWO_Set($@){ my ($hash, @a) = @_; my $name = $hash->{NAME}; - my $usage = "Unknown argument, choose one of clear:readings stationById stationByGeo stationByName send:noArg"; + my $usage = "Unknown argument, choose one of clear:readings stationById stationByGeo ". + "stationByName stationByZip send:noArg"; my $response; return "No Argument given" if(!defined($a[1])); @@ -156,6 +157,10 @@ sub OWO_Set($@){ $urlString = $urlString."?id=".$a[2]; } + when("stationByZip"){ + $urlString = $urlString."?zip=".$a[2]; + } + when("stationByGeo"){ $a[2] = AttrVal("global", "latitude", 0) unless(defined($a[2])); $a[3] = AttrVal("global", "longitude", 0) unless(defined($a[3])); @@ -174,7 +179,7 @@ sub OWO_Set($@){ sub OWO_Get($@){ my ($hash, @a) = @_; my $name = $hash->{NAME}; - my $usage = "Unknown argument, choose one of stationById stationByGeo stationByName"; + my $usage = "Unknown argument, choose one of stationById stationByGeo stationByName stationByZip"; my $response; return "No Argument given" if(!defined($a[1])); @@ -200,6 +205,10 @@ sub OWO_Get($@){ $urlString = $urlString."?id=".$a[2]; } + when("stationByZip"){ + $urlString = $urlString."?zip=".$a[2]; + } + when("stationByGeo"){ $a[2] = AttrVal("global", "latitude", 0) unless(defined($a[2])); $a[3] = AttrVal("global", "longitude", 0) unless(defined($a[3]));