2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 13:24:56 +00:00

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
This commit is contained in:
rudolfkoenig 2016-11-15 14:46:43 +00:00
parent bbe828c64b
commit 1e2efd824d
2 changed files with 34 additions and 24 deletions

View File

@ -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($)
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#model">model</a></li>
<li><a href="#disable">disable</a></li>
<li><a name="helpSites">helpSites</a><br>
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.
</li>
<li><a name="homeId">homeId</a><br>
Stores the homeId of the dongle. Is a workaround for some buggy dongles,
wich sometimes report a wrong/nonexisten homeId (Forum #35126)</li>

View File

@ -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<number of returned groups>_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 .= "<div class='detLink ZWPepper'>";
my $url = ($n eq "alliance" ?
"http://products.z-wavealliance.org/products/" :
"http://www.pepper1.net/zwavedb/device/");
$pl .= "<a target='_blank' href='$url/$link'>Details in $n DB</a>";
$pl .= "</div>";
}
return '' if (!$model);
my $img = ZWave_getPic($model);
if($img && !$FW_ss) {
$pl .= "<div class='img'".($FW_tp?"":" style='float:right'").">";
$pl .= "<img style='max-width:96;max-height:96px;' src='$img'>";
$pl .= "</div>";
}
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 .= "<div class='detLink ZWPepper'>";
my $url = ($n eq "alliance" ?
"http://products.z-wavealliance.org/products/" :
"http://www.pepper1.net/zwavedb/device/");
$pl .= "<a target='_blank' href='$url/$link'>Details in $n DB</a>";
$pl .= "</div>";
}
my $img = ZWave_getPic($iodev, $model);
if($img && !$FW_ss) {
$pl .= "<div class='img'".($FW_tp?"":" style='float:right'").">";
$pl .= "<img style='max-width:96;max-height:96px;' src='$img'>";
$pl .= "</div>";
}
return