some changes and fixes
- change: Perl modul math::round no longer necessary - change: reading round is now rnd_tmp, rnd_hum, rnd_bat - change: reading battery is now batterystate closes #8 - change: reading battery is now battery_level - fix: if GW has no SID reading stop - fix: if temperature is [1][0].xx or -[1][0].xx now the leading number is display -fix: if no or wrong data is reached data will be skipped - added: support switch 86sw2 dual_channel click
This commit is contained in:
@@ -50,7 +50,7 @@ use SetExtensions;
|
||||
sub XiaomiSmartHome_Notify($$);
|
||||
sub XiaomiSmartHome_updateSingleReading($$);
|
||||
my $iv="\x17\x99\x6d\x09\x3d\x28\xdd\xb3\xba\x69\x5a\x2e\x6f\x58\x56\x2e";
|
||||
my $version = "1.18";
|
||||
my $version = "1.19";
|
||||
my %XiaomiSmartHome_gets = (
|
||||
"getDevices" => ["get_id_list", '^.+get_id_list_ack' ],
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
my $version = "1.18";
|
||||
my $version = "1.19";
|
||||
sub XiaomiSmartHome_Device_updateSReading($);
|
||||
|
||||
|
||||
@@ -243,24 +243,30 @@ sub XiaomiSmartHome_Device_Read($$$){
|
||||
readingsBulkUpdate($hash, "battery_level", $bat, 1 );
|
||||
}
|
||||
if (defined $data->{temperature}){
|
||||
my $temp = sprintf( "%#.4d", $data->{temperature});
|
||||
$temp =~ s/(^[-+]?\d+?(?=(?>(?:\d{2})+)(?!\d))|\G\d{3}(?=\d))/$1./g;
|
||||
$temp = XiaomiSmartHome_round($temp, $XMIround_tmp, $name );
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Temperature: " . $temp . " Round: " . $XMIround_tmp;
|
||||
readingsBulkUpdate($hash, "temperature", "$temp", 1 );
|
||||
if ($data->{temperature} ne "10000"){
|
||||
my $temp = sprintf( "%#.4d", $data->{temperature});
|
||||
$temp =~ s/(^[-+]?\d+?(?=(?>(?:\d{2})+)(?!\d))|\G\d{3}(?=\d))/$1./g;
|
||||
$temp = XiaomiSmartHome_round($temp, $XMIround_tmp, $name );
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Temperature: " . $temp . " Round: " . $XMIround_tmp;
|
||||
readingsBulkUpdate($hash, "temperature", "$temp", 1 );
|
||||
}
|
||||
}
|
||||
if (defined $data->{humidity}){
|
||||
my $hum = $data->{humidity};
|
||||
$hum =~ s/(^[-+]?\d+?(?=(?>(?:\d{2})+)(?!\d))|\G\d{2}(?=\d))/$1./g;
|
||||
$hum = XiaomiSmartHome_round($hum, $XMIround_hum, $name );
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Humidity: " . $hum . " Round: " . $XMIround_hum;
|
||||
readingsBulkUpdate($hash, "humidity", "$hum", 1 );
|
||||
if ($data->{humidity} ne "0"){
|
||||
my $hum = $data->{humidity};
|
||||
$hum =~ s/(^[-+]?\d+?(?=(?>(?:\d{2})+)(?!\d))|\G\d{2}(?=\d))/$1./g;
|
||||
$hum = XiaomiSmartHome_round($hum, $XMIround_hum, $name );
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Humidity: " . $hum . " Round: " . $XMIround_hum;
|
||||
readingsBulkUpdate($hash, "humidity", "$hum", 1 );
|
||||
}
|
||||
}
|
||||
if (defined $data->{pressure}){
|
||||
my $pres = $data->{pressure};
|
||||
$pres =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1./g;
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Pressure: " . $pres;
|
||||
readingsBulkUpdate($hash, "pressure", "$pres", 1 );
|
||||
if ($data->{pressure} ne "0"){
|
||||
my $pres = $data->{pressure};
|
||||
$pres =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1./g;
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Pressure: " . $pres;
|
||||
readingsBulkUpdate($hash, "pressure", "$pres", 1 );
|
||||
}
|
||||
}
|
||||
if (defined $data->{lux}){
|
||||
my $lux = $data->{lux};
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
UPD 2017-12_08_13:29:11 36907 FHEM/71_XiaomiSmartHome.pm
|
||||
UPD 2017-12-08_13:28:54 26468 FHEM/71_XiaomiSmartHome_Device.pm
|
||||
UPD 2017-12_08_08:06:18 36907 FHEM/71_XiaomiSmartHome.pm
|
||||
UPD 2017-12-13_08:02:11 26609 FHEM/71_XiaomiSmartHome_Device.pm
|
||||
|
||||
Reference in New Issue
Block a user