diff --git a/fhem/CHANGED b/fhem/CHANGED
index 882c733c8..68af29db1 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it
+ - feature: 98_weekprofile: attribute extraClientModules
+ to support further modules with attribute weekprofile
- feature: 76_SolarForecast: graphicControl keys beamPaddingBottom/Top
- fix/new: 36_Shelly: log fw-check, model of Shelly3EM, PLUGS_UI implemented
- fix/new: 36_Shelly: log fw-check, model of Shelly3EM, PLUGS_UI implemented
diff --git a/fhem/FHEM/98_weekprofile.pm b/fhem/FHEM/98_weekprofile.pm
index e1bd56f34..db9d668f6 100644
--- a/fhem/FHEM/98_weekprofile.pm
+++ b/fhem/FHEM/98_weekprofile.pm
@@ -184,7 +184,7 @@ sub weekprofile_getDeviceType($$;$)
return undef if (!defined($model));
}
Log3($me, 5, "$me(getDeviceType): $devHash->{NAME}, $model");
- $type = "HMCCU_IP" if ( $model =~ m/HmIP.*/ );
+ $type = "HMCCU_IP" if ( $model =~ m/HmIP.*/ );
$type = "HMCCU_HM" if ( $model =~ m/HM-.*/ );
}
@@ -213,6 +213,19 @@ sub weekprofile_getDeviceType($$;$)
else {
Log3($me, 4, "$me(getDeviceType): found MQTT2_DEVICE but not configured for weekprofile");
}
+ } elsif (defined AttrVal($me,'extraClientModules',undef)) {
+ for my $attribute_type (split m{\s+}x, AttrVal($me,'extraClientModules','')) {
+ if ($devType eq $attribute_type) {
+ my $attr = AttrVal($device,'weekprofile','');
+ Log3($me, 5, "$me(getDeviceType): attr $devType $attr");
+ if ($attr ne "") {
+ $type = 'extraClient';
+ } else {
+ Log3($me, 4, "$me(getDeviceType): found $devType but not configured for weekprofile");
+ }
+ }
+ last if $type;
+ }
}
if (defined($type)) {
@@ -399,14 +412,14 @@ sub weekprofile_sendDevProfile(@)
return fhem("set $device profile_data $prf->{TOPIC}:$prf->{NAME} $json_text",1);
}
- elsif ($type eq "WDT") {
+ elsif ($type eq 'WDT' || $type eq 'MQTT2_DEVICE') {
my $cmd = "set $device weekprofile $me:$prf->{TOPIC}:$prf->{NAME}";
- Log3($me, 4, "$me(sendDevProfile): send to WDT $cmd");
+ Log3($me, 4, "$me(sendDevProfile): send to $type $cmd");
return fhem("$cmd",1);
}
- elsif ($type eq "MQTT2_DEVICE") {
+ elsif ($type eq 'extraClient') {
my $cmd = "set $device weekprofile $me $prf->{TOPIC}:$prf->{NAME}";
- Log3($me, 4, "$me(sendDevProfile): send to MQTT2_DEVICE $cmd");
+ Log3($me, 4, "$me(sendDevProfile): send to extraClient device $device $cmd");
return fhem("$cmd",1);
}
@@ -576,7 +589,11 @@ sub weekprofile_refreshSendDevList($)
my $module = $defs{$d}{TYPE};
my %sndHash;
- @sndHash{@DEVLIST_SEND}=();
+ my @DEVLIST_SEND_Extra = @DEVLIST_SEND;
+ if (defined AttrVal($me,'extraClientModules',undef)) {
+ push @DEVLIST_SEND_Extra, split m{\s+}x, AttrVal($me,'extraClientModules','');
+ }
+ @sndHash{@DEVLIST_SEND_Extra}=();
next if (!exists $sndHash{$module});
my $type = weekprofile_getDeviceType($me, $defs{$d}{NAME},"SND");
@@ -614,7 +631,11 @@ sub weekprofile_receiveList($)
my $module = $defs{$d}{TYPE};
my %sndHash;
- @sndHash{@DEVLIST_SEND}=();
+ my @DEVLIST_SEND_Extra = @DEVLIST_SEND;
+ if (defined AttrVal($me,'extraClientModules',undef)) {
+ push @DEVLIST_SEND_Extra, split m{\s+}x, AttrVal($me,'extraClientModules','');
+ }
+ @sndHash{@DEVLIST_SEND_Extra}=();
next if (!exists $sndHash{$module});
my $type = weekprofile_getDeviceType($me, $defs{$d}{NAME});
@@ -727,7 +748,7 @@ sub weekprofile_Initialize($)
$hash->{NotifyFn} = "weekprofile_Notify";
$hash->{AttrFn} = "weekprofile_Attr";
$hash->{AttrList} = "useTopics:0,1 widgetTranslations widgetWeekdays widgetTempRange widgetEditOnNewPage:0,1 widgetEditDaysInRow:1,2,3,4,5,6,7 \
- sendDelay tempON tempOFF configFile forceCompleteProfile:0,1 tempMap sendKeywordsToDevices:0,1 ".$readingFnAttributes;
+ sendDelay tempON tempOFF configFile forceCompleteProfile:0,1 tempMap sendKeywordsToDevices:0,1 extraClientModules ".$readingFnAttributes;
$hash->{FW_summaryFn} = "weekprofile_SummaryFn";
@@ -1403,6 +1424,10 @@ sub weekprofile_Attr($$$)
if ($attrName eq 'tempMap') {
weekprofile_createTempMap($hash, $attrVal);
}
+
+ if ($attrName eq 'extraClientModules') {
+
+ }
return undef;
}
##############################################
@@ -1804,7 +1829,7 @@ __END__
Note: WeekdayTimer and MQTT2_DEVICE TYPE devices can not be used as 'master'.
- An other use case is the usage of categories 'Topics'.
+ An other use case is the usage of categories 'Topics'.
To enable the feature the attribute 'useTopics' have to be set.
Topics are e.q. winter, summer, holidays, party, and so on.
A topic consists of different week profiles. Normally one profile for each thermostat.
@@ -2012,10 +2037,13 @@ __END__