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

some changes on jsonlist

git-svn-id: https://svn.fhem.de/fhem/trunk@1125 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mfr69bs 2011-12-01 21:27:08 +00:00
parent 8ca91716a9
commit bd85ca7030
7 changed files with 289 additions and 314 deletions

View File

@ -22,6 +22,8 @@
- bugfix: CUL_WS rain sensor corr1 fix
- feature: FHEMWEB stylesheet attribute repaced with stylesheetPrefix
- feature: notify attribute forwardReturnValue
- change: move JsonList from contrib to main-modules
- change: JsonList output optimized and more structured
- 2011-07-08 (5.1)

View File

@ -1,4 +1,5 @@
################################################################
# $Id$
#
# Copyright notice
#
@ -133,11 +134,11 @@ CommandJsonList($$)
my $q = "";
# Open JSON object
# open JSON object
$str = "{\n";
$str .= sprintf("%*s\"ResultSet\": {\n", $lev, " ");
# Open JSON array
$str .= sprintf("%*s\"Results\": [\n", $lev+2, " ");
$str .= sprintf("%*s\"ResultSet\": \"%s\",\n", $lev, " ","full");
# open JSON array
$str .= sprintf("%*s\"Results\": [\n", $lev, " ");
delete($modules{""}) if(defined($modules{""}));
@dc = keys(%defs);
@ -151,18 +152,9 @@ CommandJsonList($$)
my $t = $p->{TYPE};
$t = $q if($q ne "");
$str .= sprintf("} ") if($t eq $lt);
$str .= sprintf("},\n") if($t eq $lt);
if($t ne $lt) {
$str .= sprintf("} ") if($lt);
$str .= sprintf("}\n") if($lt);
$str .= sprintf("%*s]\n", $lev+6, " ") if($lt);
$str .= sprintf("%*s},\n", $lev+4, " ") if($lt);
#$str .= sprintf("%*s{\n", $lev+4, " ");
$str .= sprintf("%*s\{ \"%s_LIST\": [\n", $lev+4, " ", $t);
}
$lt = $t;
#$str .= sprintf("} ") if($t eq $lt);
#$str .= sprintf("},\n") if($t eq $lt);
#$str .= sprintf("%*s},\n", $lev+6, " ") if($t eq $lt);
my $a1 = JsonEscape($p->{STATE});
my $a2 = JsonEscape(getAllSets($d));
@ -176,35 +168,39 @@ CommandJsonList($$)
push @attrs, $k3;
}
# close device object
$str .= sprintf("%*s},\n", $lev+6, " ") if($t eq $lt);
if($t ne $lt) {
# close device opject
$str .= sprintf("%*s}\n", $lev+6, " ") if($lt && $t ne $lt);
#$str .= sprintf("}\n") if($lt);
# close devices array
$str .= sprintf("%*s]\n", $lev+4, " ") if($lt);
# close list object
$str .= sprintf("%*s},\n", $lev+2, " ") if($lt);
#$str .= sprintf("%*s{\n", $lev+4, " ");
# open list object
$str .= sprintf("%*s\{\n", $lev+2, " ");
$str .= sprintf("%*s\"%s\": \"%s\",\n", $lev+4, " ", "list", $t);
# open devices array
$str .= sprintf("%*s\"%s\": [\n", $lev+4, " ", "devices");
}
$lt = $t;
#$str .= sprintf("%*s{\n", $lev+8, " ");
$str .= sprintf("%*s{ \"%s\": { ", $lev+8, " ", $t);
$str .= sprintf("\"name\": \"%s\", ", $d);
$str .= sprintf("\"state\": \"%s\", ", $a1);
$str .= sprintf("\"sets\": [ ");
$ac = @sets;
$cc = 0;
foreach my $set (@sets) {
$str .= sprintf("{ \"VAL\": \"%s\" }", $set);
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= ", " if($cc != $ac);
#$str .= "\n" if($cc == $ac);
}
$str .= sprintf(" ], ");
$str .= sprintf("\"attrs\": [ ");
$ac = @attrs;
$cc = 0;
foreach my $attr (@attrs) {
$str .= sprintf("{ \"VAL\": \"%s\" }", $attr);
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= "," if($cc != $ac);
#$str .= "\n" if($cc == $ac);
}
$str .= sprintf(" ], ");
# open device object
$str .= sprintf("%*s{\n", $lev+6, " ");
$str .= sprintf("\"INT\": { ");
#$str .= sprintf("%*s\"name\": \"%s\",\n", $lev+8, " ", $d);
#$str .= sprintf("%*s\"state\": \"%s\",\n", $lev+8, " ", $a1);
#$str .= sprintf("\"INT\": { ");
@ac = keys(%{$p});
$ac = 0;
foreach my $k (sort @ac) {
@ -215,62 +211,107 @@ CommandJsonList($$)
foreach my $c (sort keys %{$p}) {
next if(ref($p->{$c}));
$str .= sprintf("\"%s\": \"%s\"",
$str .= sprintf("%*s\"%s\": \"%s\",\n", $lev+8, " ",
JsonEscape($c), JsonEscape($p->{$c}));
$cc++;
#$str .= ",\n" if($cc != $ac || ($cc == $ac && $p->{IODev}));
$str .= ", " if($cc != $ac || ($cc == $ac && $p->{IODev}));
#$str .= ",\n" if($cc != $ac || ($cc == $ac && $p->{IODev}));
#$str .= "\n" if($cc == $ac && !$p->{IODev});
}
$str .= sprintf("\"IODev\": \"%s\" ",
$str .= sprintf("%*s\"IODev\": \"%s\",\n", $lev+8, " ",
$p->{IODev}{NAME}) if($p->{IODev});
$str .= sprintf(" }, ");
#$str .= sprintf(" }, ");
$str .= sprintf("\"ATTR\": { ");
@ac = keys(%{$attr{$d}});
$ac = @ac;
$cc = 0;
foreach my $c (sort keys %{$attr{$d}}) {
$str .= sprintf("\"%s\": \"%s\"",
JsonEscape($c), JsonEscape($attr{$d}{$c}));
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= ", " if($cc != $ac);
#$str .= "\n" if($cc == $ac);
if($ac != 0) {
$str .= sprintf("%*s\"ATTR\": {\n", $lev+8, " ");
foreach my $c (sort keys %{$attr{$d}}) {
$str .= sprintf("%*s\"%s\": \"%s\"", $lev+10, " ",
JsonEscape($c), JsonEscape($attr{$d}{$c}));
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= ",\n" if($cc != $ac);
#$str .= "\n" if($cc == $ac);
}
$str .= "\n";
#$str .= sprintf("%*s]\n", $lev+8, " ") if(!$p->{READINGS});
#$str .= sprintf("%*s],\n", $lev+8, " ") if($p->{READINGS});
$str .= sprintf("%*s},\n", $lev+8, " ");
} else {
$str .= sprintf("%*s\"ATTR\": {},\n", $lev+8, " ");
}
$str .= sprintf(" }, ") if($p->{READINGS});
$str .= sprintf(" } ") if(!$p->{READINGS});
#$str .= sprintf("%*s],\n", $lev+8, " ") if($p->{READINGS});
#$str .= sprintf("%*s]\n", $lev+8, " ") if(!$p->{READINGS});
my $r = $p->{READINGS};
if($r) {
$str .= sprintf("\"STATE\": { ");
$str .= sprintf("%*s\"READINGS\": [\n", $lev+8, " ");
@ac = keys(%{$r});
$ac = @ac;
$cc = 0;
foreach my $c (sort keys %{$r}) {
$str .=
sprintf("\"%s\": \"%s\", \"measured\": \"%s\"",
JsonEscape($c), JsonEscape($r->{$c}{VAL}), $r->{$c}{TIME});
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= ", " if($cc != $ac);
#$str .= "\n" if($cc == $ac);
$str .= sprintf("%*s{\n", $lev+10, " ");
$str .= sprintf("%*s\"%s\": \"%s\",\n", $lev+12, " ", JsonEscape($c), JsonEscape($r->{$c}{VAL}));
$str .= sprintf("%*s\"measured\": \"%s\"\n", $lev+12, " ", $r->{$c}{TIME});
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= sprintf("%*s},\n", $lev+10, " ") if($cc != $ac);
$str .= sprintf("%*s}\n", $lev+10, " ") if($cc == $ac);
}
$str .= sprintf(" } ");
$str .= sprintf("%*s]\n", $lev+8, " ");
} else {
$str .= sprintf("%*s\"READINGS\": []\n", $lev+8, " ");
}
if($cc gt $ac) {
# corresponding set parameters
$str .= sprintf("%*s\"sets\": [\n", $lev+6, " ");
$ac = @sets;
$cc = 0;
foreach my $set (@sets) {
$str .= sprintf("%*s\"%s\"", $lev+8, " ", $set);
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= ",\n" if($cc != $ac);
#$str .= "\n" if($cc == $ac);
}
$str .= sprintf("\n%*s],\n", $lev+6, " ");
# corresponding attributes
$str .= sprintf("%*s\"attrs\": [\n", $lev+6, " ");
$ac = @attrs;
$cc = 0;
foreach my $attr (@attrs) {
$str .= sprintf("%*s\"%s\"", $lev+8, " ", $attr);
$cc++;
#$str .= ",\n" if($cc != $ac);
$str .= ",\n" if($cc != $ac);
$str .= "\n" if($cc == $ac);
}
}
$tc++;
$tr = $tc if($q eq "");
$tr++ if($q ne "" && $p->{TYPE} eq $t);
$str .= sprintf("} ") if(($tc == $dc) || (!$lt));
$str .= sprintf("}\n") if(($tc == $dc) || (!$lt));
$str .= sprintf("%*s]\n", $lev+6, " ") if(($tc == $dc) || (!$lt));
#$str .= sprintf("} ") if(($tc == $dc) || (!$lt));
#$str .= sprintf("+++}\n") if(($tc == $dc) || (!$lt));
$str .= sprintf("%*s}\n", $lev+6, " ") if(($tc == $dc) || (!$lt));
}
$str .= sprintf("%*s}\n", $lev+4, " ") if($lt);
$str .= sprintf("%*s],\n", $lev+2, " ");
$str .= sprintf("%*s\"totalResultsAvailable\": %s,\n", $lev+2, " ",$tc);
$str .= sprintf("%*s\"totalResultsReturned\": %s\n", $lev+2, " ",$tr);
$str .= sprintf("%*s}\n", $lev, " ");
$str .= "}";
$str .= sprintf("%*s]\n", $lev+4, " ") if($lt);
$str .= sprintf("%*s}\n", $lev+2, " ") if($lt);
# close JSON array
$str .= sprintf("%*s],\n", $lev, " ");
# return number of results
$str .= sprintf("%*s\"totalResultsReturned\": %s\n", $lev, " ",$tr);
# close JSON object
$str .= "}\n";
} else {
if($param eq "ROOMS") {
my @rooms;
@ -287,24 +328,23 @@ CommandJsonList($$)
# Open JSON object
$str .= "{\n";
$str .= sprintf("%*s\"%s\": {\n", $lev, " ", "ResultSet");
$str .= sprintf("%*s\"%s\": \"%s\",\n", $lev, " ", "ResultSet", "rooms");
# Open JSON array
$str .= sprintf("%*s\"%s\": [", $lev+2, " ", "Results");
$str .= sprintf("%*s\"%s\": [", $lev, " ", "Results");
for (my $i=0; $i<@rooms; $i++) {
$str .= " }," if($i <= $#rooms && $i > 0);
$str .= sprintf("\n%*s{ \"NAME\": \"%s\"", $lev+4, " ", $rooms[$i]);
$str .= "," if($i <= $#rooms && $i > 0);
$str .= sprintf("\n%*s\"%s\"", $lev+2, " ", $rooms[$i]);
$c++;
}
$str .= " }\n";
$str .= "\n";
# Close JSON array
$str .= sprintf("%*s],\n", $lev+2, " ");
$str .= sprintf("%*s],\n", $lev, " ");
# Result summary
$str .= sprintf("%*s\"%s\": %s,\n", $lev+2, " ", "totalResultsAvailable", $c);
$str .= sprintf("%*s\"%s\": %s\n", $lev+2, " ", "totalResultsReturned", $c);
#$str .= sprintf("%*s\"%s\": %s,\n", $lev, " ", "totalResultsAvailable", $c);
$str .= sprintf("%*s\"%s\": %s\n", $lev, " ", "totalResultsReturned", $c);
# Close JSON object
$str .= sprintf("%*s}\n", $lev, " ");
$str .= "}";
} else {
@ -328,9 +368,9 @@ CommandJsonList($$)
# Open JSON object
$str .= "{\n";
$str .= sprintf("%*s\"%s\": {\n", $lev, " ", "ResultSet");
$str .= sprintf("%*s\"%s\": \"%s\",\n", $lev, " ", "ResultSet", "devices#$listDev");
# Open JSON array
$str .= sprintf("%*s\"%s\": [", $lev+2, " ", "Results");
$str .= sprintf("%*s\"%s\": [", $lev, " ", "Results");
# Sort first by type then by name
for my $d (sort { my $x = $modules{$defs{$a}{TYPE}}{ORDER} cmp
@ -338,23 +378,22 @@ CommandJsonList($$)
$x = ($a cmp $b) if($x == 0); $x; } keys %defs) {
if($defs{$d}{TYPE} eq $param) {
my $t = $defs{$d}{TYPE};
$str .= " }," if($d ne $ld && $lt ne "");
$str .= sprintf("\n%*s{ \"NAME\": \"%s\", \"STATE\": \"%s\"",
$lev+4, " ", $d, $defs{$d}{STATE});
$str .= sprintf("\n%*s},",$lev+2, " ") if($d ne $ld && $lt ne "");
$str .= sprintf("\n%*s{",$lev+2, " ");
$str .= sprintf("\n%*s\"name\": \"%s\",",$lev+4, " ", $d);
$str .= sprintf("\n%*s\"state\": \"%s\"",$lev+4, " ", $defs{$d}{STATE});
$lt = $t;
$ld = $d;
$c++;
}
}
$str .= " }\n";
$str .= sprintf("\n%*s}\n",$lev+2, " ");
# Close JSON array
$str .= sprintf("%*s],\n", $lev+2, " ");
$str .= sprintf("%*s],\n", $lev, " ");
# Result summary
$str .= sprintf("%*s\"%s\": %s,\n", $lev+2, " ", "totalResultsAvailable", $c);
$str .= sprintf("%*s\"%s\": %s\n", $lev+2, " ", "totalResultsReturned", $c);
$str .= sprintf("%*s\"%s\": %s\n", $lev, " ", "totalResultsReturned", $c);
# Close JSON object
$str .= sprintf("%*s}\n", $lev, " ");
$str .= "}";
} else {

View File

@ -480,4 +480,8 @@
- Introducing 00_TUL.pm and 10_EIB.pm modules for connecting FHEM on EIB.
- Thu Aug 04 2011 (Boris)
- enabled logging for 59_Weather.pm
- enabled logging for 59_Weather.pm
- Thu Dec 01 2011 (Martin F.)
- Move JsonList from contrib to main modules. Jsonlist output is optimized
and now be more structured.

View File

@ -1,109 +0,0 @@
JsonList.pm - Copyright (c)2008 Martin Fischer <m_fischer@gmx.de>
Description:
The module JsonList.pm extends FHEM to support a JSON output
similar to FHEM's xmllist.
Installation:
Copy the script 99_JsonList.pm to FHEM modules directory, e.g.
'cp 99_JsonList.pm /usr/share/fhem/FHEM'
and restart FHEM.
Keep your commandref.html up-to-date:
copy the patchfile commandref.html.patch to your directory with
the original commandref.html and type
'patch < commandref.html.patch'
You can remove the patchfile after this step.
Usage:
jsonlist [<devspec>|<typespec>|ROOMS]
Returns an JSON tree of all definitions, all notify settings and
all at entries if no parameter is given.
If specifying <devspec>, then a detailed status for <devspec> will
be displayed.
If specifying <typespec>, then a list with the status for the
defined <typespec> devices will be displayed, e.g.:
If specifying ROOMS, then a list with the defined rooms will be
displayed, e.g.:
Example:
fhem> jsonlist
{
"ResultSet": {
"Results": [
{ "_internal__LIST": [
{ "_internal_": {
"name": "global",
"state": "",
"sets": [ { "VAL": "null" } ],
"attrs": [ { "VAL": "room" },{ "VAL": "comment" },
[...]
],
"totalResultsAvailable": 86,
"totalResultsReturned": 86
}
}
Example for <devspec>:
fhem> jsonlist lamp1
{
"ResultSet": {
"Results": {
"ATTRIBUTES": {
"comment": "Light",
"room": "Livingroom"
},
"BTN": "f0",
[...]
"NAME": "lamp1",
"NR": "26",
"READINGS": {
"state": {
"TIME": "2008-12-11 18:11:21",
"VAL": "toggle"
}
},
"STATE": "on",
"TYPE": "FS20",
"XMIT": "0b0b"
}
}
}
Example for <typespec>:
fhem> jsonlist HMS
{
"ResultSet": {
"Results": [
{ "NAME": "smokeDetector01", "STATE": "smoke_detect: off" },
{ "NAME": "smokeDetector02", "STATE": "smoke_detect: off" },
{ "NAME": "smokeDetector03", "STATE": "smoke_detect: off" }
],
"totalResultsAvailable": 3,
"totalResultsReturned": 3
}
}
Example for ROOMS:
fhem> jsonlist ROOMS
{
"ResultSet": {
"Results": [
{ "NAME": "Bathroom" },
{ "NAME": "Office" },
{ "NAME": "Diningroom" },
{ "NAME": "Garden" },
{ "NAME": "House" },
{ "NAME": "Bedroom" },
{ "NAME": "Garage" },
{ "NAME": "Livingroom" },
{ "NAME": "hidden" }
],
"totalResultsAvailable": 9,
"totalResultsReturned": 9
}
}

View File

@ -1,108 +0,0 @@
--- commandref.html-orig 2008-12-11 19:37:59.000000000 +0100
+++ commandref.html 2008-12-11 19:15:02.000000000 +0100
@@ -27,6 +27,7 @@
<a href="#help">?,help</a> &nbsp;
<a href="#include">include</a> &nbsp;
<a href="#inform">inform</a> &nbsp;
+ <a href="#jsonlist">jsonlist</a> &nbsp;
<a href="#list">list</a> &nbsp;
<a href="#modify">modify</a> &nbsp;
<a href="#quit">quit</a> &nbsp;
@@ -434,6 +435,97 @@
<br>
</ul>
+<a name="jsonlist"></a>
+<h3>jsonlist</h3>
+<ul>
+ <code>jsonlist [&lt;devspec&gt;|&lt;typespec&gt;|ROOMS]</code>
+ <br><br>
+ Returns an JSON tree of all definitions, all notify settings and all at
+ entries if no parameter is given.
+ <br><br>
+ Example:
+ <pre><code> fhem> jsonlist
+ {
+ "ResultSet": {
+ "Results": [
+ { "_internal__LIST": [
+ { "_internal_": {
+ "name": "global",
+ "state": "<no definition>",
+ "sets": [ { "VAL": "null" } ],
+ "attrs": [ { "VAL": "room" },{ "VAL": "comment" },
+ [...]
+ ],
+ "totalResultsAvailable": 86,
+ "totalResultsReturned": 86
+ }
+ }
+ </code></pre>
+ If specifying <code>&lt;devspec&gt;</code>, then a detailed status for
+ <code>&lt;devspec&gt;</code> will be displayed, e.g.:
+ <pre><code> fhem> jsonlist lamp1
+ {
+ "ResultSet": {
+ "Results": {
+ "ATTRIBUTES": {
+ "comment": "Light",
+ "room": "Livingroom"
+ },
+ "BTN": "f0",
+ [...]
+ "NAME": "lamp1",
+ "NR": "26",
+ "READINGS": {
+ "state": {
+ "TIME": "2008-12-11 18:11:21",
+ "VAL": "toggle"
+ }
+ },
+ "STATE": "on",
+ "TYPE": "FS20",
+ "XMIT": "0b0b"
+ }
+ }
+ }
+ </code></pre>
+ If specifying <code>&lt;typespec&gt;</code>, then a list with the status for
+ the defined <code>&lt;typespec&gt;</code> devices will be displayed, e.g.:
+ <pre><code> fhem> jsonlist HMS
+ {
+ "ResultSet": {
+ "Results": [
+ { "NAME": "smokeDetector01", "STATE": "smoke_detect: off" },
+ { "NAME": "smokeDetector02", "STATE": "smoke_detect: off" },
+ { "NAME": "smokeDetector03", "STATE": "smoke_detect: off" }
+ ],
+ "totalResultsAvailable": 3,
+ "totalResultsReturned": 3
+ }
+ }
+ </code></pre>
+ If specifying <code>ROOMS</code>, then a list with the defined rooms
+ will be displayed, e.g.:
+ <pre><code> fhem> jsonlist ROOMS
+ {
+ "ResultSet": {
+ "Results": [
+ { "NAME": "Bathroom" },
+ { "NAME": "Office" },
+ { "NAME": "Diningroom" },
+ { "NAME": "Garden" },
+ { "NAME": "House" },
+ { "NAME": "Bedroom" },
+ { "NAME": "Garage" },
+ { "NAME": "Livingroom" },
+ { "NAME": "hidden" }
+ ],
+ "totalResultsAvailable": 9,
+ "totalResultsReturned": 9
+ }
+ }
+ </code></pre>
+</ul>
+
<a name="list"></a>
<h3>list</h3>
<ul>

View File

@ -39,9 +39,6 @@
STefan's "presence simulator" for holidays
- garden.pl
Garden irrigation regulator with weather dependency (KS300 temp + rain)
- JsonList
99_JsonList.pm adds a jsonlist command, which is list in JSON format.
See JsonList/README.JsonList for more. By Martin.
- fhem-speech
Martins instructions on how to make FHEM talk using the MBROLA speech
synthesizer

View File

@ -39,6 +39,7 @@
<a href="#help">?,help</a> &nbsp;
<a href="#include">include</a> &nbsp;
<a href="#inform">inform</a> &nbsp;
<a href="#jsonlist">jsonlist</a> &nbsp;
<a href="#list">list</a> &nbsp;
<a href="#modify">modify</a> &nbsp;
<a href="#quit">quit</a> &nbsp;
@ -535,6 +536,155 @@ A line ending with \ will be concatenated with the next one, so long lines
<br>
</ul>
<a name="jsonlist"></a>
<h3>jsonlist</h3>
<ul>
<code>jsonlist [&lt;devspec&gt;|&lt;typespec&gt;|ROOMS]</code>
<br><br>
Returns an JSON tree of all definitions, all notify settings and all at
entries if no parameter is given.
<br><br>
Example:
<pre><code> fhem> jsonlist
{
"ResultSet": "full",
"Results": [
{
"list": "Global",
"devices": [
{
"DEF": "<no definition>",
"NAME": "global",
"NR": "1",
"STATE": "<no definition>",
"TYPE": "Global",
"currentlogfile": "/var/log/fhem/fhem-2011-12.log",
"logfile": "/var/log/fhem/fhem-%Y-%m.log",
"ATTR": {
"configfile": "/etc/fhem/fhem.conf",
"logfile": "/var/log/fhem/fhem-%Y-%m.log",
"modpath": "/usr/share/fhem",
"pidfilename": "/var/run/fhem.pid",
"port": "7072 global",
"room": "Server",
"statefile": "/var/cache/fhem/fhem.save",
"verbose": "4",
"version": "=VERS= from =DATE= ($Id: fhem.pl,v 1.150 2011-08-16 18:06:38 rudolfkoenig Exp $)"
},
"READINGS": []
}
]
},
{
"list": "CM11",
"devices": [
{
"DEF": "/dev/cm11",
"DeviceName": "/dev/cm11",
"FD": "14",
"NAME": "CM11",
"NR": "19",
"PARTIAL": "null",
"STATE": "Initialized",
"TYPE": "CM11",
"ATTR": {
"model": "CM11"
},
"READINGS": []
}
]
},
{
[...placeholder for more entrys...]
},
],
"totalResultsReturned": 235
}
</code></pre>
If specifying <code>&lt;devspec&gt;</code>, then a detailed status for
<code>&lt;devspec&gt;</code> will be displayed, e.g.:
<pre><code> fhem> jsonlist lamp1
{
"ResultSet": {
"Results": {
"ATTRIBUTES": {
"alias": "Lamp on Sideboard",
"model": "fs20st",
"room": "Livingroom"
},
"BTN": "01",
"CHANGED": "ARRAY",
"CHANGETIME": "ARRAY",
"CODE": {
"1": "0b0b 01",
"2": "0b0b 0f",
"3": "0b0b f0",
"4": "0b0b ff"
},
"DEF": "12341234 1112 lm 1144 fg 4411 gm 4444",
"IODev": "CUN868",
"NAME": "lamp1",
"NR": "155",
"READINGS": {
"state": {
"TIME": "2011-12-01 16:23:01",
"VAL": "on"
}
},
"STATE": "on",
"TYPE": "FS20",
"XMIT": "0b0b"
}
}
}
</code></pre>
If specifying <code>&lt;typespec&gt;</code>, then a list with the status for
the defined <code>&lt;typespec&gt;</code> devices will be displayed, e.g.:
<pre><code> fhem> jsonlist HMS
{
"ResultSet": "devices#HMS",
"Results": [
{
"name": "KG.ga.WD.01",
"state": "Water Detect: off"
},
{
"name": "KG.hz.GD.01",
"state": "Gas Detect: off"
},
{
"name": "KG.k1.TF.01",
"state": "T: 16.6 H: 51.2 Bat: ok"
},
{
"name": "NN.xx.RM.xx",
"state": "smoke_detect: off"
}
],
"totalResultsReturned": 4
}
</code></pre>
If specifying <code>ROOMS</code>, then a list with the defined rooms
will be displayed, e.g.:
<pre><code> fhem> jsonlist ROOMS
{
"ResultSet": "rooms",
"Results": [
"Bathroom",
"Bedroom",
"Children",
"Diningroom",
"Garden",
"House",
"Livingroom",
"Office",
"hidden"
],
"totalResultsReturned": 15
}
</code></pre>
</ul>
<a name="updatefhem"></a>
<h3>updatefhem</h3>
<ul>