UConv: update for HP1000

git-svn-id: https://svn.fhem.de/fhem/trunk@13994 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2017-04-14 23:18:47 +00:00
parent 489807e4c5
commit a6daac6bc6
2 changed files with 52 additions and 1 deletions

View File

@ -154,6 +154,12 @@ sub kph2mph($;$) {
return roundX( $data * 0.621, $rnd );
}
# Speed: convert m/s (meter per seconds) to mph (miles per hour)
sub mps2mph($;$) {
my ( $data, $rnd ) = @_;
return roundX( kph2mph( mps2kph( $data, 9 ), 9 ), $rnd );
}
# Length: convert mm (milimeter) to in (inch)
sub mm2in($;$) {
my ( $data, $rnd ) = @_;
@ -222,6 +228,12 @@ sub mph2kph($;$) {
return roundX( $data * 1.609344, $rnd );
}
# Speed: convert mph (miles per hour) to m/s (meter per seconds)
sub mph2mps($;$) {
my ( $data, $rnd ) = @_;
return roundX( kph2mps( mph2kph( $data, 9 ), 9 ), $rnd );
}
# Length: convert in (inch) to mm (milimeter)
sub in2mm($;$) {
my ( $data, $rnd ) = @_;
@ -270,6 +282,8 @@ sub direction2compasspoint($;$) {
sub uwpscm2uvi($;$) {
my ( $data, $rnd ) = @_;
return 0 unless ($data);
# Forum topic,44403.msg501704.html#msg501704
return int( ( $data - 100 ) / 450 + 1 ) unless ( defined($rnd) );
@ -281,6 +295,7 @@ sub uwpscm2uvi($;$) {
sub uvi2uwpscm($) {
my ($data) = @_;
return 0 unless ($data);
return ( $data * ( 450 + 1 ) ) + 100;
}
@ -292,6 +307,14 @@ sub lux2wpsm($;$) {
return roundX( $data / 126.7, $rnd );
}
# Power: convert W/m2 to lux
sub wpsm2lux($;$) {
my ( $data, $rnd ) = @_;
# Forum topic,44403.msg501704.html#msg501704
return roundX( $data * 126.7, $rnd );
}
#################################
### Nautic unit conversions
###

View File

@ -1374,7 +1374,7 @@ my $rtypes = {
},
},
# numbering
# decimal numbering
short => {
ref_base => 25,
format => '%i',
@ -1459,6 +1459,33 @@ my $rtypes = {
scope => { minValue => 0, maxValue => 100 },
},
# binary numbering
bin => {
rtype_description => {
de => 'Binärnummer',
en => 'Binary number',
},
scope => '^[01]+$',
},
# octal numbering
oct => {
rtype_description => {
de => 'Oktalnummer',
en => 'Octal number',
},
scope => '^[0-7]+$',
},
# hexadecimal numbering
hex => {
rtype_description => {
de => 'Hexadezimalnummer',
en => 'Hexadecimal number',
},
scope => '^[0-9a-fA-F]+$',
},
# currency
#https://en.wikipedia.org/wiki/Euro
@ -1661,6 +1688,7 @@ my $rtypes = {
inhg => {
ref_base => 12,
suffix => 'inHg',
format => '%.2f',
txt => {
de => 'Zoll Quecksilbersäule',
en => 'Inches of Mercury',