59_WUup: added attribute unit_solarradiation

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@17147 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mahowi 2018-08-15 15:38:43 +00:00
parent d218845856
commit 743ffd67d8
2 changed files with 22 additions and 6 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- feature: 59_WUup: added attribute unit_solarradiation
- bugfix: 38_netatmo: removed heating home/room autocreate - bugfix: 38_netatmo: removed heating home/room autocreate
- feature: 46_SmartPi: exchange commandref, add NotifyFn - feature: 46_SmartPi: exchange commandref, add NotifyFn
- new: 00_MQTT2_SERVER / 10_MQTT2_DEVICE - new: 00_MQTT2_SERVER / 10_MQTT2_DEVICE

View File

@ -32,7 +32,7 @@ use Time::HiRes qw(gettimeofday);
use HttpUtils; use HttpUtils;
use UConv; use UConv;
my $version = "0.9.8"; my $version = "0.9.9";
# Declare functions # Declare functions
sub WUup_Initialize($); sub WUup_Initialize($);
@ -62,6 +62,7 @@ sub WUup_Initialize($) {
. "disabledForIntervals " . "disabledForIntervals "
. "interval " . "interval "
. "unit_windspeed:km/h,m/s " . "unit_windspeed:km/h,m/s "
. "unit_solarradiation:W/m²,lux "
. "round " . "round "
. "wubaromin wudailyrainin wudewptf wuhumidity wurainin wusoilmoisture " . "wubaromin wudailyrainin wudewptf wuhumidity wurainin wusoilmoisture "
. "wusoiltempf wusolarradiation wutempf wuUV wuwinddir wuwinddir_avg2m " . "wusoiltempf wusolarradiation wutempf wuUV wuwinddir wuwinddir_avg2m "
@ -96,6 +97,8 @@ sub WUup_Define($$$) {
$attr{$name}{room} = "Weather" if ( !defined( $attr{$name}{room} ) ); $attr{$name}{room} = "Weather" if ( !defined( $attr{$name}{room} ) );
$attr{$name}{unit_windspeed} = "km/h" $attr{$name}{unit_windspeed} = "km/h"
if ( !defined( $attr{$name}{unit_windspeed} ) ); if ( !defined( $attr{$name}{unit_windspeed} ) );
$attr{$name}{unit_solarradiation} = "lux"
if ( !defined( $attr{$name}{unit_solarradiation} ) );
$attr{$name}{round} = 4 if ( !defined( $attr{$name}{round} ) ); $attr{$name}{round} = 4 if ( !defined( $attr{$name}{round} ) );
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
@ -230,6 +233,9 @@ sub WUup_send($) {
$attr{$name}{unit_windspeed} = "km/h" $attr{$name}{unit_windspeed} = "km/h"
if ( !defined( $attr{$name}{unit_windspeed} ) ); if ( !defined( $attr{$name}{unit_windspeed} ) );
$attr{$name}{unit_solarradiation} = "lux"
if ( !defined( $attr{$name}{unit_solarradiation} ) );
$attr{$name}{round} = 4 if ( !defined( $attr{$name}{round} ) ); $attr{$name}{round} = 4 if ( !defined( $attr{$name}{round} ) );
my ( $data, $d, $r, $o ); my ( $data, $d, $r, $o );
@ -265,7 +271,14 @@ sub WUup_send($) {
$value = UConv::mm2in( $value, $rnd ); $value = UConv::mm2in( $value, $rnd );
} }
elsif ( $key eq "solarradiation" ) { elsif ( $key eq "solarradiation" ) {
$value = ( $value / 126.7 );
if ( $attr{$name}{unit_solarradiation} eq "lux" ) {
Log3 $name, 5, "WUup ($name) - solarradiation unit is lux";
$value = ( $value / 126.7 );
}
else {
Log3 $name, 5, "WUup ($name) - solarradiation unit is W/m²";
}
} }
$data .= "&$key=$value"; $data .= "&$key=$value";
} }
@ -355,6 +368,7 @@ sub WUup_receive($) {
# 2018-03-19 solarradiation calculated from lux to W/m² (thanks to dieter114) # 2018-03-19 solarradiation calculated from lux to W/m² (thanks to dieter114)
# 2018-04-10 added attribute round # 2018-04-10 added attribute round
# 2018-04-13 added AqPM2.5 and AqPM10 # 2018-04-13 added AqPM2.5 and AqPM10
# 2018-08-15 added attribute unit_solarradiation
# #
################################################################################ ################################################################################
@ -408,6 +422,7 @@ sub WUup_receive($) {
<li><b>disable</b> - disables the module</li> <li><b>disable</b> - disables the module</li>
<li><b><a href="#disabledForIntervals">disabledForIntervals</a></b></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> <li><b>unit_windspeed</b> - change the units of your windspeed readings (m/s or km/h)</li>
<li><b>unit_solarradiation</b> - change the units of your solarradiation readings (lux or W/m&sup2;)</li>
<li><b>round</b> - round values to this number of decimals for calculation (default 4)</li> <li><b>round</b> - round values to this number of decimals for calculation (default 4)</li>
<li><b>wu....</b> - Attribute name corresponding to <li><b>wu....</b> - Attribute name corresponding to
<a href="http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol">parameter name from api.</a> <a href="http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol">parameter name from api.</a>
@ -419,8 +434,7 @@ sub WUup_receive($) {
network as parameter "tempf" (which indicates current temperature) network as parameter "tempf" (which indicates current temperature)
<br/> <br/>
Units get converted to angloamerican system automatically Units get converted to angloamerican system automatically
(&deg;C -> &deg;F; km/h(m/s) -> mph; mm -> in; hPa -> inHg)<br/> (&deg;C -> &deg;F; km/h(m/s) -> mph; mm -> in; hPa -> inHg)<br/><br/>
Solarradiation takes readings in lux and converts them to W/m&sup2;<br/><br/>
<u>The following information is supported:</u> <u>The following information is supported:</u>
<ul> <ul>
<li>winddir - instantaneous wind direction (0-360) [&deg;]</li> <li>winddir - instantaneous wind direction (0-360) [&deg;]</li>
@ -511,6 +525,8 @@ sub WUup_receive($) {
<li><b><a href="#disabledForIntervals">disabledForIntervals</a></b></li> <li><b><a href="#disabledForIntervals">disabledForIntervals</a></b></li>
<li><b>unit_windspeed</b> - gibt die Einheit der Readings für die <li><b>unit_windspeed</b> - gibt die Einheit der Readings für die
Windgeschwindigkeiten an (m/s oder km/h)</li> Windgeschwindigkeiten an (m/s oder km/h)</li>
<li><b>unit_solarradiation</b> - gibt die Einheit der Readings für die
Sonneneinstrahlung an (lux oder W/m&sup2;)</li>
<li><b>round</b> - Anzahl der Nachkommastellen zur Berechnung (Standard 4)</li> <li><b>round</b> - Anzahl der Nachkommastellen zur Berechnung (Standard 4)</li>
<li><b>wu....</b> - Attributname entsprechend dem <li><b>wu....</b> - Attributname entsprechend dem
<a href="http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol">Parameternamen aus der API.</a><br /> <a href="http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol">Parameternamen aus der API.</a><br />
@ -521,8 +537,7 @@ sub WUup_receive($) {
(welches die aktuelle Temperatur angibt). (welches die aktuelle Temperatur angibt).
<br /> <br />
Einheiten werden automatisch ins anglo-amerikanische System umgerechnet. Einheiten werden automatisch ins anglo-amerikanische System umgerechnet.
(&deg;C -> &deg;F; km/h(m/s) -> mph; mm -> in; hPa -> inHg)<br/> (&deg;C -> &deg;F; km/h(m/s) -> mph; mm -> in; hPa -> inHg)<br/><br/>
Solarradiation nimmt Readings in lux an und rechnet diese in W/m&sup2; um.<br/><br/>
<u>Unterst&uuml;tzte Angaben</u> <u>Unterst&uuml;tzte Angaben</u>
<ul> <ul>
<li>winddir - momentane Windrichtung (0-360) [&deg;]</li> <li>winddir - momentane Windrichtung (0-360) [&deg;]</li>