mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-03 19:49:02 +00:00
50_HP1000.pm: add uvIndex
git-svn-id: https://svn.fhem.de/fhem/trunk@12316 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b8fcbdee58
commit
1f257dd4c1
@ -86,15 +86,18 @@ sub HP1000_Define($$) {
|
||||
$hash->{PASSWORD} = $a[3] if ( defined( $a[3] ) );
|
||||
|
||||
return "Device already defined: " . $modules{HP1000}{defptr}{NAME}
|
||||
if ( defined( $modules{HP1000}{defptr} ) );
|
||||
if ( defined( $modules{HP1000}{defptr} ) && !defined( $hash->{OLDDEF} ) );
|
||||
|
||||
$hash->{fhem}{infix} = "updateweatherstation";
|
||||
if ( HP1000_addExtension( $name, "HP1000_CGI", "updateweatherstation" ) ) {
|
||||
$hash->{fhem}{infix} = "updateweatherstation";
|
||||
}
|
||||
else {
|
||||
return "Error registering FHEMWEB infix";
|
||||
}
|
||||
|
||||
# create global unique device definition
|
||||
$modules{HP1000}{defptr} = $hash;
|
||||
|
||||
HP1000_addExtension( $name, "HP1000_CGI", "updateweatherstation" );
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
@ -233,6 +236,20 @@ sub HP1000_CGI() {
|
||||
# calculated readings
|
||||
#
|
||||
|
||||
# uvIndex
|
||||
# Forum https://forum.fhem.de/index.php/topic,44403.msg501704.html#msg501704
|
||||
if ( defined( $webArgs->{UV} ) ) {
|
||||
my $v = floor( ( $webArgs->{UV} - 100 ) / 450 + 1 );
|
||||
readingsBulkUpdate( $hash, "uvIndex", $v );
|
||||
}
|
||||
|
||||
# # luminosity2
|
||||
# # Forum https://forum.fhem.de/index.php/topic,44403.msg501704.html#msg501704
|
||||
# if ( defined( $webArgs->{light} ) ) {
|
||||
# my $v = round( $webArgs->{light} / 126.7 * 10 ) / 10;
|
||||
# readingsBulkUpdate( $hash, "luminosity2", $v );
|
||||
# }
|
||||
|
||||
# dewpointIndoor
|
||||
if ( defined( $webArgs->{intemp} ) && defined( $webArgs->{inhumi} ) ) {
|
||||
my $h = (
|
||||
@ -615,6 +632,15 @@ sub HP1000_PushWU($$) {
|
||||
$value = $value * 0.01; # convert from uW/cm2 to W/m2
|
||||
}
|
||||
|
||||
elsif ( $key eq "uvIndex" ) {
|
||||
$key = "UV";
|
||||
$value = $value;
|
||||
}
|
||||
|
||||
elsif ( $key eq "UV" ) {
|
||||
next;
|
||||
}
|
||||
|
||||
$cmd .= "$key=" . $value . "&";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user