webcmd in readingsGroup

Begonnen von KNUT345, 07 April 2021, 16:03:03

Vorheriges Thema - Nächstes Thema

KNUT345

Hallo Zusammen,
ich möchte über ein webcmd ein Listing ausgeben,
https://forum.fhem.de/index.php/topic,52252.msg440118.html#msg440118

Wenn ich das an einem Device mache, dann funktioniert es,
wenn ich es in meiner Readingsgroup mache,
dann geht der Link leider auf das Device und dort kann ich das webcmd aufrufen,
aber ich möchte ja den Aufruf direkt aus der readingsGroup heraus.

Wie muss ein Link in einer Readingsgroup definiert werden, damit ich ein cmdalias bekomme?
http://www.fhemwiki.de/wiki/ReadingsGroup#Funktion_rgLink.28.29

Grüße
Knut


sub rgLink ($$$$) {
  my ($name,$action,$label,$command) = @_;
  my $link = "";
  my $fhemLink = "";
  my $txt = "";
  my $ret = "";
  my $divStyle = "";
  my $aStyle = "text-decoration:underline;";
 
  # FHEM Variablen einbinden
  use vars qw($FW_ME);
  use vars qw($FW_subdir);
  use vars qw($FW_ss);
  use vars qw($FW_tp);

  if( $action eq "konfigurieren" ){
    $fhemLink  = "detail=$name";
    $divStyle = "cursor:pointer;font-size:11px;padding-bottom:2px;padding-left:3px;";
  }
  elsif( $action eq "detail" ){
    $fhemLink  = "detail=$name";
    $divStyle = "cursor:pointer;display:inline;";
  }
  elsif( $action eq "command" ){
    $fhemLink  = "detail=$name&$name.cmd=set%20$name%20$command";
    # $fhemLink  = "cmd=$name";
    $divStyle = "cursor:pointer;display:inline;";
  }
  elsif( $action eq "link" ){
    $fhemLink  = "detail=$name";
    $divStyle = "cursor:pointer;display:inline;text-decoration:underline;";
  }

  $link = '<a onclick="location.href=\'' . $FW_ME . $FW_subdir . '?' . $fhemLink . '\'" style="' . $aStyle . '">' . $label . '</a>';
  $txt  = '<div style="' . $divStyle . '">' . $link . '</div>';
  $ret  = "$txt";
 
  return $ret;
}