diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
index a0abff26d..41490ddef 100644
--- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template
+++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
@@ -3387,7 +3387,7 @@ setreading DEVICE attrTemplateVersion 20200602
#ebus daemon device
name:eBus_daemon_splitter
filter:TYPE=MQTT2_DEVICE
-desc:Device containing all status messages from the ebus daemon itself
NOTE: acts also as a bridge device to split up the hardware on the bus into different mqtt2_devices
NOTE:
- for use with MQTT2_CLIENT use a copy of the Device with the same clientId than the IO, delete original's readingList after applying the template!
- this might change the devices CID
+desc:Device containing all status messages from the ebus daemon itself
NOTE: acts also as a bridge device to split up the hardware on the bus into different mqtt2_devices
NOTE:
- for use with MQTT2_CLIENT use a copy of the Device with the same clientId than the IO, delete original's readingList after applying the template!
- this might change the devices CID
-To configure further parts of your ebus ecosystem, additional templates will be available, for details see Wiki, to see more info about the provided code, issue help attrTmqtt2_ebus_Utils.
order:E_01a
par:DEVTYPE;Internal TYPE of the device; { InternalVal("DEVICE",'TYPE',undef)}
par:DEV_ID;base topic set ebus;{ AttrVal("DEVICE",'readingList','') =~ m,[^:]+:?(ebus[a-zA-Z][^/]*)[/].*:, ? $1 : 'ebusd' }
@@ -3418,10 +3418,17 @@ attr DEVICE setList getKnown:noArg DEV_ID/list onlyknown\
getAll:noArg DEV_ID/list
set DEVICE getKnown
attr DEVICE comment NOTE: additional templates and code have been downloaded from svn (contrib).
Pls. inform the maintainer, if the bridgeRegexp doesn't fit to all of your devices connected to the bus.
-farewell:template has been applied successfully.
NOTE: additional templates and code have been downloaded from svn (contrib).
To configure further parts of your ebus ecosystem, have a look at these templates and the Wiki.
+farewell:template has been applied successfully.
NOTE: additional templates and code have been downloaded from svn (contrib).
To configure further parts of your ebus ecosystem, have a look at these templates and the Wiki, to see more info about the provided code, issue help attrTmqtt2_ebus_Utils.
attr DEVICE model eBus_daemon_splitter
setreading DEVICE attrTemplateVersion 20210715
+name:ebus_update_files_from_svn
+filter:TYPE=MQTT2_DEVICE
+desc:template to download or update additional code and attrTemplates from svn. Might be usefull in case there had been some updates...
+order:E_01a1
+{ Svn_GetFile('contrib/AttrTemplate/99_attrTmqtt2_ebus_Utils.pm', 'FHEM/99_attrTmqtt2_ebus_Utils.pm', sub(){ CommandReload(undef, '99_attrTmqtt2_ebus_Utils') }) }
+{ Svn_GetFile("contrib/AttrTemplate/mqtt2.ebus.template", "FHEM/lib/AttrTemplate/mqtt2.ebus.template", sub(){ AttrTemplate_Initialize() }) }
+farewell:Download has been initiated. You may find Wiki usefull; to see more info about the provided code, issue help attrTmqtt2_ebus_Utils
###########################################
# ems-esp
diff --git a/fhem/contrib/AttrTemplate/99_attrT_z2m_thermostat_Utils.pm b/fhem/contrib/AttrTemplate/99_attrT_z2m_thermostat_Utils.pm
index eaad48f2e..1c3fd91b2 100644
--- a/fhem/contrib/AttrTemplate/99_attrT_z2m_thermostat_Utils.pm
+++ b/fhem/contrib/AttrTemplate/99_attrT_z2m_thermostat_Utils.pm
@@ -119,7 +119,7 @@ __END__
=pod
=begin html
-
+
attrT_z2m_thermostat_Utils
z2t_send_weekprofile
diff --git a/fhem/contrib/AttrTemplate/99_attrTmqtt2_ebus_Utils.pm b/fhem/contrib/AttrTemplate/99_attrTmqtt2_ebus_Utils.pm
index 4e190ada3..7ea6b9256 100644
--- a/fhem/contrib/AttrTemplate/99_attrTmqtt2_ebus_Utils.pm
+++ b/fhem/contrib/AttrTemplate/99_attrTmqtt2_ebus_Utils.pm
@@ -57,15 +57,17 @@ sub j2nv {
}
sub send_weekprofile {
- my $name = shift;
- my $wp_name = shift;
+ my $name = shift // return;
+ my $wp_name = shift // return;
my $wp_profile = shift // return;
my $model = shift // ReadingsVal($name,'week','selected'); #selected,Mo-Fr,Mo-So,Sa-So? holiday to set actual $wday to sunday program?
+ #[quote author=Reinhart link=topic=97989.msg925644#msg925644 date=1554057312]
+ #"daysel" nicht. Für mich bedeutet dies, das das Csv mit der Feldbeschreibung nicht überein stimmt. Ich kann aber nirgends einen Fehler sichten (timerhc.inc oder _templates.csv). [code]daysel,UCH,0=selected;1=Mo-Fr;2=Sa-So;3=Mo-So,,Tage[/code]
+ #Ebenfalls getestet mit numerischem daysel (0,1,2,3), auch ohne Erfolg.
+ my $onLimit = shift // '20';
my $topic = shift // AttrVal($name,'devicetopic','') . '/hcTimer.$wkdy/set ';
- my $onLimit = shift // '20';
-
- my $hash = $defs{$name};
+ my $hash = $defs{$name} // return;
my $wp_profile_data = CommandGet(undef,"$wp_name profile_data $wp_profile 0");
if ($wp_profile_data =~ m{(profile.*not.found|usage..profile_data..name)}xms ) {
@@ -97,26 +99,26 @@ sub send_weekprofile {
my $val = $text->{$D[$i]}{temp}[$j];
if ( $val eq $onOff || (looks_like_number($val) && _compareOnOff( $val, $onOff, $onLimit ) ) ) {
$time = '00:00' if !$j;
- $payload .= qq{$time;;$text->{$D[$i]}{time}[$j];;};
+ $payload .= qq{$time;$text->{$D[$i]}{time}[$j];};
$pairs++;
$val = $val eq 'on' ? 'off' : 'on';
+ #$time = $text->{$D[$i]}{time}[$j] if $j;
}
}
while ( $pairs < 3 && !defined $text->{$D[$i]}{time}[$j] ) {
#fill up the three pairs with last time
- $time = $text->{$D[$i]}{time}[$j-1];
$pairs++;
- $payload .= qq{-:-;;-:-;;};
+ $payload .= qq{-,-;-,-;};
}
last if $pairs == 3;
}
if ( $model eq 'holiday' ) {
$payload .= 'selected';
- CommandSet($defs{$name},"$name $Dl[$wday] $payload")
+ CommandSet($defs{$name},"$name $Dl[$wday] $payload") if ReadingsVal($name,$Dl[$wday],'') ne $payload;
} else {
$payload .= $model;
- CommandSet($defs{$name},"$name $Dl[$i] $payload");
+ CommandSet($defs{$name},"$name $Dl[$i] $payload") if ReadingsVal($name,$Dl[$i],'') ne $payload;
}
}
@@ -137,6 +139,46 @@ sub _compareOnOff {
return;
}
+
+
+#ebusd/hc1/HP1.Mo.1:.* { json2nameValue($EVENT) }
+#zwei Readings "Start_value" und "End_value"
+# Vermutung: { "Start": {"value": "10:00"}, "End": {"value": "11:00"}}
+#ebusd/hc1/HP1\x2eMo\x2e2:.* { json2nameValue($EVENT) }
+sub upd_day_profile {
+ my $name = shift // return;
+ my $topic = shift // return;
+ my $payload = shift // return;
+ my $daylist = shift // q(Su|Mo|Tu|We|Th|Fr|Sa);
+
+ my $hash = $defs{$name} // return;
+
+ my @Dl = ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
+
+ my $data = decode_json($payload);
+ $topic =~ m{[.](?$daylist)[.](?[1-3])\z}xms;
+ my $shday = $+{dayshort} // return;
+ my $pairNr = $+{pair} // return;
+ $pairNr--;
+
+ my @days = split m{\|}xms, $daylist;
+ my %days_index = map { $days[$_] => $_ } (0..6);
+ my $index = $days_index{$shday};
+ #Log3(undef,3, "[$name] day $shday, pair $pairNr, index $index days @days");
+
+ return if !defined $index;
+
+ my $rVal = ReadingsVal( $name, $Dl[$index], '-,-;-,-;-,-;-,-;-,-;-,-;Mo-So' );
+ my @times = split m{;}xms, $rVal;
+ $times[$pairNr*2] = $data->{Start}->{value};
+ $times[$pairNr*2+1] = $data->{End}->{value};
+ $rVal = join q{;}, @times;
+
+ readingsSingleUpdate( $defs{$name}, $Dl[$index], $rVal, 1);
+ return;
+}
+
+
sub createBarView {
my ($val,$maxValue,$color) = @_;
$maxValue = $maxValue//100;
@@ -162,7 +204,7 @@ __END__
=pod
=begin html
-
+
attrTmqtt2_ebus_Utils
Functions to support attrTemplates for ebusd
diff --git a/fhem/contrib/AttrTemplate/99_attrTmqtt2_roborock_Utils.pm b/fhem/contrib/AttrTemplate/99_attrTmqtt2_roborock_Utils.pm
index 8aef47580..bc6209fd3 100644
--- a/fhem/contrib/AttrTemplate/99_attrTmqtt2_roborock_Utils.pm
+++ b/fhem/contrib/AttrTemplate/99_attrTmqtt2_roborock_Utils.pm
@@ -59,7 +59,7 @@ EOD
=pod
=begin html
-
+
attrTmqtt2_roborock_Utils
Functions to support attrTemplates for roborock/valetudo