From d861e65de814655511c9ecb14efbbb72c26cda92 Mon Sep 17 00:00:00 2001 From: mgehre <> Date: Thu, 3 Jan 2013 14:02:49 +0000 Subject: [PATCH] MAX: Add experimental support for PushButton git-svn-id: https://svn.fhem.de/fhem/trunk@2416 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_MAX.pm | 14 ++++++++++++++ fhem/FHEM/14_CUL_MAX.pm | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/10_MAX.pm b/fhem/FHEM/10_MAX.pm index 5eb590fe6..2669325e9 100755 --- a/fhem/FHEM/10_MAX.pm +++ b/fhem/FHEM/10_MAX.pm @@ -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 { diff --git a/fhem/FHEM/14_CUL_MAX.pm b/fhem/FHEM/14_CUL_MAX.pm index 54d949e3b..5d83cf085 100644 --- a/fhem/FHEM/14_CUL_MAX.pm +++ b/fhem/FHEM/14_CUL_MAX.pm @@ -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}) {