2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

95_Dashboard: new attr "dashboard_homeTab", "dashboard_webRefresh", new set command activateTab, bugfixes, comref revised

git-svn-id: https://svn.fhem.de/fhem/trunk@20260 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-09-27 13:08:21 +00:00
parent 98b4fe2ea6
commit b15703da9b
4 changed files with 386 additions and 229 deletions

View File

@ -1,5 +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.
- feature: 95_Dashboard: new attr "dashboard_homeTab", "dashboard_webRefresh",
new set command activateTab, bugfixes, comref revised
- change: 49_SSCam: set compatibility to SVS version 8.2.6
- feature: 73_DoorBird: No Picture/video menue for stations without camera
- new: 70_CanOverEthernet: introducing new module

View File

@ -55,12 +55,16 @@ use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW
# Versions History intern
our %Dashboard_vNotesIntern = (
"3.15.1" => "25.09.2019 change initial attributes, commandref revised ",
"3.15.0" => "24.09.2019 set activateTab, rename dashboard_activetab to dashboard_homeTab, ".
"rename dashboard_activetabRefresh to dashboard_webRefresh, some bugfixes, comref revised ",
"3.14.0" => "22.09.2019 new attribute dashboard_activetabRefresh, activate the active tab in browser ",
"3.13.2" => "21.09.2019 new solution to eliminate links for all Devices ",
"3.13.1" => "21.09.2019 don't eliminate links for PageEnd-Devices ",
"3.13.0" => "20.09.2019 change attribute noLinks to dashboard_noLinks, eliminate links for PageEnd-Devices ",
"3.12.0" => "16.09.2019 new attribute noLinks, review comref and get-options ",
"3.11.0" => "16.09.2019 attr dashboard_activetab is now working properly, commandref revised, calculate attribute ".
"dashboard_activetab (is now a userattr) ",
"dashboard_activetab (is now a userattr) ",
"3.10.1" => "29.06.2018 added FW_hideDisplayName, Forum #88727 ",
"1.0.0" => "20.12.2013 initial version released to testers "
);
@ -86,7 +90,7 @@ sub Dashboard_Initialize ($) {
$hash->{GetFn} = "Dashboard_Get";
$hash->{UndefFn} = "Dashboard_undef";
$hash->{FW_detailFn} = "Dashboard_DetailFN";
$hash->{AttrFn} = "Dashboard_attr";
$hash->{AttrFn} = "Dashboard_Attr";
$hash->{AttrList} = "disable:0,1 ".
"dashboard_backgroundimage ".
"dashboard_colcount:1,2,3,4,5 ".
@ -109,14 +113,6 @@ sub Dashboard_Initialize ($) {
"dashboard_tab1colcount " .
"dashboard_tab1rowcentercolwidth " .
"dashboard_tab1backgroundimage " .
"dashboard_tab[0-9]+name " .
"dashboard_tab[0-9]+groups " .
"dashboard_tab[0-9]+devices " .
"dashboard_tab[0-9]+sorting " .
"dashboard_tab[0-9]+icon " .
"dashboard_tab[0-9]+colcount " .
"dashboard_tab[0-9]+rowcentercolwidth " .
"dashboard_tab[0-9]+backgroundimage " .
"dashboard_width ".
"dashboard_noLinks:1,0 ";
@ -148,9 +144,10 @@ sub Dashboard_define ($$) {
readingsSingleUpdate( $hash, "state", "Initialized", 0 );
RemoveInternalTimer($hash);
InternalTimer ($now + 5, 'Dashboard_CheckDashboardAttributUssage', $hash, 0);
InternalTimer ($now+2, 'Dashboard_init', $hash, 0);
InternalTimer ($now+5, 'Dashboard_CheckDashboardAttributUssage', $hash, 0);
my $url = '/dashboard/' . $name;
my $url = '/dashboard/'.$name;
$data{FWEXT}{$url}{CONTENTFUNC} = 'Dashboard_CGI'; # $data{FWEXT} = FHEMWEB Extension, siehe 01_FHEMWEB.pm
$data{FWEXT}{$url}{LINK} = 'dashboard/'.$name;
@ -163,17 +160,31 @@ return;
# Set
################################################################
sub Dashboard_Set($@) {
my ( $hash, $name, $cmd, @args ) = @_;
my ($hash, $name, $cmd, @args) = @_;
if ( $cmd eq "lock" ) {
readingsSingleUpdate( $hash, "lockstate", "lock", 0 );
return;
} elsif ( $cmd eq "unlock" ) {
readingsSingleUpdate( $hash, "lockstate", "unlock", 0 );
return;
}else {
return "Unknown argument " . $cmd . ", choose one of lock:noArg unlock:noArg";
}
my $setlist = "Unknown argument $cmd, choose one of ".
"lock:noArg ".
"unlock:noArg "
;
my $tl = Dashboard_possibleTabs ($name);
$setlist .= "activateTab:$tl " if($tl);
if ( $cmd eq "lock" ) {
readingsSingleUpdate ($hash, "lockstate", "lock", 0);
return;
} elsif ( $cmd eq "unlock" ) {
readingsSingleUpdate ($hash, "lockstate", "unlock", 0);
return;
} elsif ( $cmd eq "activateTab" ) {
Dashboard_activateTab ($name,$args[0]);
return;
} else {
return $setlist;
}
return;
}
################################################################
@ -203,7 +214,7 @@ sub Dashboard_Get($@) {
foreach my $idir (@iconFolders) {$iconDirs .= "$attr{global}{modpath}/www/images/".$idir.",";}
$res .= " \"icondirs\": \"$iconDirs\", \"dashboard_tabcount\": " . Dashboard_GetTabCount($hash, 0). ", \"dashboard_activetab\": " . Dashboard_GetActiveTab($hash->{NAME});
$res .= " \"icondirs\": \"$iconDirs\", \"dashboard_tabcount\": " . Dashboard_GetTabCount($hash, 0). ", \"dashboard_homeTab\": " . Dashboard_GetActiveTab($name);
$res .= ($i != $x) ? ",\n" : "\n";
foreach my $attr (sort keys %$attrdata) {
@ -212,7 +223,7 @@ sub Dashboard_Get($@) {
if (@splitattr == 2) {
$res .= " \"".Dashboard_Escape($attr)."\": \"".$splitattr[0]."\",\n";
$res .= " \"".Dashboard_Escape($attr)."color\": \"".$splitattr[1]."\"";
} elsif ($attr ne "dashboard_activetab") {
} elsif ($attr ne "dashboard_homeTab") {
$res .= " \"".Dashboard_Escape($attr)."\": \"".$attrdata->{$attr}."\"";
} else {
next;
@ -252,35 +263,12 @@ sub Dashboard_Get($@) {
}
}
sub Dashboard_Escape($) {
my $a = shift;
return "null" if(!defined($a));
my %esc = ("\n" => '\n', "\r" => '\r', "\t" => '\t', "\f" => '\f', "\b" => '\b', "\"" => '\"', "\\" => '\\\\', "\'" => '\\\'', );
$a =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/eg;
return $a;
}
################################################################
# Undefine
################################################################
sub Dashboard_undef ($$) {
my ($hash,$arg) = @_;
# remove dashboard links from left menu
my $url = '/dashboard/' . $hash->{NAME};
delete $data{FWEXT}{$url};
RemoveInternalTimer($hash);
return undef;
}
################################################################
# Attr
################################################################
sub Dashboard_attr($$$) {
sub Dashboard_Attr($$$) {
my ($cmd, $name, $attrName, $attrVal) = @_;
my $hash = $defs{$name};
if ($cmd eq "set") {
if ($attrName =~ m/dashboard_tab([1-9][0-9]*)groups/ || $attrName =~ m/dashboard_tab([1-9][0-9]*)devices/) {
@ -300,16 +288,32 @@ sub Dashboard_attr($$$) {
my $url = '/dashboard/'.$name;
$data{FWEXT}{$url}{NAME} = $attrVal;
}
if ($attrName =~ m/dashboard_homeTab/) {
Dashboard_activateTab ($name,$attrVal);
}
}
# die Argumente für das Attribut dashboard_activetab dynamisch ermitteln und setzen
my $f = Dashboard_calcAttrActiveTab ($name);
delFromDevAttrList($name, "dashboard_activetab");
addToDevAttrList ($name, "dashboard_activetab:$f");
InternalTimer (time()+2, 'Dashboard_init', $hash, 0);
return;
}
################################################################
# Undefine
################################################################
sub Dashboard_undef ($$) {
my ($hash,$arg) = @_;
# remove dashboard links from left menu
my $url = '/dashboard/'.$hash->{NAME};
delete $data{FWEXT}{$url};
RemoveInternalTimer($hash);
return undef;
}
################################################################
# Routine für FHEMWEB Detailanzeige
################################################################
@ -382,36 +386,36 @@ sub DashboardAsHtml($) {
sub Dashboard_SummaryFN ($$$$) {
my ($FW_wname, $d, $room, $pageHash) = @_;
my $ret = "";
my $showbuttonbar = "hidden";
my $debugfield = "hidden";
my $hash = $defs{$d};
my $name = $d;
my $id = $defs{$d}{NR};
my $ret = "";
my $showbuttonbar = "hidden";
my $debugfield = "hidden";
my $hash = $defs{$d};
my $name = $d;
my $id = $defs{$d}{NR};
######################### Read Dashboard Attributes and set Default-Values ####################################
my $lockstate = ReadingsVal($name, "lockstate", "unlock");
my $showhelper = ($lockstate eq "unlock") ? 1 : 0;
my $disable = AttrVal($name, "disable", 0);
my $colcount = AttrVal($name, "dashboard_colcount", 1);
my $colwidth = AttrVal($name, "dashboard_rowcentercolwidth", 100);
my $colheight = AttrVal($name, "dashboard_rowcenterheight", 400);
my $rowtopheight = AttrVal($name, "dashboard_rowtopheight", 250);
my $rowbottomheight = AttrVal($name, "dashboard_rowbottomheight", 250);
my $showtabs = AttrVal($name, "dashboard_showtabs", "tabs-and-buttonbar-at-the-top");
my $showtogglebuttons = AttrVal($name, "dashboard_showtogglebuttons", 1);
my $showfullsize = AttrVal($name, "dashboard_showfullsize", 0);
my $flexible = AttrVal($name, "dashboard_flexible", 0);
my $customcss = AttrVal($name, "dashboard_customcss", "none");
my $backgroundimage = AttrVal($name, "dashboard_backgroundimage", "");
my $row = AttrVal($name, "dashboard_row", "center");
my $debug = AttrVal($name, "dashboard_debug", "0");
my $activetab = Dashboard_GetActiveTab($name);
my $tabcount = Dashboard_GetTabCount($hash, 1);
my $dashboardversion = $hash->{HELPER}{VERSION};
my $dbwidth = AttrVal($name, "dashboard_width", "100%");
my @tabnames = ();
my @tabsortings = ();
my $lockstate = ReadingsVal($name, "lockstate", "unlock");
my $showhelper = ($lockstate eq "unlock") ? 1 : 0;
my $disable = AttrVal($name, "disable", 0);
my $colcount = AttrVal($name, "dashboard_colcount", 1);
my $colwidth = AttrVal($name, "dashboard_rowcentercolwidth", 100);
my $colheight = AttrVal($name, "dashboard_rowcenterheight", 400);
my $rowtopheight = AttrVal($name, "dashboard_rowtopheight", 250);
my $rowbottomheight = AttrVal($name, "dashboard_rowbottomheight", 250);
my $showtabs = AttrVal($name, "dashboard_showtabs", "tabs-and-buttonbar-at-the-top");
my $showtogglebuttons = AttrVal($name, "dashboard_showtogglebuttons", 1);
my $showfullsize = AttrVal($name, "dashboard_showfullsize", 0);
my $flexible = AttrVal($name, "dashboard_flexible", 0);
my $customcss = AttrVal($name, "dashboard_customcss", "none");
my $backgroundimage = AttrVal($name, "dashboard_backgroundimage", "");
my $row = AttrVal($name, "dashboard_row", "center");
my $debug = AttrVal($name, "dashboard_debug", "0");
my ($activetab,$tabname) = Dashboard_GetActiveTab($name,1);
my $tabcount = Dashboard_GetTabCount($hash, 1);
my $dashboardversion = $hash->{HELPER}{VERSION};
my $dbwidth = AttrVal($name, "dashboard_width", "100%");
my @tabnames = ();
my @tabsortings = ();
for (my $i = 0; $i < $tabcount; $i++) {
$tabnames[$i] = AttrVal($name, "dashboard_tab" . ($i + 1) . "name", "Dashboard-Tab " . ($i + 1));
@ -436,9 +440,11 @@ sub Dashboard_SummaryFN ($$$$) {
#------------------- Check dashboard_sorting on false content ------------------------------------
for (my $i=0;$i<@tabsortings;$i++){
if (($tabsortings[$i-1] !~ /[0-9]+/ || $tabsortings[$i-1] !~ /:/ || $tabsortings[$i-1] !~ /,/ ) && ($tabsortings[$i-1] ne "," && $tabsortings[$i-1] ne "")){
Log3 $name, 3, "[".$name." V".$dashboardversion."] Value of attribut dashboard_tab".$i."sorting is wrong. Saved sorting can not be set. Fix Value or delete the Attribute. [".$tabsortings[$i-1]."]";
} else { Log3 $name, 5, "[".$name." V".$dashboardversion."] Sorting OK or Empty: dashboard_tab".$i."sorting "; }
if (($tabsortings[$i-1] !~ /[0-9]+/ || $tabsortings[$i-1] !~ /:/ || $tabsortings[$i-1] !~ /,/ ) && ($tabsortings[$i-1] ne "," && $tabsortings[$i-1] ne "")) {
Log3 ($name, 3, "Dashboard $name - Value of attribut dashboard_tab".$i."sorting is wrong. Saved sorting can not be set. Fix Value or delete the Attribute. [".$tabsortings[$i-1]."]");
} else {
Log3 ($name, 5, "Dashboard $name - Sorting OK or Empty: dashboard_tab".$i."sorting");
}
}
#-------------------------------------------------------------------------------------------------
@ -925,41 +931,41 @@ sub Dashboard_CheckDashboardAttributUssage($) {
my $detailnote = "";
# --------- Set minimal Attributes in the hope to make it easier for beginners --------------------
my $tab1groups = AttrVal($defs{$d}{NAME}, "dashboard_tab1groups", "<noGroup>");
my $tab1groups = AttrVal($d, "dashboard_tab1groups", "<noGroup>");
if ($tab1groups eq "<noGroup>") {
FW_fC("attr ".$d." dashboard_tab1groups Set Your Groups - See Attribute dashboard_tab1groups-");
FW_fC("attr ".$d." dashboard_tab1groups Set your FHEM groups here and arrange them on tab 1");
}
# ---------------- Delete empty Groups entries ----------------------------------------------------------
my $tabgroups = AttrVal($defs{$d}{NAME}, "dashboard_tab1groups", "999");
my $tabgroups = AttrVal($d, "dashboard_tab1groups", "999");
if ($tabgroups eq "1" ) { FW_fC("deleteattr ".$d." dashboard_tab1groups"); }
$tabgroups = AttrVal($defs{$d}{NAME}, "dashboard_tab2groups", "999");
$tabgroups = AttrVal($d, "dashboard_tab2groups", "999");
if ($tabgroups eq "1" ) { FW_fC("deleteattr ".$d." dashboard_tab2groups"); }
$tabgroups = AttrVal($defs{$d}{NAME}, "dashboard_tab3groups", "999");
$tabgroups = AttrVal($d, "dashboard_tab3groups", "999");
if ($tabgroups eq "1" ) { FW_fC("deleteattr ".$d." dashboard_tab3groups"); }
$tabgroups = AttrVal($defs{$d}{NAME}, "dashboard_tab4groups", "999");
$tabgroups = AttrVal($d, "dashboard_tab4groups", "999");
if ($tabgroups eq "1" ) { FW_fC("deleteattr ".$d." dashboard_tab4groups"); }
$tabgroups = AttrVal($defs{$d}{NAME}, "dashboard_tab5groups", "999");
$tabgroups = AttrVal($d, "dashboard_tab5groups", "999");
if ($tabgroups eq "1" ) { FW_fC("deleteattr ".$d." dashboard_tab5groups"); }
my $lockstate = AttrVal($defs{$d}{NAME}, "dashboard_lockstate", ""); # outdates 04.2014
my $lockstate = AttrVal($d, "dashboard_lockstate", ""); # outdates 04.2014
if ($lockstate ne "") {
{ FW_fC("deleteattr ".$d." dashboard_lockstate"); }
Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [dashboard_lockstate]";
Log3 ($d, 3, "Dashboard $d - Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [dashboard_lockstate]");
}
my $showhelper = AttrVal($defs{$d}{NAME}, "dashboard_showhelper", ""); # outdates 04.2014
my $showhelper = AttrVal($d, "dashboard_showhelper", ""); # outdates 04.2014
if ($showhelper ne "") {
{ FW_fC("deleteattr ".$d." dashboard_showhelper"); }
Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [dashboard_showhelper]";
Log3 $hash, 3, "[".$d. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [dashboard_showhelper]";
}
my $showtabs = AttrVal($defs{$d}{NAME}, "dashboard_showtabs", ""); # delete values 04.2014
my $showtabs = AttrVal($d, "dashboard_showtabs", ""); # delete values 04.2014
if ($showtabs eq "tabs-at-the-top-buttonbar-hidden") {
{ FW_fC("set ".$d." dashboard_showtabs tabs-and-buttonbar-at-the-top"); }
Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [tabs-at-the-top-buttonbar-hidden]";
Log3 $hash, 3, "[".$d. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [tabs-at-the-top-buttonbar-hidden]";
}
if ($showtabs eq "tabs-on-the-bottom-buttonbar-hidden") {
{ FW_fC("set ".$d." dashboard_showtabs tabs-and-buttonbar-on-the-bottom"); }
Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [tabs-on-the-bottom-buttonbar-hidden]";
Log3 $hash, 3, "[".$d. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. [tabs-on-the-bottom-buttonbar-hidden]";
}
return;
@ -982,14 +988,20 @@ return $tabCount ? $tabCount : $defaultTabCount;
#############################################################################################
# Aktives Tab selektieren
# $gtn setzen um Tabnamen mit abzurufen
#############################################################################################
sub Dashboard_GetActiveTab ($) {
my ($d) = @_;
sub Dashboard_GetActiveTab ($;$) {
my ($name,$gtn) = @_;
my $maxTab = Dashboard_GetTabCount($defs{$d}, 1);
my $maxTab = Dashboard_GetTabCount($defs{$name}, 1);
my $activeTab = 1;
foreach my $key (%FW_httpheader) {
Log3 ($name, 5, "Dashboard $name - FW_httpheader $key: ".$FW_httpheader{$key});
}
if (defined($FW_httpheader{Cookie})) {
Log3 ($name, 4, "Dashboard $name - Cookie set: ".$FW_httpheader{Cookie});
my %cookie = map({ split('=', $_) } split(/; */, $FW_httpheader{Cookie}));
if (defined($cookie{dashboard_activetab})) {
$activeTab = $cookie{dashboard_activetab};
@ -997,16 +1009,23 @@ sub Dashboard_GetActiveTab ($) {
}
}
my $dat = AttrVal($d, 'dashboard_activetab', $activeTab);
$dat = ($dat <= $maxTab)?$dat:$maxTab;
my $tabno = AttrVal($name, 'dashboard_homeTab', $activeTab);
$tabno = ($tabno <= $maxTab)?$tabno:$maxTab;
my $tabname = AttrVal($name, "dashboard_tab".($tabno)."name", "");
return $dat;
Log3 ($name, 4, "Dashboard $name - Dashboard active tab: $tabno/$tabname");
if($gtn) {
return ($tabno,$tabname);
} else {
return $tabno;
}
}
#############################################################################################
# Wertevorrat für Attribut dashboard_activetab ermitteln und setzen
# Wertevorrat der möglichen Tabs ermitteln
#############################################################################################
sub Dashboard_calcAttrActiveTab ($) {
sub Dashboard_possibleTabs ($) {
my ($name) = @_;
my $f;
@ -1050,6 +1069,74 @@ sub Dashboard_setVersionInfo($) {
return;
}
#############################################################################################
# Tabumschaltung bei setzen Attribut dashboard_homeTab bzw. "set ... activeTab"
#############################################################################################
sub Dashboard_activateTab ($$) {
my ($name,$tab) = @_;
my $hash = $defs{$name};
my $url = '/dashboard/'.$name;
return if(!$data{FWEXT}{$url});
$tab--;
my $web = AttrVal($name, "dashboard_webRefresh", $hash->{HELPER}{FW});
my @wa = split(",", $web);
{ map { FW_directNotify("#FHEMWEB:$_", 'dashboard_load_tab('."$tab".');$("#dashboardtabs").tabs("option", "active", '."$tab".')', "") } @wa }
# Andere Triggermöglichkeiten:
#{ map { FW_directNotify("#FHEMWEB:$_", 'dashboard_load_tab('."$tab".')', "") } @wa }
#{ map { FW_directNotify("#FHEMWEB:$_", '$("#dashboardtabs").tabs("option", "active", '."$tab".')', "") } @wa }
# CommandTrigger(undef,'WEB JS:dashboard_load_tab('."$tab".');JS:$("#dashboardtabs").tabs("option", "active", '."$tab".')' );
return;
}
######################################################################################
# initiale Routinen für Dashboard
######################################################################################
sub Dashboard_init ($) {
my ($hash) = @_;
my $name = $hash->{NAME};
RemoveInternalTimer($hash, "Dashboard_init");
if ($init_done == 1) {
# die Argumente für das Attribut dashboard_webRefresh dynamisch ermitteln und setzen
my $fwd = join(",",devspec2array("TYPE=FHEMWEB:FILTER=STATE=Initialized"));
$hash->{HELPER}{FW} = $fwd;
my $atr = $attr{$name}{dashboard_webRefresh};
delFromDevAttrList($name, "dashboard_webRefresh");
addToDevAttrList ($name, "dashboard_webRefresh:multiple-strict,$fwd");
$attr{$name}{dashboard_webRefresh} = $atr if($atr);
# die Argumente für das Attribut dashboard_homeTab dynamisch ermitteln und setzen
my $f = Dashboard_possibleTabs ($name);
my $at = $attr{$name}{dashboard_homeTab};
delFromDevAttrList($name, "dashboard_homeTab");
addToDevAttrList ($name, "dashboard_homeTab:$f");
$attr{$name}{dashboard_homeTab} = $at if($at);
} else {
InternalTimer(time()+3, "Dashboard_init", $hash, 0);
}
return;
}
######################################################################################
# Zeichen escapen
######################################################################################
sub Dashboard_Escape($) {
my $a = shift;
return "null" if(!defined($a));
my %esc = ("\n" => '\n', "\r" => '\r', "\t" => '\t', "\f" => '\f', "\b" => '\b', "\"" => '\"', "\\" => '\\\\', "\'" => '\\\'', );
$a =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/eg;
return $a;
}
1;
=pod
@ -1061,8 +1148,13 @@ return;
<a name="Dashboard"></a>
<h3>Dashboard</h3>
<ul>
Creates a Dashboard in any group can be arranged. The positioning may depend the Groups and column width are made<br>
arbitrarily by drag'n drop. Also, the width and height of a Group can be increased beyond the minimum size.<br>
Creates a Dashboard in any group and/or devices can be arranged. The positioning may depend the objects and column width are made
arbitrarily by drag'n drop. Also, the width and height of an object can be increased beyond the minimum size. <br><br>
<b>Note: </b><br>
A group name in the dashboard respectively the attribute "dashboard_tabXgroups" equates the group name in FHEM and depict the
devices which are contained in that group.
<br>
<br>
<a name="Dashboarddefine"></a>
@ -1094,6 +1186,14 @@ return;
<ul>
<ul>
<li><b>set &lt;name&gt; activateTab &lt;TabNo&gt; </b><br>
The Tab with the defined number will be activated.
If the attribute "dashboard_homeTab" is set, this defined tab will be reactivated at next
browser refresh. <br>
<br>
</li>
<li><b>set &lt;name&gt; lock </b><br>
Locks the Dashboard so that no position changes can be made.
</li><br>
@ -1138,10 +1238,6 @@ return;
<ul>
<ul>
<a name="dashboard_activetab"></a>
<li><b>dashboard_activetab </b><br>
Specifies which tab is activated. If it isn't set, the last active tab will also be the current tab. (Default: 1)
</li><br>
<a name="dashboard_backgroundimage"></a>
<li><b>dashboard_backgroundimage </b><br>
@ -1172,6 +1268,11 @@ return;
Default: 0
</li><br>
<a name="dashboard_homeTab"></a>
<li><b>dashboard_homeTab </b><br>
Specifies which tab is activated. If it isn't set, the last selected tab will also be the active tab. (Default: 1)
</li><br>
<a name="dashboard_row"></a>
<li><b>dashboard_row </b><br>
To select which rows are displayed. top only; center only; bottom only; top and center; center and bottom; top,center and bottom.<br>
@ -1226,20 +1327,21 @@ return;
Default: 0
</li><br>
<a name="dashboard_tabXname"></a>
<li><b>dashboard_tabXname </b><br>
Title of Tab at position X.
<a name="dashboard_tab1name"></a>
<li><b>dashboard_tab1name </b><br>
Title of Tab. (also valid for further dashboard_tabXname)
</li><br>
<a name="dashboard_tabXsorting"></a>
<li><b>dashboard_tabXsorting </b><br>
Contains the position of each group in Tab X. Value is written by the "Set" button. It is not recommended to take
manual changes.
<a name="dashboard_tab1sorting"></a>
<li><b>dashboard_tab1sorting </b><br>
Contains the position of each group in Tab. (also valid for further dashboard_tabXsorting) <br>
Value is written by the "Set" button. It is not recommended to take manual changes.
</li><br>
<a name="dashboard_tabXgroups"></a>
<li><b>dashboard_tabXgroups </b><br>
Comma-separated list of the names of the groups to be displayed in Tab X.<br>
<a name="dashboard_tab1groups"></a>
<li><b>dashboard_tab1groups </b><br>
Comma separated list of FHEM groups (see attribute "group" in a device) to be displayed in Tab.
(also valid for further dashboard_tabXgroups) <br>
Each group can be given an icon for this purpose the group name, the following must be
completed ":&lt;icon&gt;@&lt;color&gt;" <br><br>
@ -1252,43 +1354,39 @@ return;
.*Light.* to show all groups that contain the string "Light"
</li><br>
<a name="dashboard_tabXdevices"></a>
<li><b>dashboard_tabXdevices </b><br>
devspec list of devices that should appear in the tab. The format is:<br/>
GROUPNAME:devspec1,devspec2,...,devspecN:ICONNAME <br><br>
The icon name is optional. Also the group name is optional. In case of missing group name, the matching devices are
not grouped but shown as separate widgets without titles.
For further details on the devspec format see <a href="#devspec">Dev-Spec</a>.
<a name="dashboard_tab1devices"></a>
<li><b>dashboard_tab1devices </b><br>
DevSpec list of devices that should appear in the tab. (also valid for further dashboard_tabXdevices) <br>
The format is: <br><br>
<ul>
GROUPNAME:devspec1,devspec2,...,devspecX:ICONNAME <br><br>
</ul>
ICONNAME is optional. Also GROUPNAME is optional. In case of missing GROUPNAME, the matching devices are
not grouped, but shown as separate widgets without titles.
For further details on the DevSpec format see <a href="#devspec">DevSpec</a>.
</li><br>
<a name="dashboard_tabXicon"></a>
<li><b>dashboard_tabXicon </b><br>
Set the icon for a Tab. There must exist an icon with the name ico.(png|svg) in the modpath directory. If the image is
<a name="dashboard_tab1icon"></a>
<li><b>dashboard_tab1icon </b><br>
Set the icon for a Tab. (also valid for further dashboard_tabXicon) <br>
There must exist an icon with the name ico.(png|svg) in the modpath directory. If the image is
referencing an SVG icon, then you can use the @colorname suffix to color the image.
</li><br>
<a name="dashboard_tabXcolcount"></a>
<li><b>dashboard_tabXcolcount </b><br>
Number of columns for a specific tab in which the groups can be displayed. Nevertheless, it is possible to have
multiple groups. <br>
to be positioned in a column next to each other. This depends on the width of columns and groups. <br>
<a name="dashboard_tab1colcount"></a>
<li><b>dashboard_tab1colcount </b><br>
Number of columns for a specific tab in which the groups can be displayed. (also valid for further dashboard_tabXcolcount) <br>
Nevertheless, it is possible to have multiple groups to be positioned in a column next to each other.
This depends on the width of columns and groups. <br>
Default: &lt;dashboard_colcount&gt;
</li><br>
<a name="dashboard_tabXbackgroundimage"></a>
<li><b>dashboard_tabXbackgroundimage </b><br>
Shows a background image for the X tab. The image is not stretched in any way, it should therefore match the tab size
or extend it.
<a name="dashboard_tab1backgroundimage"></a>
<li><b>dashboard_tab1backgroundimage </b><br>
Shows a background image for the tab. (also valid for further dashboard_tabXbackgroundimage) <br>
The image is not stretched in any way, it should therefore match the tab size or extend it.
</li><br>
<a name="dashboard_width"></a>
<li><b>dashboard_width </b><br>
To determine the Dashboardwidth. The value can be specified, or an absolute width value (eg 1200) in pixels in% (eg 80%).<br>
Default: 100%
</li>
<br>
<a name="dashboard_noLinks"></a>
<li><b>dashboard_noLinks</b><br>
No link generation to the detail view of the devices takes place. <br><br>
@ -1299,6 +1397,26 @@ return;
</li>
<br>
<a name="dashboard_webRefresh"></a>
<li><b>dashboard_webRefresh </b><br>
With this attribute the FHEMWEB-Devices are determined, which: <br><br>
<ul>
<li> are activating the tab of a dashboard when the attribute "dashboard_homeTab" will be set </li>
<li> are positioning to the tab specified by command "set &lt;name&gt; activateTab" </li>
</ul>
<br>
(default: all)
<br>
</li>
<br>
<a name="dashboard_width"></a>
<li><b>dashboard_width </b><br>
To determine the Dashboardwidth. The value can be specified, or an absolute width value (eg 1200) in pixels in% (eg 80%).<br>
Default: 100%
</li>
<br>
</ul>
</ul>
</ul>
@ -1309,9 +1427,13 @@ return;
<a name="Dashboard"></a>
<h3>Dashboard</h3>
<ul>
Erstellt eine Übersicht in der Gruppen angeordnet werden können. Dabei können die Gruppen mit Drag'n Drop frei positioniert<br>
und in mehreren Spalten angeordnet werden. Auch kann die Breite und Höhe einer Gruppe über die Mindestgröße hinaus gezogen
werden.
Erstellt eine Übersicht in der Gruppen und/oder Geräte angeordnet werden können. Dabei können die Objekte mit Drag'n Drop
frei positioniert und in mehreren Spalten angeordnet werden. Auch kann die Breite und Höhe eines Objektes über die
Mindestgröße hinaus gezogen werden. <br><br>
<b>Hinweis: </b><br>
Ein Gruppenname im Dashboard bzw. dem Attribut "dashboard_tabXgroups" entspricht der Gruppe in FHEM und stellt die darin enthaltenen
Geräte im Dashboard dar.
<br>
<br>
@ -1341,8 +1463,15 @@ return;
<ul>
<ul>
<li><b>set &lt;name&gt; activateTab &lt;TabNo&gt; </b><br>
Das Tab mit der angegebenen Nummer wird im Dashboard aktiviert.
Ist das Attribut "dashboard_homeTab" gesetzt, wird das in diesem Attribut
definierte Tab beim nächsten Browser-Refresh reaktiviert. <br>
<br>
</li>
<li><b>set &lt;name&gt; lock </b><br>
Sperrt das Dashboard sodass keine Positionsänderungen vorgenommen werden können. <br>
Sperrt das Dashboard. Es können keine Positionsänderungen vorgenommen werden. <br>
<br>
</li>
@ -1385,12 +1514,6 @@ return;
<ul>
<ul>
<a name="dashboard_activetab"></a>
<li><b>dashboard_activetab </b><br>
Legt das aktuell aktivierte Tab fest. Wenn nicht gesetzt, wird das zuletzt aktivierte Tab ausgewählt (Default: 1)
</li>
<br>
<a name="dashboard_backgroundimage"></a>
<li><b>dashboard_backgroundimage </b><br>
Zeig in Hintergrundbild im Dashboard an. Das Bild wird nicht gestreckt, es sollte daher auf die Größe des Dashboards
@ -1422,6 +1545,12 @@ return;
</li>
<br>
<a name="dashboard_homeTab"></a>
<li><b>dashboard_homeTab </b><br>
Legt das aktuell aktivierte Tab fest. Wenn nicht gesetzt, wird das zuletzt gewählte Tab das aktive Tab. (Default: 1)
</li>
<br>
<a name="dashboard_row"></a>
<li><b>dashboard_row </b><br>
Auswahl welche Zeilen angezeigt werden sollen. top (nur Oben), center (nur Mitte), bottom (nur Unten) und den
@ -1483,38 +1612,47 @@ return;
Standard: 0
</li><br>
<a name="dashboard_tabXname"></a>
<li><b>dashboard_tabXname </b><br>
Titel des X Tab.
<a name="dashboard_tab1name"></a>
<li><b>dashboard_tab1name </b><br>
Titel des Tab. (gilt ebenfalls für weitere dashboard_tabXname)
</li>
<br>
<a name="dashboard_tabXsorting"></a>
<li><b>dashboard_tabXsorting </b><br>
Enthält die Positionierung jeder Gruppe im Tab X. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht
empfohlen dieses Attribut manuell zu ändern.
<a name="dashboard_tab1sorting"></a>
<li><b>dashboard_tab1sorting </b><br>
Enthält die Positionierung jeder Gruppe im Tab. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht
empfohlen dieses Attribut manuell zu ändern. (gilt ebenfalls für weitere dashboard_tabXsorting)
</li>
<br>
<a name="dashboard_tabXgroups"></a>
<a name="dashboard_tab1groups"></a>
<li><b>dashboard_tab1groups </b><br>
Durch Komma getrennte Liste mit den Namen der Gruppen, die im Tab 1 angezeigt werden. Falsche Gruppennamen werden
hervorgehoben. <br>
Durch Komma getrennte Liste der FHEM-Gruppen (siehe Attribut "group" eines Devices), die im Tab angezeigt werden.
(gilt ebenfalls für weitere dashboard_tabXgroups)
Falsche Gruppennamen werden hervorgehoben. <br>
Jede Gruppe kann zusätzlich ein Icon anzeigen, dazu muss der Gruppen name um ":&lt;icon&gt;@&lt;farbe&gt;"ergänzt
werden. <br>
Beispiel: Light:Icon_Fisch@blue,AVIcon_Fisch@red,Single Lights:Icon_Fisch@yellow<br/>
Der Gruppenname kann ebenfalls einen regulären Ausdruck beinhalten, um alle Gruppen anzuzeigen, die darauf passen.<br/>
Beispiel: .*Licht.* zeigt alle Gruppen an, die das Wort "Licht" im Namen haben.
werden. <br><br>
<b>Beispiel: </b><br>
Light:Icon_Fisch@blue,AVIcon_Fisch@red,Single Lights:Icon_Fisch@yellow <br><br>
Der Gruppenname kann ebenfalls einen regulären Ausdruck beinhalten, um alle Gruppen anzuzeigen, die darauf passen. <br><br>
<b>Beispiel: </b><br>
.*Licht.* zeigt alle Gruppen an, die das Wort "Licht" im Namen haben.
</li>
<br>
<a name="dashboard_tabXdevices"></a>
<li><b>dashboard_tabXdevices </b><br>
devspec Liste von Geräten, die im Tab angezeigt werden sollen. Das format ist:<br/>
GROUPNAME:devspec1,devspec2,...,devspecN:ICONNAME</br/>
Das Icon ist optional. Auch der Gruppenname muss nicht vorhanden sein. Im Falle dass dieser fehlt, werden die gefunden
Geräte nicht gruppiert sondern als einzelne Widgets im Tab angezeigt. Für weitere Details bezüglich devspec:
<a href="#devspec">Dev-Spec</a>
<a name="dashboard_tab1devices"></a>
<li><b>dashboard_tab1devices </b><br>
DevSpec Liste von Geräten, die im Tab angezeigt werden sollen. (gilt ebenfalls für weitere dashboard_tabXdevices) <br>
Das Format ist: <br><br>
<ul>
GROUPNAME:devspec1,devspec2,...,devspecX:ICONNAME <br><br>
</ul>
ICONNAME ist optional. Auch GROUPNAME muss nicht vorhanden sein. Fehlt GROUPNAME, werden die angegebenen
Geräte nicht gruppiert, sondern als einzelne Widgets im Tab angezeigt. Für weitere Details bezüglich DevSpec:
<a href="#devspec">DevSpec</a>
</li>
<br>
@ -1525,27 +1663,20 @@ return;
</li>
<br>
<a name="dashboard_tabXcolcount"></a>
<li><b>dashboard_tabXcolcount </b><br>
Die Anzahl der Spalten im Tab X in der Gruppen dargestellt werden können. Dennoch ist es möglich, mehrere Gruppen <br>
in einer Spalte nebeneinander zu positionieren. Dies ist abhängig von der Breite der Spalten und Gruppen. <br>
<a name="dashboard_tab1colcount"></a>
<li><b>dashboard_tab1colcount </b><br>
Die Anzahl der Spalten im Tab in der Gruppen dargestellt werden können. (gilt ebenfalls für weitere dashboard_tabXcolcount) <br>
Dennoch ist es möglich, mehrere Gruppen in einer Spalte nebeneinander zu positionieren. Dies ist abhängig von der Breite
der Spalten und Gruppen. <br>
Gilt nur für die mittlere Spalte! <br>
Standard: &lt;dashboard_colcount&gt;
</li>
<br>
<a name="dashboard_tabXbackgroundimage"></a>
<li><b>dashboard_tabXbackgroundimage </b><br>
Zeigt ein Hintergrundbild für den X-ten Tab an. Das Bild wird nicht gestreckt, es sollte also auf die Größe des Tabs
passen oder diese überschreiten.
</li>
<br>
<a name="dashboard_width"></a>
<li><b>dashboard_width </b><br>
Zum bestimmen der Dashboardbreite. Der Wert kann in % (z.B. 80%) angegeben werden oder als absolute Breite (z.B. 1200)
in Pixel.<br>
Standard: 100%
<a name="dashboard_tab1backgroundimage"></a>
<li><b>dashboard_tab1backgroundimage </b><br>
Zeigt ein Hintergrundbild für den Tab an. (gilt ebenfalls für weitere dashboard_tabXbackgroundimage) <br>
Das Bild wird nicht gestreckt, es sollte also auf die Größe des Tabs passen oder diese überschreiten.
</li>
<br>
@ -1559,6 +1690,28 @@ return;
</li>
<br>
<a name="dashboard_webRefresh"></a>
<li><b>dashboard_webRefresh </b><br>
Mit diesem Attribut werden FHEMWEB-Devices bestimmt, die: <br><br>
<ul>
<li> beim Setzen des Attributes "dashboard_homeTab" diesen Tab im Dashboard sofort aktivieren </li>
<li> beim Ausführen von "set &lt;name&gt; activateTab" auf diesen Tab im Dashboard positionieren </li>
</ul>
<br>
(default: alle)
<br>
</li>
<br>
<a name="dashboard_width"></a>
<li><b>dashboard_width </b><br>
Zum bestimmen der Dashboardbreite. Der Wert kann in % (z.B. 80%) angegeben werden oder als absolute Breite (z.B. 1200)
in Pixel.<br>
Standard: 100%
</li>
<br>
</ul>
</ul>
</ul>

View File

@ -439,7 +439,7 @@ FHEM/94_PWM.pm jamesgo Heizungssteuerung/Raumklima
FHEM/95_Alarm.pm pahenning Unterstützende Dienste
FHEM/95_Astro.pm pahenning,loredo,CoolTux Unterstützende Dienste
FHEM/95_Babble.pm pahenning Unterstützende Dienste
FHEM/95_Dashboard.pm DS_Starter/orphan Frontends
FHEM/95_Dashboard.pm DS_Starter Frontends
FHEM/95_FLOORPLAN.pm ulimaass Frontends/FLOORPLAN
FHEM/95_holiday.pm rudolfkoenig Sonstiges
FHEM/95_PostMe.pm pahenning Unterstützende Dienste

View File

@ -1,26 +1,26 @@
//########################################################################################
//###########################################################################################################################################
// dashboard.js
//########################################################################################
//###########################################################################################################################################
// Released : 14.11.2013 Sascha Hermann
// Version :
// 1.01: Released to testers
// 1.02: Add DebugMsg. Fix independent Groupsize adjustment after set & siterefresh. Fix
// wrong set of +Toogle Icon on Siderefresh
// 2.00: First Changes vor Dashboard Tabs. Change method store Positiondata. optimization restore Positiondata. Clear poor routines.
// Change max/min Values for Groupresize. Top- and Bottom-Row always 100%
// 2.01: Add Longpoll function. Dashboard can hide FHEMWEB Roomliste and Header.
// 2.02: Tabs can set on top, bottom or hidden
// 2.03: Fix showhelper Bug on lock/unlock. The error that after a trigger action the curren tab is changed to the "old" activetab tab has
// been fixed.
// 2.04: Dashboard position near Top in showfullsize-mode. Restore ActiveTab funktion
// 2.05: Delete function for set lockstate
// 2.06: change Set and Detail Button.
// 2.07: Insert Configdialog for Tabs. Change handling of parameters in both directions.
// Modified : 24.09.2019 Heiko Maaz
//
// Known Bugs/Todo's
// See 95_Dashboard.pm
//########################################################################################
//########################################################################################
// Version :
// 2.0.8: dashboard_load_tab(tabIndex) test of defined fhemUrl
// 2.0.7: Insert Configdialog for Tabs. Change handling of parameters in both directions.
// 2.0.6: change Set and Detail Button.
// 2.0.5: Delete function for set lockstate
// 2.0.4: Dashboard position near Top in showfullsize-mode. Restore ActiveTab funktion
// 2.0.3: Fix showhelper Bug on lock/unlock. The error that after a trigger action the curren tab is changed to the "old" activetab tab has
// been fixed.
// 2.0.2: Tabs can set on top, bottom or hidden
// 2.0.1: Add Longpoll function. Dashboard can hide FHEMWEB Roomliste and Header.
// 2.0.0: First Changes vor Dashboard Tabs. Change method store Positiondata. optimization restore Positiondata. Clear poor routines.
// Change max/min Values for Groupresize. Top- and Bottom-Row always 100%
// 1.0.2: Add DebugMsg. Fix independent Groupsize adjustment after set & siterefresh. Fix
// wrong set of +Toogle Icon on Siderefresh
// 1.0.1: Released to testers
//
//###########################################################################################################################################
var DashboardConfigHash = {};
var dashboard_buttonbar = "top";
@ -472,14 +472,16 @@ function dashboard_load_tab(tabIndex) {
return;
}
dashboard_getData(
fhemUrl+"?cmd=get "+$('#dashboard_define').text(),
"tab " + tabIndex,
"html",
function (tabIndex, data) {
dashboard_insert_tab(tabIndex, data);
}.bind(null, tabIndex)
);
if (typeof(fhemUrl) !== 'undefined') {
dashboard_getData(
fhemUrl+"?cmd=get "+$('#dashboard_define').text(),
"tab " + tabIndex,
"html",
function (tabIndex, data) {
dashboard_insert_tab(tabIndex, data);
}.bind(null, tabIndex)
);
}
}
function dashboard_insert_tab(tabIndex, content) {