98_weekprofile: attribute extraClientModules by Beta-User
git-svn-id: https://svn.fhem.de/fhem/trunk@29973 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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
|
# 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
|
- 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
|
||||||
- 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
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ sub weekprofile_getDeviceType($$;$)
|
|||||||
return undef if (!defined($model));
|
return undef if (!defined($model));
|
||||||
}
|
}
|
||||||
Log3($me, 5, "$me(getDeviceType): $devHash->{NAME}, $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-.*/ );
|
$type = "HMCCU_HM" if ( $model =~ m/HM-.*/ );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +213,19 @@ sub weekprofile_getDeviceType($$;$)
|
|||||||
else {
|
else {
|
||||||
Log3($me, 4, "$me(getDeviceType): found MQTT2_DEVICE but not configured for weekprofile");
|
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)) {
|
if (defined($type)) {
|
||||||
@@ -399,14 +412,14 @@ sub weekprofile_sendDevProfile(@)
|
|||||||
|
|
||||||
return fhem("set $device profile_data $prf->{TOPIC}:$prf->{NAME} $json_text",1);
|
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}";
|
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);
|
return fhem("$cmd",1);
|
||||||
}
|
}
|
||||||
elsif ($type eq "MQTT2_DEVICE") {
|
elsif ($type eq 'extraClient') {
|
||||||
my $cmd = "set $device weekprofile $me $prf->{TOPIC}:$prf->{NAME}";
|
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);
|
return fhem("$cmd",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,7 +589,11 @@ sub weekprofile_refreshSendDevList($)
|
|||||||
my $module = $defs{$d}{TYPE};
|
my $module = $defs{$d}{TYPE};
|
||||||
|
|
||||||
my %sndHash;
|
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});
|
next if (!exists $sndHash{$module});
|
||||||
|
|
||||||
my $type = weekprofile_getDeviceType($me, $defs{$d}{NAME},"SND");
|
my $type = weekprofile_getDeviceType($me, $defs{$d}{NAME},"SND");
|
||||||
@@ -614,7 +631,11 @@ sub weekprofile_receiveList($)
|
|||||||
my $module = $defs{$d}{TYPE};
|
my $module = $defs{$d}{TYPE};
|
||||||
|
|
||||||
my %sndHash;
|
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});
|
next if (!exists $sndHash{$module});
|
||||||
|
|
||||||
my $type = weekprofile_getDeviceType($me, $defs{$d}{NAME});
|
my $type = weekprofile_getDeviceType($me, $defs{$d}{NAME});
|
||||||
@@ -727,7 +748,7 @@ sub weekprofile_Initialize($)
|
|||||||
$hash->{NotifyFn} = "weekprofile_Notify";
|
$hash->{NotifyFn} = "weekprofile_Notify";
|
||||||
$hash->{AttrFn} = "weekprofile_Attr";
|
$hash->{AttrFn} = "weekprofile_Attr";
|
||||||
$hash->{AttrList} = "useTopics:0,1 widgetTranslations widgetWeekdays widgetTempRange widgetEditOnNewPage:0,1 widgetEditDaysInRow:1,2,3,4,5,6,7 \
|
$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";
|
$hash->{FW_summaryFn} = "weekprofile_SummaryFn";
|
||||||
|
|
||||||
@@ -1403,6 +1424,10 @@ sub weekprofile_Attr($$$)
|
|||||||
if ($attrName eq 'tempMap') {
|
if ($attrName eq 'tempMap') {
|
||||||
weekprofile_createTempMap($hash, $attrVal);
|
weekprofile_createTempMap($hash, $attrVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($attrName eq 'extraClientModules') {
|
||||||
|
|
||||||
|
}
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
##############################################
|
##############################################
|
||||||
@@ -1804,7 +1829,7 @@ __END__
|
|||||||
<br><br>
|
<br><br>
|
||||||
Note: WeekdayTimer and MQTT2_DEVICE TYPE devices can not be used as 'master'.
|
Note: WeekdayTimer and MQTT2_DEVICE TYPE devices can not be used as 'master'.
|
||||||
<br><br>
|
<br><br>
|
||||||
An other use case is the usage of categories 'Topics'.
|
<a id="weekprofile-topics">An other use case is the usage of categories 'Topics'.
|
||||||
To enable the feature the attribute 'useTopics' have to be set.
|
To enable the feature the attribute 'useTopics' have to be set.
|
||||||
Topics are e.q. winter, summer, holidays, party, and so on.
|
Topics are e.q. winter, summer, holidays, party, and so on.
|
||||||
A topic consists of different week profiles. Normally one profile for each thermostat.
|
A topic consists of different week profiles. Normally one profile for each thermostat.
|
||||||
@@ -2012,10 +2037,13 @@ __END__
|
|||||||
</li>
|
</li>
|
||||||
<a id="weekprofile-attr-weekprofile"></a>
|
<a id="weekprofile-attr-weekprofile"></a>
|
||||||
<li>weekprofile<br>
|
<li>weekprofile<br>
|
||||||
This attribute can be a userattr of supported modules of weekprofile to receive a specific profile with the
|
This attribute can be a userattr of modules supported by <a href="#weekprofile">weekprofile</a> to receive a specific profile with the
|
||||||
defined name at the <i>restore_topic</i> command. See topics for further information
|
defined weekprofile name at the <i>restore_topic</i> command. See <a href="#weekprofile-topics">topics</a> for further information.
|
||||||
|
</li>
|
||||||
|
<a id="weekprofile-attr-extraClientModules"></a>
|
||||||
|
<li>extraClientModules<br>
|
||||||
|
This attribute can be used to add (space separated) additional client module names to the list of supported modules. The module has to support a "weekprofile" <i>set</i> command to indipendently react on this set command. <i>weekprofile</i> will hand over it's own instance name and a <i>topic:weekprofile</i> identifier to allow further processing (similar to WeekdayTimer or MQTT2_DEVICE) of the provided data. See also <a href="#vitoconnect">vitoconnect</a> code for reference about the possibilities this feature offers.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
=end html
|
=end html
|
||||||
@@ -2045,11 +2073,11 @@ __END__
|
|||||||
<br><br>Hinweis: Geräte des Typs WeekdayTimer und MQTT2_DEVICE können nicht als 'Master-Gerät' verwendet werden.
|
<br><br>Hinweis: Geräte des Typs WeekdayTimer und MQTT2_DEVICE können nicht als 'Master-Gerät' verwendet werden.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
Ein weiterer Anwendungsfall ist die Verwendung von Rubriken\Kategorien 'Topics'.
|
<a id="weekprofile-topics"></a>Ein weiterer Anwendungsfall ist die Verwendung von Rubriken\Kategorien 'Topics'.
|
||||||
Hier sollte kein 'Master-Gerät' angegeben werden. Dieses Feature muss erst über das Attribut 'useTopics' aktiviert werden.
|
Hier sollte kein 'Master-Gerät' angegeben werden. Dieses Feature muss erst über das Attribut 'useTopics' aktiviert werden.
|
||||||
Topics sind z.B. Winter, Sommer, Urlaub, Party, etc.
|
Topics sind z.B. Winter, Sommer, Urlaub, Party, etc.
|
||||||
Innerhalb einer Topic kann es mehrere Wochenprofile geben. Sinnvollerweise sollten es soviele wie Thermostate sein.
|
Innerhalb einer Topic kann es mehrere Wochenprofile geben. Sinnvollerweise sollten es soviele wie Thermostate sein.
|
||||||
Über ein Userattribut 'weekprofile' im Thermostat wird ein Wochenprofile ohne Topicname angegeben.
|
Über ein Userattribut 'weekprofile' im Thermostat wird ein Wochenprofil ohne Topicname angegeben.
|
||||||
Mittels 'restore_topic' wird dann das angebene Wochenprofil der Topic an das Thermostat übertragen.
|
Mittels 'restore_topic' wird dann das angebene Wochenprofil der Topic an das Thermostat übertragen.
|
||||||
Somit kann man einfach zwischen den Topics wechseln und die Thermostate bekommen das passende Wochenprofil.
|
Somit kann man einfach zwischen den Topics wechseln und die Thermostate bekommen das passende Wochenprofil.
|
||||||
<br><br>
|
<br><br>
|
||||||
@@ -2250,8 +2278,13 @@ __END__
|
|||||||
</li>
|
</li>
|
||||||
<a id="weekprofile-attr-weekprofile"></a>
|
<a id="weekprofile-attr-weekprofile"></a>
|
||||||
<li>weekprofile<br>
|
<li>weekprofile<br>
|
||||||
Kann ein userattr eines unterstützten Moduls von weekprofile sein, um ein spezifisches Profil mit dem angegeben Namen
|
Kann ein userattr eines von <a href="#weekprofile">weekprofile</a> unterstützten Moduls sein, um ein spezifisches Wochenprofil mit dem angegeben Namen
|
||||||
beim Befehl <i>restore_topic</i> zu empfangen. Siehe auch 'Topics'.
|
beim Befehl <i>restore_topic</i> zu empfangen. Siehe auch <a href="#weekprofile-topics">'Topics'.
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<a id="weekprofile-attr-extraClientModules"></a>
|
||||||
|
<li>extraClientModules<br>
|
||||||
|
Kann eine Leerzeichen-getrennte Liste weiterer Module enthalten, die dann von weekprofile als unterstützt erkannt werden. Die weiteren Module müssen ein "weekprofile" <i>set</i> Kommando kennen und dann selbst Code enthalten, der die empfangenen Informationen auswerten kann. weekprofile selbst übergibt nur den eigenen Namen und einen <i>topic:Wochenprofil</i>-Kenner, der dann - analog zu WeekdayTimer oder MQTT2_DEVICE - für die weitere Verarbeitung verwendet werden kann. Siehe hierzu auch den Code in <a href="#vitoconnect">vitoconnect</a>, um einen Eindruck von den Möglichkeiten zu erhalten.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user