2017-08-17 07:42:02 +00:00
|
|
|
# $Id$
|
|
|
|
################################################################################
|
|
|
|
# 59_WUup.pm
|
|
|
|
#
|
|
|
|
# Copyright: mahowi
|
|
|
|
# e-mail: mahowi@gmx.net
|
|
|
|
#
|
|
|
|
# Based on 55_weco.pm by betateilchen
|
|
|
|
#
|
|
|
|
# This file is part of fhem.
|
|
|
|
#
|
|
|
|
# Fhem is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Fhem is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
package FHEM::WUup; ## no critic ( RequireFilenameMatchesPackage )
|
2017-08-17 07:42:02 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2020-03-26 20:33:31 +00:00
|
|
|
use 5.010;
|
2017-08-17 07:42:02 +00:00
|
|
|
use Time::HiRes qw(gettimeofday);
|
2020-03-26 20:33:31 +00:00
|
|
|
use POSIX qw(strftime);
|
2017-08-17 07:42:02 +00:00
|
|
|
use UConv;
|
2019-07-05 07:55:58 +00:00
|
|
|
use FHEM::Meta;
|
2020-04-15 13:23:51 +00:00
|
|
|
use GPUtils qw(GP_Import GP_Export);
|
|
|
|
|
|
|
|
## Import der FHEM Funktionen
|
|
|
|
#-- Run before package compilation
|
|
|
|
BEGIN {
|
|
|
|
# Import from main context
|
|
|
|
GP_Import(
|
|
|
|
qw( attr
|
|
|
|
AttrVal
|
|
|
|
CommandDeleteReading
|
|
|
|
defs
|
|
|
|
HttpUtils_NonblockingGet
|
|
|
|
init_done
|
|
|
|
InternalTimer
|
|
|
|
IsDisabled
|
|
|
|
Log3
|
|
|
|
readingFnAttributes
|
|
|
|
readingsBeginUpdate
|
|
|
|
readingsBulkUpdate
|
|
|
|
readingsEndUpdate
|
|
|
|
readingsSingleUpdate
|
|
|
|
ReadingsVal
|
|
|
|
RemoveInternalTimer )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#-- Export to main context with different name
|
|
|
|
GP_Export(qw( Initialize ));
|
2017-08-17 07:42:02 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Main routines
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub Initialize {
|
2017-08-17 07:42:02 +00:00
|
|
|
my ($hash) = @_;
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
$hash->{DefFn} = \&Define;
|
|
|
|
$hash->{UndefFn} = \&Undef;
|
|
|
|
$hash->{SetFn} = \&Set;
|
|
|
|
$hash->{AttrFn} = \&Attr;
|
2017-08-17 07:42:02 +00:00
|
|
|
$hash->{AttrList} =
|
2020-04-14 12:30:32 +00:00
|
|
|
'disable:1,0 '
|
|
|
|
. 'disabledForIntervals '
|
|
|
|
. 'interval '
|
|
|
|
. 'unit_windspeed:km/h,m/s '
|
|
|
|
. 'unit_solarradiation:W/m²,lux '
|
|
|
|
. 'round '
|
|
|
|
. 'wubaromin wudailyrainin wudewptf wuhumidity wurainin '
|
|
|
|
. 'wusoilmoisture wusoiltempf wusolarradiation wutempf wuUV '
|
|
|
|
. 'wuwinddir wuwinddir_avg2m wuwindgustdir wuwindgustdir_10m '
|
|
|
|
. 'wuwindgustmph wuwindgustmph_10m wuwindspdmph_avg2m wuwindspeedmph '
|
|
|
|
. 'wuAqPM2.5 wuAqPM10 '
|
2020-03-26 20:33:31 +00:00
|
|
|
. $readingFnAttributes;
|
2019-07-05 07:55:58 +00:00
|
|
|
|
|
|
|
return FHEM::Meta::InitMod( __FILE__, $hash );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub Define {
|
2020-03-26 20:33:31 +00:00
|
|
|
my $hash = shift;
|
|
|
|
my $def = shift;
|
2019-07-05 07:55:58 +00:00
|
|
|
|
|
|
|
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
2020-04-16 07:40:18 +00:00
|
|
|
|
|
|
|
## no critic ( ProhibitComplexVersion )
|
|
|
|
use version 0.77; our $VERSION = version->new( FHEM::Meta::Get( $hash, 'version' ) )->normal;
|
|
|
|
## use critic
|
2019-07-05 07:55:58 +00:00
|
|
|
|
2020-03-26 20:33:31 +00:00
|
|
|
my @param = split( "[ \t][ \t]*", $def );
|
2017-08-17 07:42:02 +00:00
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
return q{syntax: define <name> WUup <stationID> <password>}
|
2020-03-26 20:33:31 +00:00
|
|
|
if ( int(@param) != 4 );
|
2017-08-17 07:42:02 +00:00
|
|
|
|
|
|
|
my $name = $hash->{NAME};
|
|
|
|
|
2020-04-16 07:40:18 +00:00
|
|
|
$hash->{VERSION} = $VERSION;
|
2017-08-17 07:42:02 +00:00
|
|
|
$hash->{INTERVAL} = 300;
|
|
|
|
|
2020-03-26 20:33:31 +00:00
|
|
|
$hash->{helper}{stationid} = $param[2];
|
|
|
|
$hash->{helper}{password} = $param[3];
|
2017-08-17 07:42:02 +00:00
|
|
|
$hash->{helper}{softwaretype} = 'FHEM';
|
|
|
|
$hash->{helper}{url} =
|
2020-04-14 12:30:32 +00:00
|
|
|
'https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php';
|
2017-08-17 07:42:02 +00:00
|
|
|
$hash->{helper}{url_rf} =
|
2020-04-14 12:30:32 +00:00
|
|
|
'https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php';
|
2017-08-17 07:42:02 +00:00
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
readingsSingleUpdate( $hash, 'state', 'defined', 1 );
|
2017-08-17 07:42:02 +00:00
|
|
|
|
|
|
|
RemoveInternalTimer($hash);
|
|
|
|
|
2020-04-15 06:12:10 +00:00
|
|
|
$init_done
|
2020-04-15 13:23:51 +00:00
|
|
|
? &stateRequestTimer($hash)
|
|
|
|
: InternalTimer( gettimeofday(), \&stateRequestTimer, $hash, 0 );
|
2017-08-17 07:42:02 +00:00
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
Log3( $name, 3, qq{WUup ($name): defined} );
|
2017-08-17 07:42:02 +00:00
|
|
|
|
2020-03-26 20:33:31 +00:00
|
|
|
return;
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub Undef {
|
2020-03-27 11:59:58 +00:00
|
|
|
my $hash = shift;
|
|
|
|
RemoveInternalTimer($hash);
|
2020-03-26 20:33:31 +00:00
|
|
|
return;
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub Set {
|
2020-03-26 20:33:31 +00:00
|
|
|
my $hash = shift;
|
|
|
|
my $name = shift;
|
2020-04-14 12:30:32 +00:00
|
|
|
my $cmd = shift // return qq{set $name needs at least one argument};
|
2017-10-19 15:24:44 +00:00
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
return &stateRequestTimer($hash) if ( $cmd eq 'update' );
|
2020-04-14 12:30:32 +00:00
|
|
|
return qq{Unknown argument $cmd, choose one of update:noArg};
|
2017-10-19 15:24:44 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub Attr {
|
2020-03-26 20:33:31 +00:00
|
|
|
my $cmd = shift;
|
|
|
|
my $name = shift;
|
|
|
|
my $attrName = shift;
|
|
|
|
my $attrVal = shift;
|
|
|
|
my $hash = $defs{$name};
|
2017-08-17 07:42:02 +00:00
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
if ( $attrName eq 'disable' ) {
|
2020-04-15 13:23:51 +00:00
|
|
|
if ( $cmd eq 'set' and $attrVal == 1 ) {
|
2020-04-14 12:30:32 +00:00
|
|
|
readingsSingleUpdate( $hash, 'state', 'disabled', 1 );
|
|
|
|
Log3( $name, 3, qq{WUup ($name) - disabled} );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
2020-04-14 12:30:32 +00:00
|
|
|
elsif ( $cmd eq 'del' ) {
|
|
|
|
readingsSingleUpdate( $hash, 'state', 'active', 1 );
|
|
|
|
Log3( $name, 3, qq{WUup ($name) - enabled} );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
if ( $attrName eq 'disabledForIntervals' ) {
|
|
|
|
if ( $cmd eq 'set' ) {
|
|
|
|
readingsSingleUpdate( $hash, 'state', 'unknown', 1 );
|
|
|
|
Log3( $name, 3, qq{WUup ($name) - disabledForIntervals} );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
2020-04-14 12:30:32 +00:00
|
|
|
elsif ( $cmd eq 'del' ) {
|
|
|
|
readingsSingleUpdate( $hash, 'state', 'active', 1 );
|
|
|
|
Log3( $name, 3, qq{WUup ($name) - enabled} );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
if ( $attrName eq 'interval' ) {
|
|
|
|
if ( $cmd eq 'set' ) {
|
2017-08-17 07:42:02 +00:00
|
|
|
if ( $attrVal < 3 ) {
|
2020-03-26 20:33:31 +00:00
|
|
|
Log3( $name, 1,
|
2020-04-14 12:30:32 +00:00
|
|
|
qq{WUup ($name) - interval too small, please use something >= 3 (sec), default is 300 (sec).}
|
2020-03-26 20:33:31 +00:00
|
|
|
);
|
2017-08-17 07:42:02 +00:00
|
|
|
return
|
2020-04-14 12:30:32 +00:00
|
|
|
qq{interval too small, please use something >= 3 (sec), default is 300 (sec)};
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$hash->{INTERVAL} = $attrVal;
|
2020-04-14 12:30:32 +00:00
|
|
|
Log3( $name, 4, qq{WUup ($name) - set interval to $attrVal} );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-14 12:30:32 +00:00
|
|
|
elsif ( $cmd eq 'del' ) {
|
2017-08-17 07:42:02 +00:00
|
|
|
$hash->{INTERVAL} = 300;
|
2020-04-14 12:30:32 +00:00
|
|
|
Log3( $name, 4, qq{WUup ($name) - set interval to default} );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-26 20:33:31 +00:00
|
|
|
return;
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub stateRequestTimer {
|
2017-08-17 07:42:02 +00:00
|
|
|
my ($hash) = @_;
|
|
|
|
my $name = $hash->{NAME};
|
|
|
|
|
|
|
|
if ( !IsDisabled($name) ) {
|
2020-04-14 12:30:32 +00:00
|
|
|
readingsSingleUpdate( $hash, 'state', 'active', 1 )
|
2020-03-26 20:33:31 +00:00
|
|
|
if (
|
2020-04-14 12:30:32 +00:00
|
|
|
( ReadingsVal( $name, 'state', 0 ) eq 'defined'
|
|
|
|
or ReadingsVal( $name, 'state', 0 ) eq 'disabled'
|
|
|
|
or ReadingsVal( $name, 'state', 0 ) eq 'Unknown'
|
2017-08-17 07:42:02 +00:00
|
|
|
)
|
2020-03-26 20:33:31 +00:00
|
|
|
);
|
2017-08-17 07:42:02 +00:00
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sendtowu($hash);
|
2017-08-17 07:42:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
2020-04-14 12:30:32 +00:00
|
|
|
readingsSingleUpdate( $hash, 'state', 'disabled', 1 );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
InternalTimer( gettimeofday() + $hash->{INTERVAL},
|
2020-04-15 13:23:51 +00:00
|
|
|
\&stateRequestTimer, $hash, 1 );
|
2017-08-17 07:42:02 +00:00
|
|
|
|
2020-03-26 20:33:31 +00:00
|
|
|
Log3( $name, 5,
|
2020-04-15 13:23:51 +00:00
|
|
|
qq{Sub stateRequestTimer ($name) - Request Timer is called} );
|
2020-03-27 11:59:58 +00:00
|
|
|
|
|
|
|
return;
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub sendtowu {
|
2020-03-30 12:13:21 +00:00
|
|
|
my ($hash) = @_;
|
|
|
|
my $name = $hash->{NAME};
|
|
|
|
my $ver = $hash->{VERSION};
|
2020-04-15 06:12:10 +00:00
|
|
|
my $url = $hash->{INTERVAL} < 300
|
|
|
|
? $hash->{helper}{url_rf}
|
|
|
|
: $hash->{helper}{url};
|
|
|
|
$url .= "?ID=$hash->{helper}{stationid}";
|
|
|
|
$url .= "&PASSWORD=$hash->{helper}{password}";
|
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
my $datestring = strftime "%F+%T", gmtime;
|
2020-04-15 06:12:10 +00:00
|
|
|
$datestring =~ s{:}{%3A}gxms;
|
2020-03-30 06:38:57 +00:00
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
$url .= "&dateutc=$datestring";
|
2018-04-10 16:22:52 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
my ( $data, $d, $r, $o );
|
2020-03-30 12:13:21 +00:00
|
|
|
my $a = $attr{$name};
|
|
|
|
my $unit_windspeed = AttrVal( $name, 'unit_windspeed', 'km/h' );
|
|
|
|
my $unit_solarradiation = AttrVal( $name, 'unit_solarradiation', 'lux' );
|
|
|
|
my $rnd = AttrVal( $name, 'round', 4 );
|
2020-04-15 06:12:10 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
while ( my ( $key, $value ) = each(%$a) ) {
|
|
|
|
next if substr( $key, 0, 2 ) ne 'wu';
|
|
|
|
$key = substr( $key, 2, length($key) - 2 );
|
|
|
|
( $d, $r, $o ) = split( ":", $value );
|
2020-04-15 06:12:10 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
if ( defined($r) ) {
|
2020-03-26 20:33:31 +00:00
|
|
|
$o //= 0;
|
2017-08-17 07:42:02 +00:00
|
|
|
$value = ReadingsVal( $d, $r, 0 ) + $o;
|
|
|
|
}
|
|
|
|
|
2020-04-15 06:12:10 +00:00
|
|
|
my $mph_metric =
|
|
|
|
$key =~ m{\w+mph [^\n]*}xms && $unit_windspeed eq 'm/s';
|
|
|
|
my $lux_radiation =
|
|
|
|
$key eq 'solarradiation' && $unit_solarradiation eq 'lux';
|
|
|
|
|
|
|
|
$value = $key =~ m{\w+f \z}xms ? UConv::c2f( $value, $rnd )
|
|
|
|
: $key =~ m{\w+mph [^\n]*}xms ? UConv::kph2mph( $value, $rnd )
|
|
|
|
: $key eq 'baromin' ? UConv::hpa2inhg( $value, $rnd )
|
|
|
|
: $key =~ m{rainin \z}xms ? UConv::mm2in( $value, $rnd )
|
|
|
|
: $mph_metric ? UConv::kph2mph( ( UConv::mps2kph( $value, $rnd ) ), $rnd )
|
|
|
|
: $lux_radiation ? UConv::lux2wpsm( $value, $rnd )
|
|
|
|
: $value;
|
2018-08-15 15:38:43 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
$data .= "&$key=$value";
|
|
|
|
}
|
|
|
|
|
|
|
|
readingsBeginUpdate($hash);
|
2020-04-15 06:12:10 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
if ( defined($data) ) {
|
2020-04-14 12:30:32 +00:00
|
|
|
readingsBulkUpdate( $hash, 'data', $data );
|
|
|
|
Log3( $name, 4, qq{WUup ($name) - data sent: $data} );
|
2017-08-17 07:42:02 +00:00
|
|
|
$url .= $data;
|
2020-04-14 12:30:32 +00:00
|
|
|
$url .= "&softwaretype=$hash->{helper}{softwaretype}";
|
|
|
|
$url .= '&action=updateraw';
|
2020-04-15 06:12:10 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
if ( $hash->{INTERVAL} < 300 ) {
|
2020-04-14 12:30:32 +00:00
|
|
|
$url .= "&realtime=1&rtfreq=$hash->{INTERVAL}";
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
2020-04-15 06:12:10 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
my $param = {
|
2020-03-30 12:13:21 +00:00
|
|
|
url => $url,
|
|
|
|
timeout => 6,
|
|
|
|
hash => $hash,
|
2020-04-14 12:30:32 +00:00
|
|
|
method => 'GET',
|
2020-03-30 12:13:21 +00:00
|
|
|
header => "agent: FHEM-WUup/$ver\r\nUser-Agent: FHEM-WUup/$ver",
|
2020-04-15 13:23:51 +00:00
|
|
|
callback => \&receive
|
2017-08-17 07:42:02 +00:00
|
|
|
};
|
|
|
|
|
2020-04-14 12:30:32 +00:00
|
|
|
Log3( $name, 5, qq{WUup ($name) - full URL: $url} );
|
2017-08-17 07:42:02 +00:00
|
|
|
HttpUtils_NonblockingGet($param);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
CommandDeleteReading( undef, "$name data" );
|
|
|
|
CommandDeleteReading( undef, "$name response" );
|
2020-04-14 12:30:32 +00:00
|
|
|
Log3( $name, 3, qq{WUup ($name) - no data} );
|
|
|
|
readingsBulkUpdate( $hash, 'state', 'defined' );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
readingsEndUpdate( $hash, 1 );
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-04-15 13:23:51 +00:00
|
|
|
sub receive {
|
2020-03-26 20:33:31 +00:00
|
|
|
my $param = shift;
|
|
|
|
my $err = shift;
|
|
|
|
my $data = shift;
|
|
|
|
my $hash = $param->{hash};
|
|
|
|
my $name = $hash->{NAME};
|
|
|
|
|
|
|
|
if ( $err ne q{} ) {
|
|
|
|
Log3( $name, 3,
|
2020-04-14 12:30:32 +00:00
|
|
|
qq{WUup ($name) - error while requesting $param->{url} - $err} );
|
|
|
|
readingsSingleUpdate( $hash, 'state', 'ERROR', undef );
|
|
|
|
readingsSingleUpdate( $hash, 'response', $err, undef );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
2020-03-26 20:33:31 +00:00
|
|
|
elsif ( $data ne q{} ) {
|
2020-04-14 12:30:32 +00:00
|
|
|
Log3( $name, 4, qq{WUup ($name) - server response: $data} );
|
|
|
|
readingsSingleUpdate( $hash, 'state', 'active', undef );
|
|
|
|
readingsSingleUpdate( $hash, 'response', $data, undef );
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
2020-03-27 11:59:58 +00:00
|
|
|
return;
|
2017-08-17 07:42:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Documentation
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
=pod
|
2019-07-05 07:55:58 +00:00
|
|
|
|
|
|
|
=encoding utf8
|
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
=item helper
|
|
|
|
=item summary sends weather data to Weather Underground
|
|
|
|
=item summary_DE sendet Wetterdaten zu Weather Underground
|
2019-07-05 07:55:58 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
=begin html
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUup" id="WUup"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<h3>WUup</h3>
|
|
|
|
<ul>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupdefine" id="WUupdefine"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Define</b>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
<code>define <name> WUup <stationId> <password></code>
|
|
|
|
<br/><br/>
|
|
|
|
This module provides connection to
|
|
|
|
<a href="https://www.wunderground.com">www.wunderground.com</a></br>
|
|
|
|
to send data from your own weather station.<br/>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupset" id="WUupset"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Set-Commands</b><br/>
|
|
|
|
<ul>
|
2017-10-19 15:24:44 +00:00
|
|
|
<li><b>update</b> - send data to Weather Underground</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupget" id="WUupget"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Get-Commands</b><br/>
|
|
|
|
<ul>
|
|
|
|
<br/>
|
|
|
|
- not implemented -<br/>
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupattr" id="WUupattr"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Attributes</b><br/><br/>
|
|
|
|
<ul>
|
|
|
|
<li><b><a href="#readingFnAttributes">readingFnAttributes</a></b></li>
|
|
|
|
<li><b>interval</b> - Interval (seconds) to send data to
|
|
|
|
www.wunderground.com.
|
|
|
|
Will be adjusted to 300 (which is the default) if set to a value lower than 3.<br />
|
|
|
|
If lower than 300, RapidFire mode will be used.</li>
|
|
|
|
<li><b>disable</b> - disables the module</li>
|
|
|
|
<li><b><a href="#disabledForIntervals">disabledForIntervals</a></b></li>
|
|
|
|
<li><b>unit_windspeed</b> - change the units of your windspeed readings (m/s or km/h)</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li><b>unit_solarradiation</b> - change the units of your solarradiation readings (lux or W/m²)</li>
|
2018-04-10 16:22:52 +00:00
|
|
|
<li><b>round</b> - round values to this number of decimals for calculation (default 4)</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
<li><b>wu....</b> - Attribute name corresponding to
|
2019-07-04 20:21:44 +00:00
|
|
|
<a href="https://feedback.weather.com/customer/en/portal/articles/2924682-pws-upload-protocol?b_id=17298">parameter name from api.</a>
|
2017-08-17 07:42:02 +00:00
|
|
|
Each of these attributes contains information about weather data to be sent
|
|
|
|
in format <code>sensorName:readingName</code><br/>
|
|
|
|
Example: <code>attr WUup wutempf outside:temperature</code> will
|
|
|
|
define the attribute wutempf and <br/>
|
|
|
|
reading "temperature" from device "outside" will be sent to
|
|
|
|
network as parameter "tempf" (which indicates current temperature)
|
|
|
|
<br/>
|
|
|
|
Units get converted to angloamerican system automatically
|
2020-03-25 11:43:40 +00:00
|
|
|
(°C -> °F; km/h(m/s) -> mph; mm -> in; hPa -> inHg)<br/><br/>
|
2017-08-17 07:42:02 +00:00
|
|
|
<u>The following information is supported:</u>
|
|
|
|
<ul>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>winddir - instantaneous wind direction (0-360) [°]</li>
|
2018-04-13 18:15:22 +00:00
|
|
|
<li>windspeedmph - instantaneous wind speed ·[mph]</li>
|
|
|
|
<li>windgustmph - current wind gust, using software specific time period [mph]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>windgustdir - current wind direction, using software specific time period [°]</li>
|
2018-04-13 18:15:22 +00:00
|
|
|
<li>windspdmph_avg2m - 2 minute average wind speed [mph]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>winddir_avg2m - 2 minute average wind direction [°]</li>
|
2018-04-13 18:15:22 +00:00
|
|
|
<li>windgustmph_10m - past 10 minutes wind gust [mph]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>windgustdir_10m - past 10 minutes wind gust direction [°]</li>
|
|
|
|
<li>humidity - outdoor humidity (0-100) [%]</li>
|
|
|
|
<li>dewptf- outdoor dewpoint [°F]</li>
|
|
|
|
<li>tempf - outdoor temperature [°F]</li>
|
2018-04-13 18:15:22 +00:00
|
|
|
<li>rainin - rain over the past hour -- the accumulated rainfall in the past 60 min [in]</li>
|
|
|
|
<li>dailyrainin - rain so far today in local time [in]</li>
|
|
|
|
<li>baromin - barometric pressure [inHg]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>soiltempf - soil temperature [°F]</li>
|
|
|
|
<li>soilmoisture - soil moisture [%]</li>
|
|
|
|
<li>solarradiation - solar radiation[W/m²]</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
<li>UV - [index]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>AqPM2.5 - PM2.5 mass [µg/m³]</li>
|
|
|
|
<li>AqPM10 - PM10 mass [µg/m³]</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
<b>Readings/Events:</b>
|
|
|
|
<br/><br/>
|
|
|
|
<ul>
|
|
|
|
<li><b>data</b> - data string transmitted to www.wunderground.com</li>
|
|
|
|
<li><b>response</b> - response string received from server</li>
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
<b>Notes</b><br/><br/>
|
|
|
|
<ul>
|
|
|
|
<li>Find complete api description
|
2019-07-04 20:21:44 +00:00
|
|
|
<a href="https://feedback.weather.com/customer/en/portal/articles/2924682-pws-upload-protocol?b_id=17298">here</a></li>
|
2017-08-17 07:42:02 +00:00
|
|
|
<li>Have fun!</li><br/>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
=end html
|
2019-07-05 07:55:58 +00:00
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
=begin html_DE
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUup" id="WUup"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<h3>WUup</h3>
|
|
|
|
<ul>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupdefine" id="WUupdefine"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Define</b>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
<code>define <name> WUup <stationId> <password></code>
|
|
|
|
<br/><br/>
|
|
|
|
Dieses Modul stellt eine Verbindung zu <a href="https://www.wunderground.com">www.wunderground.com</a></br>
|
|
|
|
her, um Daten einer eigenen Wetterstation zu versenden..<br/>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupset" id="WUupset"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Set-Befehle</b><br/>
|
|
|
|
<ul>
|
2017-10-19 15:24:44 +00:00
|
|
|
<li><b>update</b> - sende Daten an Weather Underground</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupget" id="WUupget"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Get-Befehle</b><br/>
|
|
|
|
<ul>
|
|
|
|
<br/>
|
|
|
|
- keine -<br/>
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
2019-07-05 07:55:58 +00:00
|
|
|
<a name="WUupattr" id="WUupattr"></a>
|
2017-08-17 07:42:02 +00:00
|
|
|
<b>Attribute</b><br/><br/>
|
|
|
|
<ul>
|
|
|
|
<li><b><a href="#readingFnAttributes">readingFnAttributes</a></b></li>
|
|
|
|
<li><b>interval</b> - Sendeinterval in Sekunden. Wird auf 300 (Default-Wert)
|
|
|
|
eingestellt, wenn der Wert kleiner als 3 ist.<br />
|
|
|
|
Wenn der Wert kleiner als 300 ist, wird der RapidFire Modus verwendet.</li>
|
|
|
|
<li><b>disable</b> - deaktiviert das Modul</li>
|
|
|
|
<li><b><a href="#disabledForIntervals">disabledForIntervals</a></b></li>
|
|
|
|
<li><b>unit_windspeed</b> - gibt die Einheit der Readings für die
|
|
|
|
Windgeschwindigkeiten an (m/s oder km/h)</li>
|
2018-08-15 15:38:43 +00:00
|
|
|
<li><b>unit_solarradiation</b> - gibt die Einheit der Readings für die
|
2020-03-25 11:43:40 +00:00
|
|
|
Sonneneinstrahlung an (lux oder W/m²)</li>
|
2018-04-10 16:22:52 +00:00
|
|
|
<li><b>round</b> - Anzahl der Nachkommastellen zur Berechnung (Standard 4)</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
<li><b>wu....</b> - Attributname entsprechend dem
|
2019-07-04 20:21:44 +00:00
|
|
|
<a href="https://feedback.weather.com/customer/en/portal/articles/2924682-pws-upload-protocol?b_id=17298">Parameternamen aus der API.</a><br />
|
2020-03-25 11:43:40 +00:00
|
|
|
Jedes dieser Attribute enthält Informationen über zu sendende Wetterdaten
|
2017-08-17 07:42:02 +00:00
|
|
|
im Format <code>sensorName:readingName</code>.<br/>
|
|
|
|
Beispiel: <code>attr WUup wutempf outside:temperature</code> definiert
|
2020-03-25 11:43:40 +00:00
|
|
|
das Attribut wutempf und sendet das Reading "temperature" vom Gerät "outside" als Parameter "tempf"
|
2017-08-17 07:42:02 +00:00
|
|
|
(welches die aktuelle Temperatur angibt).
|
|
|
|
<br />
|
|
|
|
Einheiten werden automatisch ins anglo-amerikanische System umgerechnet.
|
2020-03-25 11:43:40 +00:00
|
|
|
(°C -> °;F; km/h(m/s) -> mph; mm -> in; hPa -> inHg)<br/><br/>
|
|
|
|
<u>Unterstützte Angaben</u>
|
2017-08-17 07:42:02 +00:00
|
|
|
<ul>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>winddir - momentane Windrichtung (0-360) [°]</li>
|
2018-04-13 18:15:22 +00:00
|
|
|
<li>windspeedmph - momentane Windgeschwindigkeit [mph]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>windgustmph - aktuelle Böe, mit Software-spezifischem Zeitraum [mph]</li>
|
|
|
|
<li>windgustdir - aktuelle Böenrichtung, mit Software-spezifischer Zeitraum [°]</li>
|
2018-04-13 18:15:22 +00:00
|
|
|
<li>windspdmph_avg2m - durchschnittliche Windgeschwindigkeit innerhalb 2 Minuten [mph]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>winddir_avg2m - durchschnittliche Windrichtung innerhalb 2 Minuten [°]</li>
|
|
|
|
<li>windgustmph_10m - Böen der vergangenen 10 Minuten [mph]</li>
|
|
|
|
<li>windgustdir_10m - Richtung der Böen der letzten 10 Minuten [°]</li>
|
|
|
|
<li>humidity - Luftfeuchtigkeit im Freien (0-100) [%]</li>
|
|
|
|
<li>dewptf- Taupunkt im Freien [°F]</li>
|
|
|
|
<li>tempf - Außentemperatur [°F]</li>
|
2018-04-13 18:15:22 +00:00
|
|
|
<li>rainin - Regen in der vergangenen Stunde [in]</li>
|
|
|
|
<li>dailyrainin - Regenmenge bisher heute [in]</li>
|
|
|
|
<li>baromin - barometrischer Druck [inHg]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>soiltempf - Bodentemperatur [°F]</li>
|
|
|
|
<li>soilmoisture - Bodenfeuchtigkeit [%]</li>
|
|
|
|
<li>solarradiation - Sonneneinstrahlung [W/m²]</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
<li>UV - [Index]</li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>AqPM2.5 - Feinstaub PM2,5 [µg/m³]</li>
|
|
|
|
<li>AqPM10 - Feinstaub PM10 [µg/m³]</li>
|
2017-08-17 07:42:02 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
<b>Readings/Events:</b>
|
|
|
|
<br/><br/>
|
|
|
|
<ul>
|
|
|
|
<li><b>data</b> - Daten, die zu www.wunderground.com gesendet werden</li>
|
|
|
|
<li><b>response</b> - Antwort, die vom Server empfangen wird</li>
|
|
|
|
</ul>
|
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
<b>Notizen</b><br/><br/>
|
|
|
|
<ul>
|
|
|
|
<li>Die komplette API-Beschreibung findet sich
|
2019-07-04 20:21:44 +00:00
|
|
|
<a href="https://feedback.weather.com/customer/en/portal/articles/2924682-pws-upload-protocol?b_id=17298">hier</a></li>
|
2020-03-25 11:43:40 +00:00
|
|
|
<li>Viel Spaß!</li><br/>
|
2017-08-17 07:42:02 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
=end html_DE
|
2019-07-05 07:55:58 +00:00
|
|
|
|
|
|
|
=for :application/json;q=META.json 59_WUup.pm
|
|
|
|
{
|
|
|
|
"abstract": "sends weather data to Weather Underground",
|
|
|
|
"description": "This module provides connection to Weather Underground to send data from your own weather station.",
|
|
|
|
"x_lang": {
|
|
|
|
"de": {
|
|
|
|
"abstract": "sendet Wetterdaten zu Weather Underground",
|
|
|
|
"description": "Dieses Modul stellt eine Verbindung zu Weather Underground her, um Daten einer eigenen Wetterstation zu versenden"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"license": [
|
|
|
|
"gpl_2"
|
|
|
|
],
|
2020-04-16 07:40:18 +00:00
|
|
|
"version": "v0.10.1",
|
2019-07-05 07:55:58 +00:00
|
|
|
"release_status": "stable",
|
|
|
|
"author": [
|
|
|
|
"Manfred Winter <mahowi@gmail.com>"
|
|
|
|
],
|
|
|
|
"x_fhem_maintainer": [
|
|
|
|
"mahowi"
|
|
|
|
],
|
|
|
|
"x_fhem_maintainer_github": [
|
|
|
|
"mahowi"
|
|
|
|
],
|
|
|
|
"keywords": [
|
|
|
|
"fhem-mod",
|
|
|
|
"wunderground",
|
|
|
|
"pws",
|
|
|
|
"weather"
|
|
|
|
],
|
|
|
|
"prereqs": {
|
|
|
|
"runtime": {
|
|
|
|
"requires": {
|
|
|
|
"FHEM": 0,
|
|
|
|
"FHEM::Meta": 0,
|
|
|
|
"UConv": 0,
|
2020-03-26 20:33:31 +00:00
|
|
|
"POSIX": 0,
|
2019-07-05 07:55:58 +00:00
|
|
|
"Time::HiRes": 0,
|
2020-03-26 20:33:31 +00:00
|
|
|
"perl": 5.010
|
2019-07-05 07:55:58 +00:00
|
|
|
},
|
|
|
|
"recommends": {
|
|
|
|
},
|
|
|
|
"suggests": {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"resources": {
|
|
|
|
"x_wiki" : {
|
2019-07-09 08:28:57 +00:00
|
|
|
"title" : "Wetter und Wettervorhersagen - Eigene Wetterdaten hochladen",
|
|
|
|
"web" : "https://wiki.fhem.de/wiki/Wetter_und_Wettervorhersagen#Eigene_Wetterdaten_hochladen"
|
2020-04-15 06:12:10 +00:00
|
|
|
},
|
|
|
|
"repository": {
|
|
|
|
"type": "git",
|
|
|
|
"url": "https://github.com/fhem/WUup.git",
|
|
|
|
"web": "https://github.com/mahowi/WUup/blob/master/FHEM/59_WUup.pm",
|
|
|
|
"x_branch": "master",
|
|
|
|
"x_filepath": "FHEM/",
|
|
|
|
"x_raw": "https://raw.githubusercontent.com/mahowi/WUup/master/FHEM/59_WUup.pm"
|
2019-07-05 07:55:58 +00:00
|
|
|
}
|
2020-04-15 06:12:10 +00:00
|
|
|
},
|
|
|
|
"x_support_status": "supported"
|
2019-07-05 07:55:58 +00:00
|
|
|
}
|
|
|
|
=end :application/json;q=META.json
|
|
|
|
|
2017-08-17 07:42:02 +00:00
|
|
|
=cut
|