mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
HP1000: add RGB color for UV condition
git-svn-id: https://svn.fhem.de/fhem/trunk@13961 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
93ed6ad9dc
commit
160fe56aa0
@ -88,6 +88,7 @@ sub HP1000_Initialize($) {
|
||||
'UV' => { rtype => 'uvi', },
|
||||
'UVR' => { rtype => 'uwpscm', },
|
||||
'UVcondition' => { rtype => 'condition_uvi', },
|
||||
'UVcondition_rgb' => { rtype => 'rgb', },
|
||||
'condition' => { rtype => 'condition_weather', },
|
||||
'daylight' => { rtype => 'yesno', },
|
||||
'dewpoint' => { rtype => 'c', formula_symbol => 'Td', },
|
||||
@ -873,8 +874,9 @@ sub HP1000_CGI() {
|
||||
|
||||
# UVcondition
|
||||
if ( defined( $webArgs->{UVI} ) ) {
|
||||
readingsBulkUpdateIfChanged( $hash, "UVcondition",
|
||||
UConv::uvi2condition( $webArgs->{UVI} ) );
|
||||
my ( $v, $rgb ) = UConv::uvi2condition( $webArgs->{UVI} );
|
||||
readingsBulkUpdateIfChanged( $hash, "UVcondition", $v );
|
||||
readingsBulkUpdateIfChanged( $hash, "UVcondition_rgb", $rgb );
|
||||
}
|
||||
|
||||
# solarradiation in W/m2 (convert from lux)
|
||||
|
@ -420,21 +420,27 @@ sub humidity2condition($) {
|
||||
# Condition: convert UV-Index to UV condition
|
||||
sub uvi2condition($) {
|
||||
my ($data) = @_;
|
||||
my $v = "low";
|
||||
my $v = "low";
|
||||
my $rgb = "4C9329";
|
||||
|
||||
if ( $data > 11 ) {
|
||||
$v = "extreme";
|
||||
$v = "extreme";
|
||||
$rgb = "674BC4";
|
||||
}
|
||||
elsif ( $data > 8 ) {
|
||||
$v = "veryhigh";
|
||||
$v = "veryhigh";
|
||||
$rgb = "C72A23";
|
||||
}
|
||||
elsif ( $data > 6 ) {
|
||||
$v = "high";
|
||||
$v = "high";
|
||||
$rgb = "E7652B";
|
||||
}
|
||||
elsif ( $data > 3 ) {
|
||||
$v = "moderate";
|
||||
$v = "moderate";
|
||||
$rgb = "F4E54C";
|
||||
}
|
||||
|
||||
return ( $v, $rgb ) if (wantarray);
|
||||
return $v;
|
||||
}
|
||||
|
||||
@ -442,17 +448,17 @@ sub values2weathercondition($$$$$) {
|
||||
my ( $temp, $hum, $light, $isday, $israining ) = @_;
|
||||
my $condition = "clear";
|
||||
|
||||
if ( $israining eq "1" ) {
|
||||
if ($israining) {
|
||||
$condition = "rain";
|
||||
}
|
||||
elsif ( $light > 40000 ) {
|
||||
$condition = "sunny";
|
||||
}
|
||||
elsif ( $isday eq "1" ) {
|
||||
elsif ($isday) {
|
||||
$condition = "cloudy";
|
||||
}
|
||||
|
||||
$condition = "nt_" . $condition if ( !$isday );
|
||||
$condition = "nt_" . $condition unless ($isday);
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
@ -1327,6 +1327,16 @@ my $rtypes = {
|
||||
},
|
||||
},
|
||||
|
||||
# color
|
||||
rgb => {
|
||||
ref_base => 900,
|
||||
rtype_description => {
|
||||
de => 'RGB Farbwert',
|
||||
en => 'RGB color value',
|
||||
},
|
||||
scope => '^#?(([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2}))$',
|
||||
},
|
||||
|
||||
# logical operators
|
||||
bool => {
|
||||
ref_base => 26,
|
||||
@ -1334,7 +1344,7 @@ my $rtypes = {
|
||||
de => [ 'falsch', 'wahr' ],
|
||||
en => [ 'false', 'true' ],
|
||||
},
|
||||
scope => [ '^(false|no|0)$', '^(true|yes|1)$' ],
|
||||
scope => [ '^(false|n|no|0)$', '^(true|y|yes|1)$' ],
|
||||
rtype_description => {
|
||||
de => 'Boolesch wahr/falsch',
|
||||
en => 'Boolean true/false',
|
||||
|
Loading…
x
Reference in New Issue
Block a user