JavaScript API
From MiOS
(Difference between revisions)
Line 2: | Line 2: | ||
==== jsonp.ud ==== | ==== jsonp.ud ==== | ||
This is the user data. | This is the user data. | ||
− | * '''Type''': | + | * '''Type''': object |
* '''Members''': | * '''Members''': | ||
− | ** devices ( | + | ** devices (array) |
− | ** scenes ( | + | ** scenes (array) |
− | ** | + | ** users (array) |
− | ** | + | ** rooms (array) |
− | ** eventList ( | + | ** eventList (array) |
** etc. | ** etc. | ||
==== jsonp.ud.devices ==== | ==== jsonp.ud.devices ==== | ||
− | * '''Type''': | + | * '''Type''': array |
* '''Members''': | * '''Members''': | ||
** id (number) | ** id (number) | ||
Line 20: | Line 20: | ||
** name (string) | ** name (string) | ||
** category_num (number) | ** category_num (number) | ||
+ | ** etc. | ||
+ | |||
+ | |||
+ | ==== jsonp.ud.scenes ==== | ||
+ | * '''Type''': array | ||
+ | * '''Members''': | ||
+ | ** id (number) | ||
+ | ** name (string) | ||
+ | ** room (number) | ||
+ | ** Timer_ids (array) | ||
+ | ** Timer (object) | ||
** etc. | ** etc. | ||
Revision as of 11:44, 4 April 2011
Contents |
Variables
jsonp.ud
This is the user data.
- Type: object
- Members:
- devices (array)
- scenes (array)
- users (array)
- rooms (array)
- eventList (array)
- etc.
jsonp.ud.devices
- Type: array
- Members:
- id (number)
- device_type (string)
- room (number)
- name (string)
- category_num (number)
- etc.
jsonp.ud.scenes
- Type: array
- Members:
- id (number)
- name (string)
- room (number)
- Timer_ids (array)
- Timer (object)
- etc.
Functions
get_device_state (deviceID, service, variable, dynamic)
Input:
- deviceID (number)
- service (string)
- variable (string)
- dynamic (number): if 1 the variable value is taken from lu_status, else the variable value is taken from user_data (recommended). user_data is read at Luup startup, so for variables that change their value frequently (like Watts, Temperature, etc.) dynamic should be 1.
Output:
- variable value (string or undefined)
set_device_state (deviceID, service, variable, value)
Input:
- deviceID (number)
- service (string)
- variable (string)
- value (string)
Output:
- true if the operation succeeded, false otherwise
_console (str)
Input:
- str (string): text to be written in the console. You need to have FireBug installed.
Output:
- nothing
set_panel_html (html)
Used in the tab rendering functions.
Input:
- html (string): The html to be used for generating the tab content.
Output:
- nothing