2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00
fhem-mirror/fhem/contrib/JsonList
rudolfkoenig f581862267 Path changes applied
git-svn-id: https://svn.fhem.de/fhem/trunk@711 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2010-09-04 06:51:58 +00:00
..
99_JsonList.pm Readme update and the additions from Martin 2008-12-12 11:06:36 +00:00
commandref.html.patch RFR fixes 2009-12-02 20:38:00 +00:00
README.JsonList Path changes applied 2010-09-04 06:51:58 +00:00

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
    }
  }