From 233bae8b9d45bac6f9d94a02f637de6cd58c07b0 Mon Sep 17 00:00:00 2001 From: justme1968 Date: Wed, 26 Feb 2014 15:43:44 +0000 Subject: [PATCH] added sortDevices attribute git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@5053 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/33_readingsGroup.pm | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 086557eab..fac649546 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +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. - SVN + - feature: readingsGroup: added sortDevices attribute - feature: ENIGMA2: new reading 'recordings', new command record - change: ENIGMA2: rewrite for NonBlocking - feature: SYSMOM: new Plot + Doc diff --git a/fhem/FHEM/33_readingsGroup.pm b/fhem/FHEM/33_readingsGroup.pm index a84e23a9b..64ce97df9 100644 --- a/fhem/FHEM/33_readingsGroup.pm +++ b/fhem/FHEM/33_readingsGroup.pm @@ -40,7 +40,7 @@ sub readingsGroup_Initialize($) #$hash->{SetFn} = "readingsGroup_Set"; $hash->{GetFn} = "readingsGroup_Get"; $hash->{AttrFn} = "readingsGroup_Attr"; - $hash->{AttrList} = "disable:1,2,3 nameIcon valueIcon mapping separator style nameStyle valueColumns valueStyle valueFormat commands timestampStyle noheading:1 nolinks:1 notime:1 nostate:1 alwaysTrigger:1"; + $hash->{AttrList} = "disable:1,2,3 nameIcon valueIcon mapping separator style nameStyle valueColumns valueStyle valueFormat commands timestampStyle noheading:1 nolinks:1 notime:1 nostate:1 alwaysTrigger:1 sortDevices:1"; $hash->{FW_detailFn} = "readingsGroup_detailFn"; $hash->{FW_summaryFn} = "readingsGroup_detailFn"; @@ -129,6 +129,12 @@ readingsGroup_updateDevices($) } } + if( AttrVal( $hash->{NAME}, "sortDevices", 0 ) == 1 ) { + @devices = sort { my $aa = @{$a}[0]; my $bb = @{$b}[0]; + lc(AttrVal($aa,"sortby",AttrVal($aa,"alias",$aa))) cmp + lc(AttrVal($bb,"sortby",AttrVal($bb,"alias",$bb))) } @devices; + } + $hash->{CONTENT} = \%list; $hash->{DEVICES} = \@devices; @@ -974,6 +980,8 @@ readingsGroup_Attr($$$) 1 -> disable notify processing and longpoll updates. Notice: this also disables rename and delete handling.
2 -> also disable html table creation
3 -> also disable html creation completely +
  • sortDevices
    + 1 -> sort the device lines alphabetically. use the first of sortby or alias or name that is defined for each device.
  • noheading
    If set to 1 the readings table will have no heading.
  • nolinks