2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 13:24:56 +00:00

MAX: Add experimental support for PushButton

git-svn-id: https://svn.fhem.de/fhem/trunk@2416 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre 2013-01-03 14:02:49 +00:00
parent bfdb6a2fb9
commit d861e65de8
2 changed files with 15 additions and 1 deletions

View File

@ -39,6 +39,7 @@ use vars qw(%msgCmd2Id);
"11" => "ConfigTemperatures", #like boost/eco/comfort etc
"30" => "ShutterContactState",
"42" => "WallThermostatState", #by WallMountedThermostat
"50" => "PushButtonState",
"60" => "ThermostatState", #by HeatingThermostat
"40" => "SetTemperature", #to thermostat
"20" => "AddLinkPartner",
@ -424,6 +425,17 @@ MAX_Parse($$)
readingsBulkUpdate($shash,"onoff",$isopen);
readingsEndUpdate($shash, 1);
}elsif($msgtype eq "PushButtonState") {
my ($bits2, $onoff) = unpack("CC",pack("H*",$args[0]));
#The meaning of $bits2 is completly guessed based on similarity to other devices, TODO: confirm
my $rferror = vec($bits2, 6, 1); #communication with link partner (what does that mean?)
my $batterylow = vec($bits2, 7, 1); #1 if battery is low
readingsBeginUpdate($shash);
readingsBulkUpdate($shash, "battery", $batterylow ? "low" : "ok");
readingsBulkUpdate($shash,"onoff",$onoff);
readingsEndUpdate($shash, 0);
}elsif($msgtype eq "CubeClockState"){
my $clockset = $args[0];
$shash->{clocknotset} = !$clockset;
@ -466,6 +478,8 @@ MAX_Parse($$)
return MAX_Parse($hash, "MAX,$isToMe,ThermostatState,$addr,". substr($args[0],2));
} elsif($shash->{type} eq "ShutterContact") {
return MAX_Parse($hash, "MAX,$isToMe,ShutterContactState,$addr,". substr($args[0],2));
} elsif($shash->{type} eq "PushButton") {
return MAX_Parse($hash, "MAX,$isToMe,PushButtonState,$addr,". substr($args[0],2));
} elsif($shash->{type} eq "Cube") {
; #Payload is always "00"
} else {

View File

@ -211,7 +211,7 @@ CUL_MAX_Parse($$)
#TODO: send TimeInformation
}
} elsif($msgType ~~ ["ShutterContactState", "WallThermostatState", "ThermostatState"]) {
} elsif($msgType ~~ ["ShutterContactState", "WallThermostatState", "ThermostatState", "PushButtonState"]) {
Dispatch($shash, "MAX,$isToMe,$msgType,$src,$payload", {RAWMSG => $rmsg});
#Only ShutterContactState needs ack
if($msgType eq "ShutterContactState" and $dst eq $shash->{addr}) {