mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 14:13:18 +00:00
59_Weather: Codestyle, add attribut model to API
git-svn-id: https://svn.fhem.de/fhem/trunk@18292 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a4af61f28a
commit
63fe6a3066
@ -1,5 +1,6 @@
|
||||
# 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.
|
||||
- change: 59_Weather: Codestyle, add attribut model to API
|
||||
- bugfix: 73_AutoShuttersControl: fix drive up then roommate asleep
|
||||
- bugfix: DarkSkyAPI: fix uninitialized value in localtime at line 430
|
||||
- bugfix: 89_FULLY: fixed command set url
|
||||
|
@ -79,7 +79,6 @@ my @iconlist = (
|
||||
|
||||
###################################
|
||||
sub Weather_LanguageInitialize($) {
|
||||
|
||||
my ($lang) = @_;
|
||||
|
||||
if($lang eq "de") {
|
||||
@ -117,7 +116,6 @@ sub Weather_LanguageInitialize($) {
|
||||
|
||||
###################################
|
||||
sub Weather_DebugCodes($) {
|
||||
|
||||
my ($lang)= @_;
|
||||
my @YahooCodes_i18n= YahooWeatherAPI_getYahooCodes($lang);
|
||||
|
||||
@ -131,7 +129,6 @@ sub Weather_DebugCodes($) {
|
||||
|
||||
#####################################
|
||||
sub Weather_Initialize($) {
|
||||
|
||||
my ($hash) = @_;
|
||||
|
||||
$hash->{DefFn} = "Weather_Define";
|
||||
@ -173,7 +170,6 @@ sub Weather_ReturnWithError($$) {
|
||||
}
|
||||
|
||||
sub Weather_RetrieveCallbackFn($) {
|
||||
|
||||
my $name = shift;
|
||||
my $hash = $defs{$name};
|
||||
my $responseRef = $hash->{fhem}->{api}->getWeather;
|
||||
@ -300,7 +296,6 @@ sub Weather_WriteReadings($$) {
|
||||
|
||||
###################################
|
||||
sub Weather_GetUpdate($) {
|
||||
|
||||
my ($hash) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
@ -321,7 +316,6 @@ sub Weather_GetUpdate($) {
|
||||
|
||||
###################################
|
||||
sub Weather_Get($@) {
|
||||
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
return "argument is missing" if(int(@a) != 2);
|
||||
@ -361,15 +355,15 @@ sub Weather_Set($@) {
|
||||
|
||||
###################################
|
||||
sub Weather_RearmTimer($$) {
|
||||
|
||||
my ($hash, $t) = @_;
|
||||
|
||||
InternalTimer($t, "Weather_GetUpdate", $hash, 0) ;
|
||||
|
||||
}
|
||||
|
||||
sub Weather_DisarmTimer($) {
|
||||
|
||||
my ($hash)= @_;
|
||||
|
||||
RemoveInternalTimer($hash);
|
||||
}
|
||||
|
||||
@ -398,7 +392,6 @@ sub Weather_Notify($$) {
|
||||
|
||||
#####################################
|
||||
sub Weather_Define($$) {
|
||||
|
||||
my ($hash, $def) = @_;
|
||||
|
||||
my $usage= "syntax: define <name> Weather [API=<API>] [apikey=<apikey>] [location=<location>] [interval=<interval>] [lang=<lang>]";
|
||||
@ -439,6 +432,7 @@ sub Weather_Define($$) {
|
||||
$hash->{API} = $api;
|
||||
$hash->{APIKEY} = $apikey;
|
||||
$hash->{APIOPTIONS} = $apioptions;
|
||||
$attr{$name}->{model} = $api;
|
||||
#$hash->{UNITS} = "c"; # hardcoded to use degrees centigrade (Celsius)
|
||||
$hash->{READINGS}->{current_date_time}->{TIME}= TimeNow();
|
||||
$hash->{READINGS}->{current_date_time}->{VAL}= "none";
|
||||
@ -458,7 +452,6 @@ sub Weather_Define($$) {
|
||||
|
||||
#####################################
|
||||
sub Weather_Undef($$) {
|
||||
|
||||
my ($hash, $arg) = @_;
|
||||
|
||||
RemoveInternalTimer($hash);
|
||||
@ -476,21 +469,18 @@ use constant ICONSCALE => 0.5;
|
||||
#####################################
|
||||
|
||||
sub WeatherIconIMGTag($) {
|
||||
|
||||
my $width= int(ICONSCALE*ICONWIDTH);
|
||||
my ($icon)= @_;
|
||||
my $url= FW_IconURL("weather/$icon");
|
||||
my $style= " width=$width";
|
||||
return "<img src=\"$url\"$style alt=\"$icon\">";
|
||||
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
||||
sub WeatherAsHtmlV($;$)
|
||||
{
|
||||
|
||||
sub WeatherAsHtmlV($;$) {
|
||||
my ($d,$items) = @_;
|
||||
|
||||
$d = "<none>" if(!$d);
|
||||
$items = 9 if( !$items );
|
||||
return "$d is not a Weather instance<br>"
|
||||
@ -521,16 +511,15 @@ sub WeatherAsHtmlV($;$)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub WeatherAsHtml($;$)
|
||||
{
|
||||
sub WeatherAsHtml($;$) {
|
||||
my ($d,$i) = @_;
|
||||
|
||||
WeatherAsHtmlV($d,$i);
|
||||
}
|
||||
|
||||
sub WeatherAsHtmlH($;$)
|
||||
{
|
||||
|
||||
sub WeatherAsHtmlH($;$) {
|
||||
my ($d,$items) = @_;
|
||||
|
||||
$d = "<none>" if(!$d);
|
||||
$items = 9 if( !$items );
|
||||
return "$d is not a Weather instance<br>"
|
||||
@ -578,9 +567,9 @@ sub WeatherAsHtmlH($;$)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub WeatherAsHtmlD($;$)
|
||||
{
|
||||
sub WeatherAsHtmlD($;$) {
|
||||
my ($d,$i) = @_;
|
||||
|
||||
if($FW_ss) {
|
||||
WeatherAsHtmlV($d,$i);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user