From 6a309f1dd3211fcf1efcd58ab92f6bafbc7ebaa8 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Wed, 12 Aug 2020 19:37:31 +0000 Subject: [PATCH] 60_Watches.pm: contrib 0.27.0 git-svn-id: https://svn.fhem.de/fhem/trunk@22589 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/60_Watches.pm | 61 +++++++++++++++++++++------ 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/fhem/contrib/DS_Starter/60_Watches.pm b/fhem/contrib/DS_Starter/60_Watches.pm index 29dd79a8f..7b9195b29 100644 --- a/fhem/contrib/DS_Starter/60_Watches.pm +++ b/fhem/contrib/DS_Starter/60_Watches.pm @@ -129,6 +129,9 @@ my %hset = ( # time => {fn => "_setTime" }, reset => {fn => "_setReset" }, textTicker => {fn => "_setTextTicker" }, + displayTextDel => {fn => "_setDisplayTextDel" }, + displayTextSet => {fn => "_setDisplayTextSet" }, + stop => {fn => "_setStop" }, ); ############################################################################## @@ -306,19 +309,6 @@ sub Set { ## no critic 'compl readingsSingleUpdate($hash, "starttime", $ms, 0); readingsSingleUpdate($hash, "state", "resumed", 1); - } elsif ($opt eq "stop") { - readingsSingleUpdate($hash, "state", "stopped", 1); - - } elsif ($opt eq "displayTextSet") { - shift @a; shift @a; - - my $txt = join (" ", @a); - $txt =~ s/[\r\n]//gx; - readingsSingleUpdate($hash, "displayText", $txt, 1); - - } elsif ($opt eq "displayTextDel") { - delReadings ($name, "displayText"); - } else { return "$setlist"; } @@ -326,6 +316,49 @@ sub Set { ## no critic 'compl return; } +################################################################ +# Setter stop +################################################################ +sub _setStop { ## no critic "not used" + my $paref = shift; + my $hash = $paref->{hash}; + + readingsSingleUpdate($hash, "state", "stopped", 1); + +return; +} + +################################################################ +# Setter displayTextSet +################################################################ +sub _setDisplayTextSet { ## no critic "not used" + my $paref = shift; + my $hash = $paref->{hash}; + my $aref = $paref->{aref}; + + my @a = @$aref; + + shift @a; shift @a; + + my $txt = join (" ", @a); + $txt =~ s/[\r\n]//gx; + readingsSingleUpdate($hash, "displayText", $txt, 1); + +return; +} + +################################################################ +# Setter displayTextDel +################################################################ +sub _setDisplayTextDel { ## no critic "not used" + my $paref = shift; + my $name = $paref->{name}; + + delReadings ($name, "displayText"); + +return; +} + ################################################################ # Setter textTicker ################################################################ @@ -346,7 +379,7 @@ return; ################################################################ # Setter reset ################################################################ -sub _setReset { ## no critic "not used" +sub _setReset { ## no critic "not used" my $paref = shift; my $hash = $paref->{hash}; my $name = $paref->{name};