1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-07 22:29:19 +00:00

98_Verkehrsinfo.pm: add attribut disable

git-svn-id: https://svn.fhem.de/fhem/trunk@17616 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martins 2018-10-24 21:57:44 +00:00
parent f7ae9bc745
commit d66a789548
2 changed files with 27 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# 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_Verkehrsinfo.pm: add attribut disable
- feature: allowed: multi-allowed changes (Forum #92423) - feature: allowed: multi-allowed changes (Forum #92423)
- feature: 93_DbRep: V8.4.0, reduceLog from DbLog integrated into DbRep, - feature: 93_DbRep: V8.4.0, reduceLog from DbLog integrated into DbRep,
sqlCmd/dbValue with textField-long as default, both sqlCmd/dbValue with textField-long as default, both

View File

@ -25,6 +25,9 @@
############################################################################ ############################################################################
# #
# Changelog: # Changelog:
# 2018-10-21, v2.3
# Feature: Attribut disable added
#
# 2017-01-16, v2.2 # 2017-01-16, v2.2
# Feature: Quelle http://www.radiosaw.de/verkehrsmeldungen added # Feature: Quelle http://www.radiosaw.de/verkehrsmeldungen added
# #
@ -119,6 +122,7 @@ sub Verkehrsinfo_Initialize($) {
$hash->{AttrList} = $hash->{AttrList} =
"filter_exclude filter_include orderby " "filter_exclude filter_include orderby "
. "msg_format:road,head,both " . "msg_format:road,head,both "
. "disable:1,0 "
. $readingFnAttributes; . $readingFnAttributes;
} }
@ -260,6 +264,7 @@ sub Verkehrsinfo_Set($@) {
sub Verkehrsinfo_Attr(@) { sub Verkehrsinfo_Attr(@) {
my ($cmd,$name,$attr_name,$attr_value) = @_; my ($cmd,$name,$attr_name,$attr_value) = @_;
my $hash = $defs{$name};
if($cmd eq "set") { if($cmd eq "set") {
if($attr_name eq "filter_exclude" || $attr_name eq "filter_include") { if($attr_name eq "filter_exclude" || $attr_name eq "filter_include") {
eval { qr/$attr_value/ }; eval { qr/$attr_value/ };
@ -279,6 +284,23 @@ sub Verkehrsinfo_Attr(@) {
Log3 $name, 3, $err; Log3 $name, 3, $err;
return $err; return $err;
} }
elsif ( $attr_name eq "disable" ) {
if ( $attr_value == 1 ) {
RemoveInternalTimer($hash);
readingsSingleUpdate( $hash, "state", "inactive", 1 );
$hash->{helper}{DISABLED} = 1;
}
elsif ( $attr_value == 0 ) {
readingsSingleUpdate( $hash, "state", "active", 1 );
Verkehrsinfo_GetUpdate($hash);
}
}
}
elsif ( $cmd eq "del" ) {
if ( $attr_name eq "disable" ) {
Verkehrsinfo_GetUpdate($hash);
}
} }
return undef; return undef;
} }
@ -703,6 +725,8 @@ sub Verkehrsinfo_hf_orderby ($@) {
Multiple searching keywords can be seperated with the pipe "|".<br><br></li> Multiple searching keywords can be seperated with the pipe "|".<br><br></li>
<li><i>msg_format [ road | head | both ]</i> (only Verkehrsinfo.de and RadioSAW.de)<br> <li><i>msg_format [ road | head | both ]</i> (only Verkehrsinfo.de and RadioSAW.de)<br>
Using this parameter you can format the output, regarding streets, direction or both.<br><br></li> Using this parameter you can format the output, regarding streets, direction or both.<br><br></li>
<li><i>disable</i><br>
1 = inactive and 0 = active<br><br></li>
<li><i><a href="#readingFnAttributes">readingFnAttributes</a></i><br><br></li> <li><i><a href="#readingFnAttributes">readingFnAttributes</a></i><br><br></li>
</ul> </ul>
</ul> </ul>
@ -832,6 +856,8 @@ sub Verkehrsinfo_hf_orderby ($@) {
Mehrer Suchbegriffe können mit einer Pipe "|" getrennt werden.<br><br></li> Mehrer Suchbegriffe können mit einer Pipe "|" getrennt werden.<br><br></li>
<li><i>msg_format [ road | head | both ]</i> (Nur Verkehrsinfo.de und RadioSAW.de)<br> <li><i>msg_format [ road | head | both ]</i> (Nur Verkehrsinfo.de und RadioSAW.de)<br>
Über diesen Parameter kann die Meldung formatiert werden nach Strasse, Richtung oder beides<br><br></li> Über diesen Parameter kann die Meldung formatiert werden nach Strasse, Richtung oder beides<br><br></li>
<li><i>disable</i><br>
1 = inactive and 0 = active<br><br></li>
<li><i><a href="#readingFnAttributes">readingFnAttributes</a></i><br><br></li> <li><i><a href="#readingFnAttributes">readingFnAttributes</a></i><br><br></li>
</ul> </ul>
</ul> </ul>