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
- 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
- added: support switch 86sw2 dual_channel click
This commit is contained in:
2017-12-08 13:44:47 +01:00
parent 5e4194c5c1
commit 0a9738f543
3 changed files with 51 additions and 21 deletions

View File

@@ -40,8 +40,7 @@ eval "use Crypt::CBC";
return "\nERROR: Please install Crypt::CBC" if($@);
eval "use Net::Ping";
return "\nERROR: Please install Net::Ping" if($@);
eval "use Math::Round";
return "\nERROR: Please install libmath-round-perl" if($@);
use Color;
use SetExtensions;
@@ -51,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.15";
my $version = "1.18";
my %XiaomiSmartHome_gets = (
"getDevices" => ["get_id_list", '^.+get_id_list_ack' ],
@@ -114,10 +113,13 @@ sub XiaomiSmartHome_Read($) {
my ($hash) = @_;
my $name = $hash->{NAME};
my $self = {}; # my new hash
my $new_hash = {};
Log3 $name, 5, "$name: Read> Read start";
my $buf = "";
if ( ! $hash->{SID} ){
Log3 $name, 3, "$name: Read> No SID, Stop Read";
return;
}
my $buf = "";
my $ret = sysread($hash->{CD}, $buf, 1024);
if (!defined($ret) || $ret <= 0)
{