diff --git a/fhem/CHANGED b/fhem/CHANGED index 84fdbd7e0..08f8c5b56 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,8 @@ # 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. - SVN + - feature: Dashboard: The display of the dashboard can be limited to a + defined FHEMWEB. Change view of readingroups - feature: new module 70_JSONMETER to read obis compatible data in json format from so called smart meters for electricity, gas or heat - feature: new modules 10_RESIDENTS, 20_ROOMMATE and 20_GUEST added (loredo) diff --git a/fhem/FHEM/95_Dashboard.pm b/fhem/FHEM/95_Dashboard.pm index dc4d9dd0b..ea0b33590 100644 --- a/fhem/FHEM/95_Dashboard.pm +++ b/fhem/FHEM/95_Dashboard.pm @@ -34,13 +34,14 @@ # 2.03: dashboard_showfullsize only in DashboardRoom. Tabs can show Icons (new Attributes). 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. dashboard_activetab # is stored after tab change +# 2.04: change view of readingroups. Attribute dashboard_groups removed. New Attribute dashboard_webfrontendfilter to define +# separate Dashboards per FHEMWEB Instance. # # Known Bugs/Todos: # BUG: Nicht alle Inhalte aller Tabs laden, bei Plots dauert die bedienung des Dashboards zu lange. -> elemente hidden? -# x BUG: wenn ich mehrere Tabs habe und zb. im Uten Tab eine Lampe schalte, springt er danach direkt in den ersten Tab. Finde ich etwas unglücklich. -# x BUG: Lock blendet schow helper nicht aus? -# x BUG: dashboard_showfullsize nicht in room everything -# x TODO: Icon on Tabs +# x TODO: Dashboard Config diverenzieren je auflösung +# x TODO: Darstellung von z.B. readingGroups +# TODO: personalisiertes CSS angeben und bestehende CSS zu überschreiben -> User-config # Log 1, "[DASHBOARD simple debug] '".$g."' "; ######################################################################################## # @@ -85,7 +86,7 @@ my $fwjquery = "jquery.min.js"; my $fwjqueryui = "jquery-ui.min.js"; my $dashboardname = "Dashboard"; # Link Text my $dashboardhiddenroom = "DashboardRoom"; # Hiddenroom -my $dashboardversion = "2.03"; +my $dashboardversion = "2.04"; # ------------------------------------------------------------------------------------------- sub Dashboard_Initialize ($) { @@ -135,9 +136,10 @@ sub Dashboard_Initialize ($) { "dashboard_tab3icon ". "dashboard_tab4icon ". "dashboard_tab5icon ". + #new attribute vers. 2.04 + "dashboard_webfrontendfilter ". #obsolete - erase in future releases - "dashboard_groups ". # obsolet -> erase in future releases "dashboard_colheight ". # obsolet -> erase in future releases "dashboard_sorting ". # obsolet -> erase in future releases "dashboard_colwidth ". # obsolet -> erase in future releases @@ -175,6 +177,7 @@ sub DashboardAsHtml($) my $showtabs = AttrVal($defs{$d}{NAME}, "dashboard_showtabs", "tabs-and-buttonbar-at-the-top"); my $showtooglebuttons = AttrVal($defs{$d}{NAME}, "dashboard_showtooglebuttons", 1); my $showfullsize = AttrVal($defs{$d}{NAME}, "dashboard_showfullsize", 0); + my $webfrontendfilter = AttrVal($defs{$d}{NAME}, "dashboard_webfrontendfilter", "*"); my $row = AttrVal($defs{$d}{NAME}, "dashboard_row", "center"); my $debug = AttrVal($defs{$d}{NAME}, "dashboard_debug", "0"); @@ -227,6 +230,21 @@ sub DashboardAsHtml($) return $ret; } + ############# Filter Dashboard display depending on $FW_wname ################################### + if ($webfrontendfilter ne "*") { + my $filterhit = 0; + my @webfilter = split(",", $webfrontendfilter); + for (my $i=0;$i<@webfilter;$i++){ + if (trim($FW_wname) eq trim($webfilter[$i])) { $filterhit = 1; } + } + if ($filterhit == 0) { + $ret .= "No Dashboard configured for ".$FW_wname."
"; + $ret .= "Set Attribute dashboard_webfrontendfilter, see Details"; + return $ret; + } + } + ################################################################################## + if ($debug == 1) { $debugfield = "edit" }; if ($showtabs eq "tabs-and-buttonbar-at-the-top") { $showbuttonbar = "top"; } if ($showtabs eq "tabs-and-buttonbar-on-the-bottom") { $showbuttonbar = "bottom"; } @@ -418,18 +436,40 @@ sub BuildGroup($) my $type = $defs{$d}{TYPE}; my $devName = AttrVal($d, "alias", $d); my $icon = AttrVal($d, "icon", ""); + $icon = FW_makeImage($icon,$icon,"icon dashboard_groupicon") . " " if($icon); - if($FW_hiddenroom{detail}) { $ret .= "
$icon$devName
"; } + if($FW_hiddenroom{detail}) { + $ret .= "
$icon$devName
"; + } else { if ($type ne "weblink" && $type ne "SVG" && $type ne "readingsGroup") { # Don't show Link by weblink, svg and readingsGroup - $ret .=FW_pH "detail=$d", "$icon$devName", 1, "col1", 1; + $ret .= FW_pH "detail=$d", "$icon$devName", 1, "col1", 1; } - } + } + $row++; my ($allSets, $cmdlist, $txt) = FW_devState($d, $rf, \%extPage); - $ret .= "$txt"; + + ################ Edit Result for readingroup etc. ##################### + my @txtarray = split(">", $txt); + if ($type eq "readingsGroup" && $txtarray[0] eq " -1) {$storeinfo = 0; } + if ($storeinfo == 3) { $txtreturn .= $txtarray[$i].">"; } + if ($storeinfo == 2 && index($txtarray[$i]," -1 ) { $storeinfo = $storeinfo+1;} + if ($storeinfo == 1 && index($txtarray[$i]," -1 ) { $linkreturn = $txtarray[$i].">"; } + if (index($txtarray[$i]," -1) {$storeinfo = $storeinfo+1; } + } + ####if ($helper == 1) {$txtreturn .= "";} + $ret .= "$txtreturn"; + } else { $ret .= "$txt"; } + ########################################################### ###### Commands, slider, dropdown if(!$FW_ss && $cmdlist) { @@ -448,7 +488,7 @@ sub BuildGroup($) if($htmlTxt) { $ret .= $htmlTxt; } else { - $ret .=FW_pH "cmd.$d=set $d $cmd$rf", $cmd, 1, "col3", 1; + $ret .= FW_pH "cmd.$d=set $d $cmd$rf", $cmd, 1, "col3", 1; } } } @@ -544,12 +584,6 @@ sub CheckDashboardAttributUssage($) { # replaces old disused attributes and thei { FW_fC("deleteattr ".$d." dashboard_colheight"); } $detailnote = $detailnote." [dashboard_colheight -> dashboard_rowcenterheight]"; } - my $groups = AttrVal($defs{$d}{NAME}, "dashboard_groups", ""); - if ($groups ne "") { - { FW_fC("attr ".$d." dashboard_tab1groups ".$groups); } - { FW_fC("deleteattr ".$d." dashboard_groups"); } - $detailnote = $detailnote." [dashboard_groups -> dashboard_tab1groups]"; - } my $sorting = AttrVal($defs{$d}{NAME}, "dashboard_sorting", ""); if ($sorting ne "") { #convert old sorting in new my @sortings = split(":", $sorting); @@ -593,7 +627,7 @@ sub CheckDashboardAttributUssage($) { # replaces old disused attributes and thei # ------------------------------------------------------------------------------------------------------------------------ # Get out any change to the Logfile - if ($buttonbar ne "" || $groups ne "" || $sorting ne "") { + if ($buttonbar ne "" || $sorting ne "") { 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. ".$detailnote; } } @@ -641,7 +675,7 @@ sub Dashboard_define ($$) { CheckInstallation($hash); CheckDashboardEntry($hash); - + return; } @@ -751,6 +785,16 @@ sub Dashboard_attr($$$) {
  • dashboard_tab5name
    Title of Tab 5. Default: Dashboard-Tab 5 +

  • + +
  • dashboard_webfrontendfilter
    + If this attribute not set, or value is * the dashboard is displayed on all configured FHEMWEB instances.
    + Set the Name of an FHEMWEB instance (eg WEB) to the Dashboard appears only in this.
    + There may be several valid instances are separated by comma eg WEB,WEBtablet.
    + This makes it possible to define an additional dashboard that only Show on Tablet (which of course an own instance FHEMWEB use).
    + Default: * +
    + It should NEVER two ore more activ dashboards in a FHEMWEB instance!

  • dashboard_sorting
    @@ -822,11 +866,6 @@ sub Dashboard_attr($$$) { Height of the bottom row in which the groups may be positioned.
    Default: 250

  • - -
  • dashboard_groups
    - This attribute is no longer used and will be removed at a later date. It was replaced with
    - dashboard_tab1groups, dashboard_tab2groups, dashboard_tab3groups, dashboard_tab4groups, dashboard_tab5groups -

  • dashboard_tab1groups
    Comma-separated list of the names of the groups to be displayed in Tab 1. @@ -955,38 +994,48 @@ sub Dashboard_attr($$$) {
  • dashboard_tabcount
    Gibt die Anzahl der angezeigten Tabs an. - Default: 1 + Standard: 1

  • dashboard_activetab
    Gibt an welches Tab aktiviert ist. Kann manuell gesetzt werden, wird aber auch durch den Schalter "Set" auf das gerade aktive Tab gesetzt. - Default: 1 + Standard: 1

  • dashboard_tab1name
    Titel des 1. Tab. - Default: Dashboard-Tab 1 + Standard: Dashboard-Tab 1

  • dashboard_tab2name
    Titel des 2. Tab. - Default: Dashboard-Tab 2 + Standard: Dashboard-Tab 2

  • dashboard_tab3name
    Titel des 3. Tab. - Default: Dashboard-Tab 3 + Standard: Dashboard-Tab 3

  • dashboard_tab4name
    Titel des 4. Tab. - Default: Dashboard-Tab 4 + Standard: Dashboard-Tab 4

  • dashboard_tab5name
    Titel des 5. Tab. - Default: Dashboard-Tab 5 -

  • + Standard: Dashboard-Tab 5 +
    + +
  • dashboard_webfrontendfilter
    + Ist dieses Attribut nicht gesetzt, oder hat den Wert * wird das Dashboard auf allen konfigurierten FHEMWEB Instanzen angezeigt.
    + Wird dem Attribut der Name einer FHEMWEB Instanz (z.B. WEB) zugewiesen so wird das Dashboard nur in dieser Instanz angezeigt.
    + Es können auch mehrere Instanzen durch Komma getrennt angegeben werden, z.B. WEB,WEBtablet. Dadurch ist es möglich ein
    + zusätzliches Dashboard zu definieren und dieses nur z.B. auf Tablet anzeigen zulassen (die natürlich eine eigenen FHEMWEB Instanz verwenden).
    + Standard: *
    +
    + Es dürfen NIE zwei Dashboards in einer FHEMWEB instanz aktiv sein! +

  • dashboard_sorting
    Dieses Attribut ist nicht mehr zu verwenden und wird zu einem späteren Zeitpunkt entfernt. Es wurde ersetzt durch
    @@ -1057,11 +1106,6 @@ sub Dashboard_attr($$$) { Höhe der unteren Zeile, in der die Gruppen angeordnet werden.
    Standard: 250

  • - -
  • dashboard_groups
    - Dieses Attribut ist nicht mehr zu verwenden und wird zu einem späteren Zeitpunkt entfernt. Es wurde ersetzt durch
    - dashboard_tab1groups, dashboard_tab2groups, dashboard_tab3groups, dashboard_tab4groups, dashboard_tab5groups. -

  • dashboard_tab1groups
    Durch Komma getrennte Liste mit den Namen der Gruppen, die im Tab 1 angezeigt werden. Falsche Gruppennamen werden hervorgehoben.