Luup Sdata

From MiOS
Revision as of 06:54, 27 May 2011 by Henk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The JavaScript API

Luup_Sdata

  • lu_sdata is the preferred method for new user interfaces to interact with the MiOS engine. A full description of how to craft requests to LuaUPnP and the JSON format is available at Luup Protocol
  • All of Luup's Device types are explained in detail at Luup Devices

Arguments

  • loadtime
    • An integer representing the UNIX timestamp for when the devices list was last updated. On your first request, pass 0, and on subsequent requests pass in the loadtime returned in lu_sdata.
  • dataversion
    • An integer representing the UNIX timestamp for the last time the state of the engine was updated. On your first request, pass 0 for dataversion and on subsequent requests pass the value returned in lu_sdata
  • timeout
    • An integer specifying the timeout of the request in seconds. Setting this to a higher value allows your UI to block on the HTTP request to lu_sdata and only send new requests when data changes.

Returned JSON

The return is a JSON object with the following key/value pairs.

  • full
    • Integer
    • If 1, the user interface should completely refresh all data structures, if 0, this is a minor status update.
  • version
    • String
    • The build version of the engine returning the request. Can be used to check for features as they are added in the future.
  • model
    • String
    • The hardware the MiOS engine is running on
  • zwave_heal
    • Integer
    • 1 if a heal is active, 0 otherwise.
  • temperature
    • String
    • F for farenheit representation, C for celsius.
  • serial_number
    • String
    • The serial number of the unit.
  • fwd1
    • The primary forwarding server for accessing the unit remotely.
  • fwd2
    • The secondary forwarding server for accessing the unit remotely.
  • sections
    • List
    • A list of JSON objects with the following key/value pairs
      • name
        • String
        • The name of the section.
      • id
        • Integer
        • The id of the section. Sections contain rooms which contain devices and scenes.
  • rooms
    • List
    • A list of JSON objects with the following key/value pairs
      • name
        • String
        • The name of the room.
      • id
        • Integer
        • The id of the room. Rooms are contained by sections and contain devices and scenes.
      • section
        • Integer
        • The id of the section that contains the room.
  • scenes
    • List
    • A list of JSON objects with the following key/value pairs
      • name
        • String
        • The name of the scene.
      • id
        • Integer
        • The id of the scene.
      • room
        • Integer
        • The id of the room that contains the scene.
      • active
        • Integer
        • 1 if the scene is active, 0 otherwise.
  • devices
    • Note: Devices will have additional variables based on their category. The actions available for a device can be seen at Luup Devices and the list of categories and device types is available at Luup Device Categories]
    • A list of JSON objects with the following key/value pairs
      • name
        • String
        • The name of the device.
      • id
        • Integer
        • The id of the device.
      • room
        • Integer
        • The id of the room that contains the device.
      • category
        • Integer
        • The category of the device.
      • parent
        • Integer
        • 1 if the scene is active, 0 otherwise.
  • categories
    • List
    • A list of JSON objects with the following key/value pairs
      • name
        • String
        • The name of the category
      • id
        • Integer
        • the id of the category. Corresponds to the category field of the device objects.
  • loadtime
    • Integer
    • A UNIX timestamp with the last time the data was reloaded. Should be passed in the next lu_sdata request
  • dataversion
    • Integer
    • A UNIX timestamp with the last time the state was updated. Should be passed in the next lu_sdata request
  • state
    • Integer
    • -1 means nothing is happening. 0, 1, 5, 6 mean that the engine is working. 2 or 3 indicates an error. 4 indicates a successful operation.
  • comment
    • String
    • Some message that should be displayed to the user.
Personal tools