code style, add attribut model

This commit is contained in:
Marko Oldenburg 2019-01-17 11:49:06 +01:00
parent c205866758
commit 5dbc93fa40

View File

@ -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 {