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
KM271 is the name of the communication device for the Buderus Logamatic 2105
@@ -1048,7 +1062,7 @@ KM271_SetReading($$$$)
Note: this module requires the Device::SerialPort or Win32::SerialPort module.
-
+
Define
define <name> KM271 <serial-device-name>
@@ -1060,36 +1074,45 @@ KM271_SetReading($$$$)
-
+
Set
set KM271 <param> [<value> [<values>]]
where param is one of:
+
- hk1_tagsoll <temp>
sets the by day temperature for heating circuit 1
0.5 celsius resolution - temperature between 10 and 30 celsius
+
- hk2_tagsoll <temp>
sets the by day temperature for heating circuit 2
(see above)
+
- hk1_nachtsoll <temp>
sets the by night temperature for heating circuit 1
(see above)
+
- hk2_nachtsoll <temp>
sets the by night temperature for heating circuit 2
(see above)
+
- hk1_urlaubsoll <temp>
sets the temperature during holiday mode for heating circuit 1
(see above)
+
- hk2_urlaubsoll <temp>
sets the temperature during holiday mode for heating circuit 2
(see above)
+
- hk1_aussenhalt_ab <temp>
sets the threshold for working mode Aussenhalt for heating circuit 1
1.0 celsius resolution - temperature between -20 and 10 celsius
+
- hk2_aussenhalt_ab <temp>
sets the threshold for working mode Aussenhalt for heating circuit 2
(see above)
+
- hk1_betriebsart [automatik|nacht|tag]
sets the working mode for heating circuit 1
@@ -1097,12 +1120,15 @@ KM271_SetReading($$$$)
- nacht: manual by night working mode, no timer program is in effect
- tag: manual by day working mode, no timer program is in effect
+
- hk2_betriebsart [automatik|nacht|tag]
sets the working mode for heating circuit 2
(see above)
+
- ww_soll <temp>
sets the hot water temperature
1.0 celsius resolution - temperature between 30 and 60 celsius
+
- ww_betriebsart [automatik|nacht|tag]
sets the working mode for hot water
@@ -1110,10 +1136,12 @@ KM271_SetReading($$$$)
- nacht: no hot water at all
- tag: manual permanent hot water
+
- ww_on-till [localtime]
start hot water production till the given time is reached
localtime must have the format HH:MM[:SS]
ww_betriebsart is set according to the attribut ww_timermode. For switching-off hot water a single one-time at command is automatically generated which will set ww_betriebsart back to nacht
+
- ww_zirkulation [count]
count pumping phases for hot water circulation per hour
count must be between 0 and 7 with special meaning for
@@ -1121,6 +1149,7 @@ KM271_SetReading($$$$)
- 0: no circulation at all
- 7: circulation is always on
+
- sommer_ab <temp>
temp defines the threshold for switching between summer or winter mode of the heater
1.0 celsius resolution - temp must be between 9 and 31 with special meaning for
@@ -1128,24 +1157,29 @@ KM271_SetReading($$$$)
- 9: fixed summer mode (only hot water and frost protection)
- 31: fixed winter mode
+
- frost_ab <temp>
temp defines the threshold for activation of frost protection of the heater
1.0 celsius resolution - temp must be between -20 and 10 celsius
+
- urlaub [count]
sets the duration of the holiday mode to count days
count must be between 0 and 99 with special meaning for
- 0: holiday mode is deactivated
+
- hk1_programm [eigen|familie|frueh|spaet|vormittag|nachmittag|mittag|single|senior]
sets the timer program for heating circuit 1
- eigen: the custom program defined by the user (see below) is used
- all others: predefined programs from Buderus for various situations (see Buderus manual for details)
+
- hk2_programm [eigen|familie|frueh|spaet|vormittag|nachmittag|mittag|single|senior]
sets the timer program for heating circuit 2
(see above)
+
- hk1_timer [<position> delete|<position> <on-day> <on-time> <off-day> <off-time>]
sets (or deactivates) a by day working mode time interval for the custom program of heating circuit 1
@@ -1169,15 +1203,19 @@ KM271_SetReading($$$$)
set KM271 hk1_timer 1 mo 06:30 mo 08:20
This will toogle the by day working mode every Monday at 6:30 and will fall back to by night working mode at 8:20 the same day.
+
- hk2_timer [<position> delete|<position> <on-day> <on-time> <off-day> <off-time>]
sets (or deactivates) a by day working mode time interval for the custom program of heating circuit 2
(see above)
+
- logmode
set to logmode / request all readings again
+
+ - datetime
send the current date and time to the controller
-
+
Get
get KM271 <param>
@@ -1193,11 +1231,11 @@ KM271_SetReading($$$$)
-
+
Attributes
- do_not_notify
-
+
- all_km271_events
If this attribute is set to 1, do not ignore following events:
HK1_Vorlaufisttemperatur, HK1_Mischerstellung, HK2_Vorlaufisttemperatur, HK2_Mischerstellung,
@@ -1206,18 +1244,18 @@ KM271_SetReading($$$$)
All UNKNOWN events are ignored too, most of them were only seen
directly after setting the device into logmode.
-
+
- ww_timermode [automatik|tag]
Defines the working mode for the ww_on-till command (default is tag).
ww_on-till will set the ww_betriebsart of the heater according to this attribute.
-
+
- readingsFilter
Regular expression for selection of desired readings.
Only readings which will match the regular expression will be used. All other readings are
suppressed in the device and even in the logfile.
-
+
- additionalNotify
Regular expression for activation of notify for readings with normally suppressed events.
Useful for *_Vorlaufisttemperatur readings if notification should be activated only for a specific reading
@@ -1226,7 +1264,7 @@ KM271_SetReading($$$$)
-
+
Generated events:
- Abgastemperatur
diff --git a/fhem/fhem.pl b/fhem/fhem.pl
index bf2de9eec..79b222f29 100755
--- a/fhem/fhem.pl
+++ b/fhem/fhem.pl
@@ -6170,6 +6170,7 @@ restoreDir_mkDir($$$)
if($isFile) { # Delete the file Component
$dir =~ m,^(.*)/([^/]*)$,;
$dir = $1;
+ $dir = "" if(!defined($dir)); # file in .
}
return if($restoreDir_dirs{$dir});
$restoreDir_dirs{$dir} = 1;