From 1e2efd824d1d88a6a81e94db9e0233c65b6295a5 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 15 Nov 2016 14:46:43 +0000 Subject: [PATCH] 10_ZWave.pm/00_ZWDongle.pm: new attribute helpSites (Forum #60424) git-svn-id: https://svn.fhem.de/fhem/trunk@12583 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/00_ZWDongle.pm | 11 ++++++++-- fhem/FHEM/10_ZWave.pm | 47 +++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/fhem/FHEM/00_ZWDongle.pm b/fhem/FHEM/00_ZWDongle.pm index c77cdcbe6..b5e0cb141 100755 --- a/fhem/FHEM/00_ZWDongle.pm +++ b/fhem/FHEM/00_ZWDongle.pm @@ -89,7 +89,9 @@ ZWDongle_Initialize($) $hash->{AttrFn} = "ZWDongle_Attr"; $hash->{UndefFn} = "ZWDongle_Undef"; $hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 model:ZWDongle disable:0,1 ". - "homeId networkKey neighborListPos neighborListFmt"; + "helpSites:multiple,pepper,alliance homeId networkKey ". + "neighborListPos neighborListFmt"; + $hash->{FW_detailFn} = "ZWDongle_fhemwebFn"; } @@ -178,7 +180,7 @@ ZWDongle_nlData($) for my $e (@a) { my $h = $defs{$e}; next if($h->{ZWaveSubDevice} ne "no"); - $h->{IMAGE} = ZWave_getPic(ReadingsVal($e, "modelId", "")); + $h->{IMAGE} = ZWave_getPic($d, ReadingsVal($e, "modelId", "")); my $nl = ReadingsVal($e, "neighborList", ""); $nl = ReadingsVal($d, "neighborList_".hex($h->{nodeIdHex}), "") @@ -1148,6 +1150,11 @@ ZWDongle_Ready($)
  • do_not_notify
  • model
  • disable
  • +
  • helpSites
    + Comma separated list of Help Sites to get device pictures from or to + show a link to in the detailed window. Valid values are pepper + and alliance. +
  • homeId
    Stores the homeId of the dongle. Is a workaround for some buggy dongles, wich sometimes report a wrong/nonexisten homeId (Forum #35126)
  • diff --git a/fhem/FHEM/10_ZWave.pm b/fhem/FHEM/10_ZWave.pm index 8f74ce7d9..fff1408ac 100755 --- a/fhem/FHEM/10_ZWave.pm +++ b/fhem/FHEM/10_ZWave.pm @@ -572,7 +572,7 @@ our %zwave_deviceSpecial; my $zwave_cryptRijndael = 0; my $zwave_lastHashSent; my (%zwave_link, %zwave_img); -my @helpSites = ("alliance", "pepper"); +my $zwave_helpSites = "alliance,pepper"; # standard definitions for regular expression # naming scheme: p_name @@ -630,7 +630,7 @@ ZWave_Initialize($) ################ # Read in the pepper/alliance translation table - for my $n (@helpSites) { + for my $n (split(",", $zwave_helpSites)) { my $fn = $attr{global}{modpath}."/FHEM/lib/zwave_${n}links.csv.gz"; my $gz = gzopen($fn, "rb"); if($gz) { @@ -4574,11 +4574,12 @@ ZWave_helpFn($$) } sub -ZWave_getPic($) +ZWave_getPic($$) { - my ($model) = @_; + my ($iodev, $model) = @_; - for my $n (@helpSites) { + my $hs = AttrVal($iodev, "helpSites", $zwave_helpSites); + for my $n (split(",", $hs)) { my $img = $zwave_img{$n}{$model}; next if(!$img); my $fn = $attr{global}{modpath}."/www/deviceimages/zwave/$img"; @@ -4605,24 +4606,26 @@ ZWave_fhemwebFn($$$$) my $pl = ""; # Pepper link and image my $model = ReadingsVal($d, "modelId", ""); - if($model) { - for my $n (@helpSites) { - my $link = $zwave_link{$n}{$model}; - next if(!$link); - $pl .= ""; - } + return '' if (!$model); - my $img = ZWave_getPic($model); - if($img && !$FW_ss) { - $pl .= "
    "; - $pl .= ""; - $pl .= "
    "; - } + my $iodev = $defs{$d}{IODev}{NAME}; + my $hs = AttrVal($iodev, "helpSites", $zwave_helpSites); + for my $n (split(",", $hs)) { + my $link = $zwave_link{$n}{$model}; + next if(!$link); + $pl .= ""; + } + + my $img = ZWave_getPic($iodev, $model); + if($img && !$FW_ss) { + $pl .= "
    "; + $pl .= ""; + $pl .= "
    "; } return