If you like BoxMatrix then please contribute Supportdata, Supportdata2, Firmware and/or Hardware (get in touch).
My metamonk@yahoo.com is not reachable by me since years. Please use hippie2000@webnmail.de instead.

0
U

Property:smarthome.lua (restapi)

From BoxMatrix


BoxMatrix >> Webinterface >> smarthome.lua (restapi) @ BoxMatrix   -   IRC-Chat   -   Translate: de es fr it nl pl
News Selectors Models Accessories Components Environment Config Commands System Webif Software Develop Lexicon Community Project Media

UI-Structure UI-Modules HTML-Files XML-Files REST-API Lua-Scripts Javascript Browser SSI-Files SSI-Directives HTML-Text Event-Text Help-Pages CSS-Files Graphics Research

Info
  
Name-Collision - multiple objects in this wiki use the name smarthome.lua!
smarthome.lua (luascr) TODO
smarthome.lua (restapi) REST-API Plugin for Smarthome

RESTAPI-Script

Goto:   Functions  -  Dependencies   -   Model-Matrix   -   SMW-Browser

Details

smarthome.lua is the REST-API Plugin for AVM Smarthome. It is the glue to the conditionally loaded libaha.so library.
AVM added it in fw 7.90, but it's not yet the replacement for the smarthome_rest.lua module.

It is auto-included by api.lua, like all /usr/rest_api/plugins/*.lua scripts, and supports:

GET    /api/v0/smarthome/...
PUT    /api/v0/smarthome/...
POST   /api/v0/smarthome/...
DELETE /api/v0/smarthome/...

REST-API:

Functions

The function names of scripts often help to understand function blocks (and show gaps in the docs). fw 8.00 functions:

$ grep -e '^function' -e '^local function' /usr/rest_api/plugins/smarthome.lua

# Wrapper libaha REST functions
local function rest_lua_wrapper(libahaFunction, param)

# Get UID for entity
local function get_uid(param)

# Get Serial(MACA) for entity
local function get_serial(param)

# Check the response table from libaha for status code and send error, if detected
local function check_response_for_errors(responseTable)

# Handler function to send overview infos:
# smarthome device, unit, group, trigger and template list to the client
local function get_overview()

# Handler function to Send a global Smarthome infos and the
# smarthome device, unit, group, trigger and template list to the client
local function get_smarthome()

# Handler function to send data from a single entity specified 
# by a UID to the client (e.g. device, unit, template, ...),
# based on the provided libahaFunction
local function get_singleEntityByUid(libahaFunction, uid)

# Handler function to send data from a single entity specified
# by a Serial(MACA) to the client (e.g radioBase),
# based on the provided libahaFunction
local function get_singleEntityBySerial(libahaFunction, serial)

# Handler function to send an array containing multiple entities
# to the client (e.g. devices, units, templates, ...),
# based on the provided libahaFunction
local function get_multipleEntities(libahaFunction)

# Handler function process a put order post request by the client,
# based on the provided libahaFunction and uid
local function put_post_singleEntity_withParam(libahaFunction, uid)

# Handler function process a put or post request by the client,
# based on the provided libahaFunction
local function put_post_singleEntity_withoutParam(libahaFunction)

# Handler function process a delete request by the client,
# based on the provided libahaFunction and uid
local function delete_singleEntity(libahaFunction, uid)

# Special handler function to send a device configuration to the client.
# This also inserts all related units of the device into the table
local function get_configurationDevice(uid)

# Special handler function to send a group configuration to the client.
# This also inserts the related unit of the group into the table
local function get_configurationGroup(uid)

# processes get-request to the overview endpoint by utilizing a mapping-dictionary,
# while checking for the correct number of parameters. If no parameter beside the
# endpoint is provided we return the whole smarthome-overview-tree
local function helper_get_overview_request(params)

# processes a get-request to the configruation endpoint by utilizing a mapping-dictionary,
# while checking for the correct number of parameters and whether the
# "device"-entity/"groups"-entity needs to be handled separately
local function helper_get_configuration_request(params)

# processes a get-request to the connect endpoint by utilizing a mapping-dictionary,
# while checking for the correct number of parameters
local function helper_get_connect_request(params)

# processes either a put- or post-request by utilizing the mapping-dictionaries,
# while checking for the correct number of parameters
local function helper_put_post_request(params, functionMap)

# processes either a delete-request by utilizing the mapping-dictionaries,
# while checking for the correct number of parameters
local function helper_delete_request(params, functionMap)

# handles all GET-requests of the plugin
function smarthome.get_data(params)

# handles all PUT-requests of the plugin
function smarthome.put_data(params)

# handles all POST-requests of the plugin
function smarthome.post_data(params)

# handles all DELETE-requests of the plugin
function smarthome.delete_data(params) 

Dependencies

Daily updated index of all dependencies of this script. Last update: GMT.
A * in the Mod column marks info from Supportdata-Probes, which will always stay incomplete.
If an Object includes itself then this is a file with the same name but another Path and the dependencies are merged.

Relation Typ Object Mod Firmware Info Origin
Accesses uimod dect (uimod) 46 6.20 - 8.00 DECT base, handsets, repeater, ULE AVM
Accesses uimod jasonii 34 7.19 - 7.39 MyFRITZ! service AVM
Accesses uimod oncal 28 7.39 - 8.00 Google-Calendar AVM
Requires rest common.lua (restapi) 19 7.90 - 8.00 REST-API common helper functions AVM
Requires rest response.lua 19 7.90 - 8.00 REST-API Response API AVM
Requires rest rest_api_const.lua 19 7.90 - 8.00 REST-API Const Tables AVM
Requires rest validcheck.lua 19 7.90 - 8.00 REST-API common validation helper functions AVM
7 dependencies for this script

Model-Matrix

Daily updated index of the presence, path and size of this script for each model. Last update: GMT.
Showing all models using this script. Click any column header (click-wait-click) to sort the list by the respective data.
The (main/scrpn/boot/arm/prx/atom/rtl) label in the Model column shows which CPU is meant for Multi-Linux models.
Note that this list is merged from Firmware-Probes of all known AVM firmware for a model, including Recovery.exe and Labor-Files.

Model Firmware Path Size/Bytes
FRITZ!Box 4050 7.90 /usr/rest_api/plugins 22.1k
FRITZ!Box 4060 7.90 /usr/rest_api/plugins 22.1k
FRITZ!Box 5530 Fiber (main) 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 5590 Fiber (main) 7.90 - 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 6591 Cable (atom) 7.90 - 8.00 /usr/rest_api/plugins 22.1k - 22.4k
FRITZ!Box 6660 Cable (atom) 7.90 - 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 6670 Cable (atom) 7.90 /usr/rest_api/plugins 22.1k
FRITZ!Box 6690 Cable (atom) 7.90 /usr/rest_api/plugins 22.1k
FRITZ!Box 6850 LTE 7.90 /usr/rest_api/plugins 22.1k
FRITZ!Box 6850 5G 7.90 /usr/rest_api/plugins 22.1k
FRITZ!Box 7510 7.90 - 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 7520 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 7520 v2 (main) 7.90 - 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 7530 7.90 - 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 7530 AX 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 7583 VDSL (main) 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 7590 (main) 7.90 - 8.00 /usr/rest_api/plugins 22.1k - 22.4k
FRITZ!Box 7590 AX (main) 8.00 /usr/rest_api/plugins 22.1k
FRITZ!Box 7690 7.90 /usr/rest_api/plugins 22.1k
19 models use this script

SMW-Browser

Information is currently being retrieved from the backend.