add: new reading ilumination and proto_version

This commit is contained in:
2017-05-04 19:34:19 +02:00
parent 0ef309015b
commit e51a88c85b
2 changed files with 8 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ sub XiaomiSmartHome_Notify($$);
sub XiaomiSmartHome_updateSingleReading($$);
sub XiaomiSmartHome_updateAllReadings($);
my $iv="\x17\x99\x6d\x09\x3d\x28\xdd\xb3\xba\x69\x5a\x2e\x6f\x58\x56\x2e";
my $version = "0.22";
my $version = "0.23";
my %XiaomiSmartHome_gets = (
"getDevices" => ["get_id_list", '^.+get_id_list_ack' ],
@@ -124,10 +124,15 @@ sub XiaomiSmartHome_Read($) {
if ($decoded->{'model'} && $decoded->{'model'} eq 'gateway' ){
if ($decoded->{'cmd'} eq 'report'){
my $data = decode_json($decoded->{data});
Log3 $name, 5, "$name: Read>" . " Data: " . $data ;
if (defined $data->{rgb}){
Log3 $name, 3, "$name: Read>" . " SID: " . $decoded->{'sid'} . " Type: Gateway" . " RGB: " . $data->{rgb} ;
readingsBulkUpdate($hash, "RGB", $data->{rgb} , 1 );
}
if (defined $data->{illumination}){
Log3 $name, 3, "$name: Read>" . " SID: " . $decoded->{'sid'} . " Type: Gateway" . " Illumination: " . $data->{illumination} ;
readingsBulkUpdate($hash, "illumination", $data->{illumination} , 1 );
}
}
elsif ($decoded->{'cmd'} eq 'heartbeat'){
my $data = decode_json($decoded->{data});
@@ -148,6 +153,7 @@ sub XiaomiSmartHome_Read($) {
}
else {
readingsBulkUpdate($hash, 'heartbeat', "Write_OK", 1 );
readingsBulkUpdate($hash, "proto_version", $data->{proto_version} , 1 );
}
}
readingsEndUpdate( $hash, 1 );

View File

@@ -1,2 +1,2 @@
UPD 2017-05-03_19:53:18 22990 FHEM/71_XiaomiSmartHome.pm
UPD 2017-05-04_19:31:19 23384 FHEM/71_XiaomiSmartHome.pm
UPD 2017-05-01_13:14:43 11699 FHEM/71_XiaomiSmartHome_Device.pm