added new Aqara Human body motion sensor
added Aqara Human body motion sensor to supported devices and added reading "lux". TODO: motionOffTimer needs to be set to 5 by default.
This commit is contained in:
@@ -49,7 +49,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.07";
|
||||
my $version = "1.08";
|
||||
my %XiaomiSmartHome_gets = (
|
||||
"getDevices" => ["get_id_list", '^.+get_id_list_ack' ],
|
||||
|
||||
@@ -101,7 +101,8 @@ sub XiaomiSmartHome_Initialize($) {
|
||||
"15:XiaomiSmartHome_Device" => "^.+86plug",
|
||||
"16:XiaomiSmartHome_Device" => "^.+natgas",
|
||||
"17:XiaomiSmartHome_Device" => "^.+smoke",
|
||||
"18:XiaomiSmartHome_Device" => "^.+weather.v1"};
|
||||
"18:XiaomiSmartHome_Device" => "^.+weather.v1",
|
||||
"19:XiaomiSmartHome_Device" => "^.+sensor_motion.aq2"};
|
||||
FHEM_colorpickerInit();
|
||||
}
|
||||
#####################################
|
||||
@@ -859,7 +860,9 @@ sub XiaomiSmartHome_updateAllReadings($)
|
||||
<ul>
|
||||
<li>magnet: Window/Door magnetic sensor</li>
|
||||
<li>motion: Human body motion sensor</li>
|
||||
<li>sensor_ht: Temperatur and humidity sensor</li>
|
||||
<li>sensor_motion.aq2: Aqara Human body motion sensor with lux readings</li>
|
||||
<li>sensor_ht: Temperature and humidity sensor</li>
|
||||
<li>weather.v1: Aqara Temperature, pressure and humidity sensor</li>
|
||||
<li>switch: Wireless sensor switch</li>
|
||||
<li>plug & 86plug: Smart socket</li>
|
||||
<li>cube: Cube sensor</li>
|
||||
@@ -908,7 +911,7 @@ sub XiaomiSmartHome_updateAllReadings($)
|
||||
<ul>
|
||||
<li>motionOffTimer: (only motionsensor)
|
||||
<br/>You can set a motion Off Timer Attribut on the motion sensor device. You can set 1, 5 or 10 seconds after
|
||||
<br/>the motion sensors will automatically set to off.
|
||||
<br/>the motion sensors will automatically set to off. MotionOffTimer is set to 5 by default.
|
||||
<br/>Background: The motionsensors does not send off immediately.
|
||||
<br/>The Motionsensor send a no_motion after 120, 180, 300, 600, 1200 seconds no motion is detected.</li>
|
||||
<li>Power: (only smart soket) on off switch a plug on or off</li>
|
||||
|
||||
@@ -25,7 +25,7 @@ package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $version = "1.07";
|
||||
my $version = "1.08";
|
||||
sub XiaomiSmartHome_Device_updateSReading($);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ sub XiaomiSmartHome_Device_Initialize($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
|
||||
$hash->{Match} = "^.+magnet|motion|sensor_ht|switch|plug|cube|86sw1|86sw2|ctrl_neutral1|ctrl_neutral2|rgbw_light|curtain|ctrl_ln1|ctrl_ln2|86plug|natgas|smoke|weather.v1";
|
||||
$hash->{Match} = "^.+magnet|motion|sensor_ht|switch|plug|cube|86sw1|86sw2|ctrl_neutral1|ctrl_neutral2|rgbw_light|curtain|ctrl_ln1|ctrl_ln2|86plug|natgas|smoke|weather.v1|sensor_motion.aq2";
|
||||
$hash->{DefFn} = "XiaomiSmartHome_Device_Define";
|
||||
$hash->{SetFn} = "XiaomiSmartHome_Device_Set";
|
||||
$hash->{UndefFn} = "XiaomiSmartHome_Device_Undef";
|
||||
@@ -63,7 +63,7 @@ sub XiaomiSmartHome_Device_Set($@)
|
||||
return "\"set $name\" needs at least one argument" unless(defined($cmd));
|
||||
|
||||
my $setlist = "";
|
||||
$setlist .= "motionOffTimer:1,5,10 " if ($hash->{MODEL} eq 'motion');
|
||||
$setlist .= "motionOffTimer:1,5,10 " if ($hash->{MODEL} eq 'motion'||'sensor_motion.aq2');
|
||||
#$setlist = "open:noArg close:noArg " if ($hash->{MODEL} eq 'magnet');
|
||||
$setlist .= "power:on,off " if ($hash->{MODEL} eq 'plug');
|
||||
$setlist .= "power:on,off " if ($hash->{MODEL} eq '86plug');
|
||||
@@ -207,7 +207,7 @@ sub XiaomiSmartHome_Device_Read($$$){
|
||||
if (defined $data->{status}){
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Status: " . $data->{status};
|
||||
readingsBulkUpdate($hash, "state", "$data->{status}", 1 );
|
||||
if ($data->{status} eq 'motion' && $hash->{MODEL} eq 'motion'){
|
||||
if ($data->{status} eq 'motion' && $hash->{MODEL} eq 'motion'||'sensor_motion.aq2'){
|
||||
readingsBulkUpdate($hash, "no_motion", "0", 1 );
|
||||
}
|
||||
if ($data->{status} eq 'close' && $hash->{MODEL} eq 'magnet'){
|
||||
@@ -245,6 +245,11 @@ sub XiaomiSmartHome_Device_Read($$$){
|
||||
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};
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Illuminance: " . $lux;
|
||||
readingsBulkUpdate($hash, "lux", "$lux", 1 );
|
||||
}
|
||||
#86sw1 + 86sw2 + ctrl_neutral1 + ctrl_neutral2 start
|
||||
if (defined $data->{channel_0}){
|
||||
Log3 $name, 3, "$name: DEV_Read>" . " Name: " . $hash->{NAME} . " SID: " . $sid . " Type: " . $hash->{MODEL} . " Channel_0: " . $data->{channel_0};
|
||||
@@ -357,7 +362,7 @@ sub XiaomiSmartHome_Device_update($){
|
||||
my $model = $hash->{MODEL};
|
||||
my $name = $hash->{NAME};
|
||||
my $value_fn = AttrVal( $name, "valueFn", "" );
|
||||
#my $mot = AttrVal( $name, "motionOffTimer", "" );
|
||||
#my $mot = AttrVal( $name, "motionOffTimer", "5" );
|
||||
my $mot = $hash->{READINGS}{motionOffTimer}{VAL} if ($hash->{READINGS}{motionOffTimer});
|
||||
if( $value_fn =~ m/^{.*}$/s ) {
|
||||
|
||||
@@ -367,7 +372,7 @@ sub XiaomiSmartHome_Device_update($){
|
||||
Log3 $name, 3, $name .": DEV_Update valueFn: ". $@ if($@);
|
||||
return undef if( !defined($value_fn) );
|
||||
}
|
||||
if( $model eq 'motion') {
|
||||
if( $model eq 'motion'||'sensor_motion.aq2') {
|
||||
XiaomiSmartHome_Device_mot($hash, $hash->{READINGS}{motionOffTimer}{VAL}) if( $hash->{READINGS}{motionOffTimer});
|
||||
}
|
||||
# Update delete old reading Voltage
|
||||
@@ -402,7 +407,7 @@ sub XiaomiSmartHome_Device_Define($$) {
|
||||
|
||||
Log3 $name, 4, $iodev . ": DEV_Define> " . $name . ": defined as ". $hash->{MODEL};
|
||||
$attr{$name}{room} = "MiSmartHome" if( !defined( $attr{$name}{room} ) );
|
||||
if( $type eq 'motion') {
|
||||
if( $type eq 'motion'||'sensor_motion.aq2') {
|
||||
$attr{$name}{devStateIcon} = 'motion:motion_detector@red off:motion_detector@green no_motion:motion_detector@green' if( !defined( $attr{$name}{devStateIcon} ) );
|
||||
}
|
||||
elsif ( $type eq 'magnet') {
|
||||
@@ -568,7 +573,9 @@ sub XiaomiSmartHome_Device_Undef($)
|
||||
<ul>
|
||||
<li>magnet: Magnetischer Fenster/Tür Sensor</li>
|
||||
<li>motion: Bewegungsmelder</li>
|
||||
<li>sensor_motion.aq2: Aqara Bewegungsmelder mit lux-Messung</li>
|
||||
<li>sensor_ht: Temperatur und Luftdruck</li>
|
||||
<li>weather.v1: Aqara Temperatur, Luftdruck und Feuchtigkeit</li>
|
||||
<li>switch: Funkschalter</li>
|
||||
<li>plug: Schaltbare Funksteckdose</li>
|
||||
<li>cube: Würfel Sensor</li>
|
||||
@@ -600,7 +607,7 @@ sub XiaomiSmartHome_Device_Undef($)
|
||||
<ul>
|
||||
<li>motionOffTimer: (nur Bewegungsmelder)
|
||||
<br/>Durch setzen des Parameters ist es möglich das das Reading des Bewegungsmelder nach 1, 5 oder 10 Sekunden
|
||||
<br/>automatisch wieder auf off gestellt wird.
|
||||
<br/>automatisch wieder auf off gestellt wird. Standardmäßig ist dieser Wert auf 5 gestellt, sodass der Sensor alle 5 Sekunden auf eine erneute Bewegung reagiert.
|
||||
<br/>Hintergrund: Der Bewegungsmelder sendet kein selber kein off.
|
||||
<br/>Der Bewegungsmelder sendet no_motion nach 120, 180, 300, 600, 1200 Sekunden wenn keine Bewegung festgestellt wurde.</li>
|
||||
<li>Power: (nur Funksteckdose) on off Funktsteckdose ein oder ausschalten</li>
|
||||
|
||||
Reference in New Issue
Block a user