From 64827340cae80e8eded7009451d6ac2c3a130ed7 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 3 May 2016 18:31:39 +0000 Subject: [PATCH] 98_dummy.pm: useSetExtensions attribute added (Forum #52981) git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@11381 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 3 ++- FHEM/98_dummy.pm | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index b8fe16bc7..86837d551 100644 --- a/CHANGED +++ b/CHANGED @@ -1,6 +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. - - change: speedtest: create readings without units + - feature: dummy attribute useSetExtensions + - change: speedtest: create readings without units - feature: HUEBridge,HUEDevice,LightScene: use new HUE scenes api - feature: 74:AMAD: add Attribut for TTS speed and notify file path - bugfix : 74:AMAD: modify informationsflow diff --git a/FHEM/98_dummy.pm b/FHEM/98_dummy.pm index 45472276d..d525c2fe9 100644 --- a/FHEM/98_dummy.pm +++ b/FHEM/98_dummy.pm @@ -4,6 +4,7 @@ package main; use strict; use warnings; +use SetExtensions; sub dummy_Initialize($) @@ -12,7 +13,8 @@ dummy_Initialize($) $hash->{SetFn} = "dummy_Set"; $hash->{DefFn} = "dummy_Define"; - $hash->{AttrList} = "readingList setList ". $readingFnAttributes; + $hash->{AttrList} = "readingList setList useSetExtensions " . + $readingFnAttributes; } ################################### @@ -24,7 +26,16 @@ dummy_Set($@) return "no set value specified" if(int(@a) < 1); my $setList = AttrVal($name, "setList", " "); - return "Unknown argument ?, choose one of $setList" if($a[0] eq "?"); + + if(AttrVal($name,"useSetExtensions",undef)) { + my $a0 = $a[0]; $a0 =~ s/([.?*])/\\$1/g; + if($setList !~ m/\b$a0\b/) { + unshift @a, $name; + return SetExtensions($hash, $setList, @a) + } + } else { + return "Unknown argument ?, choose one of $setList" if($a[0] eq "?"); + } my @rl = split(" ", AttrVal($name, "readingList", "")); if(@rl && grep /\b$a[0]\b/, @rl) { @@ -101,6 +112,12 @@ dummy_Define($$) ?", so the FHEMWEB frontend can construct a dropdown and offer on/off switches. Example: attr dummyName setList on off +