diff --git a/fhem/FHEM/00_KM271.pm b/fhem/FHEM/00_KM271.pm index 805e97c3d..8820bb625 100755 --- a/fhem/FHEM/00_KM271.pm +++ b/fhem/FHEM/00_KM271.pm @@ -10,7 +10,7 @@ package main; use strict; use warnings; -use Time::HiRes qw( time ); +use DevIo; my %km271_sets = ( "hk1_nachtsoll" => {SET => "07006565%02x656565:0702%02x", # 0.5 celsius @@ -60,6 +60,9 @@ my %km271_sets = ( OPT => ":slider,0,1,99"}, "logmode" => {SET => "EE0000", + OPT => ":noArg"}, + + "datetime" => {SET => "013FssmmhhDDMMYY", OPT => ":noArg"} ); @@ -373,7 +376,6 @@ KM271_Initialize($) { my $hash = shift; - require "$attr{global}{modpath}/FHEM/DevIo.pm"; $hash->{ReadFn} = "KM271_Read"; $hash->{ReadyFn} = "KM271_Ready"; @@ -627,6 +629,16 @@ KM271_Set($@) # Dirty trick: Changes of the timer are not notified by the heater, so internal notification is added after the colon $val = sprintf("%02x%s:%s%s", $offset, $val, $key, $val); } + + elsif($a[0] =~ m/^datetime$/) { + my @lt = localtime(); + $cmd = "0100%s:013f:%s"; + $val = sprintf("%02x%02x%02x%02x%02x%02x", + $lt[0], $lt[1], $lt[2], # Ignoring DST and Radio-Clock + $lt[3], + ($lt[4]+1) + (($lt[6] ? $lt[6] : 7) << 4), + $lt[5]); + } push @{$hash->{SENDBUFFER}}, sprintf($cmd, $val, $val); END_SET: @@ -827,13 +839,15 @@ KM271_Read($) elsif($f eq "mb") { $val += ReadingsVal($name, $key."1", 0) * 256; $val += ReadingsVal($name, $key."2", 0) * 65536 if($farg == 3); } - elsif($f eq "t") { $val = sprintf("%s | %s | %s", KM271_setprg($val, hex(substr($arg, ($off+1)*2, 2))) - , KM271_setprg(hex(substr($arg, ($off+2)*2, 2)), hex(substr($arg, ($off+3)*2, 2))) - , KM271_setprg(hex(substr($arg, ($off+4)*2, 2)), hex(substr($arg, ($off+5)*2, 2)))); - # Fill internal timer hash - $km271Timer->{$fn}{0} = substr($arg, 0, 4); - $km271Timer->{$fn}{1} = substr($arg, 4, 4); - $km271Timer->{$fn}{2} = substr($arg, 8, 4); } + elsif($f eq "t" && $arg) { # $arg is empty for the datetime ACK + $val = sprintf("%s | %s | %s", + KM271_setprg($val, hex(substr($arg, ($off+1)*2, 2))), + KM271_setprg(hex(substr($arg, ($off+2)*2, 2)), hex(substr($arg, ($off+3)*2, 2))), + KM271_setprg(hex(substr($arg, ($off+4)*2, 2)), hex(substr($arg, ($off+5)*2, 2)))); + # Fill internal timer hash + $km271Timer->{$fn}{0} = substr($arg, 0, 4); + $km271Timer->{$fn}{1} = substr($arg, 4, 4); + $km271Timer->{$fn}{2} = substr($arg, 8, 4); } elsif($f eq "eh") { $val = KM271_seterror($hash->{ERR_STATE}, substr($key, -1) -1, $arg); } } $key = ucfirst($key); # Hack to match the original and the fake reading @@ -1034,7 +1048,7 @@ KM271_SetReading($$$$) =item summary_DE Anbindung für Buderus Logamatic 2105/2107 Heizungssteuerung =begin html - +

KM271


- + Get
- + Attributes
- + Generated events: