mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
HP1000: add humidityCondition_rgb and indoorHumidityCondition_rgb
git-svn-id: https://svn.fhem.de/fhem/trunk@13995 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a6daac6bc6
commit
26e32e8741
@ -163,29 +163,31 @@ sub HP1000_Initialize($) {
|
||||
|
||||
# Unit.pm support
|
||||
$hash->{readingsDesc} = {
|
||||
'Activity' => { rtype => 'oknok', },
|
||||
'UV' => { rtype => 'uvi', },
|
||||
'UVR' => { rtype => 'uwpscm', },
|
||||
'UVcondition' => { rtype => 'condition_uvi', },
|
||||
'UVcondition_rgb' => { rtype => 'rgbhex', },
|
||||
'battery' => { rtype => 'oknok', },
|
||||
'condition' => { rtype => 'condition_weather', },
|
||||
'daylight' => { rtype => 'yesno', },
|
||||
'dewpoint' => { rtype => 'c', formula_symbol => 'Td', },
|
||||
'dewpoint_f' => { rtype => 'f', formula_symbol => 'Td', },
|
||||
'extsrv_state' => { rtype => 'oknok', },
|
||||
'humidity' => { rtype => 'pct', formula_symbol => 'H', },
|
||||
'humidityAbs' => { rtype => 'c', formula_symbol => 'Tabs', },
|
||||
'humidityAbs_f' => { rtype => 'f', formula_symbol => 'Tabs', },
|
||||
'humidityCondition' => { rtype => 'condition_hum', },
|
||||
'indoorDewpoint' => { rtype => 'c', formula_symbol => 'Tdi', },
|
||||
'indoorDewpoint_f' => { rtype => 'f', formula_symbol => 'Tdi', },
|
||||
'indoorHumidity' => { rtype => 'pct', formula_symbol => 'Hi', },
|
||||
'indoorHumidityAbs' => { rtype => 'c', formula_symbol => 'Tabsi', },
|
||||
'indoorHumidityAbs_f' => { rtype => 'f', formula_symbol => 'Tabsi', },
|
||||
'indoorHumidityCondition' => { rtype => 'condition_hum', },
|
||||
'indoorTemperature' => { rtype => 'c', formula_symbol => 'Ti', },
|
||||
'indoorTemperature_f' => { rtype => 'f', formula_symbol => 'Ti', },
|
||||
'Activity' => { rtype => 'oknok', },
|
||||
'UV' => { rtype => 'uvi', },
|
||||
'UVR' => { rtype => 'uwpscm', },
|
||||
'UVcondition' => { rtype => 'condition_uvi', },
|
||||
'UVcondition_rgb' => { rtype => 'rgbhex', },
|
||||
'battery' => { rtype => 'oknok', },
|
||||
'condition' => { rtype => 'condition_weather', },
|
||||
'daylight' => { rtype => 'yesno', },
|
||||
'dewpoint' => { rtype => 'c', formula_symbol => 'Td', },
|
||||
'dewpoint_f' => { rtype => 'f', formula_symbol => 'Td', },
|
||||
'extsrv_state' => { rtype => 'oknok', },
|
||||
'humidity' => { rtype => 'pct', formula_symbol => 'H', },
|
||||
'humidityAbs' => { rtype => 'c', formula_symbol => 'Tabs', },
|
||||
'humidityAbs_f' => { rtype => 'f', formula_symbol => 'Tabs', },
|
||||
'humidityCondition' => { rtype => 'condition_hum', },
|
||||
'humidityCondition_rgb' => { rtype => 'rgbhex', },
|
||||
'indoorDewpoint' => { rtype => 'c', formula_symbol => 'Tdi', },
|
||||
'indoorDewpoint_f' => { rtype => 'f', formula_symbol => 'Tdi', },
|
||||
'indoorHumidity' => { rtype => 'pct', formula_symbol => 'Hi', },
|
||||
'indoorHumidityAbs' => { rtype => 'c', formula_symbol => 'Tabsi', },
|
||||
'indoorHumidityAbs_f' => { rtype => 'f', formula_symbol => 'Tabsi', },
|
||||
'indoorHumidityCondition' => { rtype => 'condition_hum', },
|
||||
'indoorHumidityCondition_rgb' => { rtype => 'rgbhex', },
|
||||
'indoorTemperature' => { rtype => 'c', formula_symbol => 'Ti', },
|
||||
'indoorTemperature_f' => { rtype => 'f', formula_symbol => 'Ti', },
|
||||
'israining' => { rtype => 'yesno', },
|
||||
'luminosity' => { rtype => 'lx', },
|
||||
'pressure' => { rtype => 'hpamb', },
|
||||
@ -816,14 +818,17 @@ sub HP1000_CGI() {
|
||||
|
||||
# humidityCondition
|
||||
if ( defined( $webArgs->{outhumi} ) ) {
|
||||
readingsBulkUpdateIfChanged( $hash, "humidityCondition",
|
||||
UConv::humidity2condition( $webArgs->{outhumi} ) );
|
||||
my ( $v, $rgb ) = UConv::humidity2condition( $webArgs->{outhumi} );
|
||||
readingsBulkUpdateIfChanged( $hash, "humidityCondition", $v );
|
||||
readingsBulkUpdateIfChanged( $hash, "humidityCondition_rgb", $rgb );
|
||||
}
|
||||
|
||||
# indoorHumidityCondition
|
||||
if ( defined( $webArgs->{inhumi} ) ) {
|
||||
readingsBulkUpdateIfChanged( $hash, "indoorHumidityCondition",
|
||||
UConv::humidity2condition( $webArgs->{inhumi} ) );
|
||||
my ( $v, $rgb ) = UConv::humidity2condition( $webArgs->{inhumi} );
|
||||
readingsBulkUpdateIfChanged( $hash, "indoorHumidityCondition", $v );
|
||||
readingsBulkUpdateIfChanged( $hash, "indoorHumidityCondition_rgb",
|
||||
$rgb );
|
||||
}
|
||||
|
||||
if ( defined( $webArgs->{UV} ) ) {
|
||||
|
@ -423,20 +423,26 @@ sub mph2bft($) {
|
||||
sub humidity2condition($) {
|
||||
my ($data) = @_;
|
||||
my $v = "dry";
|
||||
my $rgb = "C72A23";
|
||||
|
||||
if ( $data >= 80 ) {
|
||||
$v = "wet";
|
||||
$rgb = "0066CC";
|
||||
}
|
||||
elsif ( $data >= 70 ) {
|
||||
$v = "high";
|
||||
$rgb = "009999";
|
||||
}
|
||||
elsif ( $data >= 50 ) {
|
||||
$v = "optimal";
|
||||
$rgb = "4C9329";
|
||||
}
|
||||
elsif ( $data >= 40 ) {
|
||||
$v = "low";
|
||||
$rgb = "E7652B";
|
||||
}
|
||||
|
||||
return ( $v, $rgb ) if (wantarray);
|
||||
return $v;
|
||||
}
|
||||
|
||||
@ -469,21 +475,20 @@ sub uvi2condition($) {
|
||||
|
||||
sub values2weathercondition($$$$$) {
|
||||
my ( $temp, $hum, $light, $isday, $israining ) = @_;
|
||||
my $condition = "clear";
|
||||
my $v = "clear";
|
||||
|
||||
if ($israining) {
|
||||
$condition = "rain";
|
||||
$v = "rain";
|
||||
}
|
||||
elsif ( $light > 40000 ) {
|
||||
$condition = "sunny";
|
||||
$v = "sunny";
|
||||
}
|
||||
elsif ($isday) {
|
||||
$condition = "cloudy";
|
||||
$v = "cloudy";
|
||||
}
|
||||
|
||||
$condition = "nt_" . $condition unless ($isday);
|
||||
|
||||
return $condition;
|
||||
$v = "nt_" . $v unless ($isday);
|
||||
return $v;
|
||||
}
|
||||
|
||||
#TODO rewrite for Unit.pm
|
||||
|
Loading…
x
Reference in New Issue
Block a user