.

Average: 0
Rating Count: 0

Development status: Released, Release: 1.0.0
Information status: New
Repository: https://gitlab.com/s2innovation-partners/device-services/dev-composer
Contact:



Class Description


Composer creates dynamic attributes and propagate signals from lower level devices. Compatible with HTTP, MQTT and Modbus device server. Composer provides a mechanism that retrieves values from JSON, XML, HTML documents, raw MQTT strings, Modbus register.

Families: Communication

Key words:

Platform: All Platforms

Language: Python

License: Custom

Contact:

Hardware


Manufacturer: S2Innovation

Class interface


Attributes:

Commands:

Pipes:

Properties:


Please log in to comment.

README

b'# Composer DS\n=======\n# Composer\n\nComposer creates dynamic attributes and propagate signals from lower level devices. Compatible with HTTP, MQTT and Modbus device server. \nBased on HttpComposer.\n
\nComposer provides a mechanism that retrieves values from JSON, XML, HTML documents, raw MQTT strings, Modbus register. Available methods are the following:\n extract_from_json(value_raw, json_pointer) - JSON Pointer selector as specified in RFC 6901\n extract_from_xml(value_raw, xpath)\n extract_from_html(value_raw, xpath)\n extract_from_raw(value_raw, regex)\n extract_from_modbus(value)\n pack_to_json(value_raw)\n pack_to_html_xml(value_raw)\n pack_to_raw(value_raw)\n\n## Examples of dynamic attributes ##\n\n [name_of_attribute] = [type](READ and [function_name](COMM("[name/of/device/[name_of_command]]", "[arg_to_command]"),[arg_to_function] or WRITE and COMM("[name/of/device/[name_of_command]]",[function_name]([arg_to_function]))\n\n Temperature_json_MQTT = DevString(READ and extract_from_json(COMM("test/mqtt/1/Sub", "home/temperature/t1"), "/value") or WRITE and COMM("test/mqtt/1/Pub", ["home/temperature/t1", pack_to_json({"value": int(VALUE)})]))\',\n Temperature_xml_MQTT= DevString(READ and extract_from_xml(COMM("test/mqtt/1/Sub", "home/temperature/t2"), "/temperature/value/text()") or WRITE and COMM("test/mqtt/1/Pub", ["home/temperature/t2", pack_to_xml("<temperature><value>"+VALUE+"</value></temperature>")]))\',\n Temperature_raw_MQTT= DevString(READ and extract_from_raw(COMM("test/mqtt/1/Sub", "home/temperature/t3"), r"Values: \\d+") or WRITE and COMM("test/mqtt/1/Pub", ["home/temperature/t3", pack_to_raw("Values: "+VALUE)]))\',\n\n Temperature_json_HTTP = DevString(extract_from_json(COMM("test/http_access/1/Get", "?q=Krakow,pl&units=metric&mode=json"), "/main/temp"))\',\n Temperature_xml_HTTP = DevString(extract_from_xml(COMM("test/http_access/1/Get", "?q=Krakow,pl&units=metric&mode=xml"), "/current/temperature/@value"))\',\n Temperature_html_HTTP = DevString(extract_from_html(COMM("test/http_access/1/Get", "?q=Krakow,pl&units=metric&mode=html"), "/html/body/div[2]/div[1]/div[2]/div[1]/text()"))\',\n\n Temperature_reg_MODBUS = DevDouble(READ and extract_from_modbus(COMM("com/modbus/modbus1/ReadHoldingRegisters", [0x4,1])) or WRITE and COMM("com/modbus/modbus1/PresetSingleRegister", [0x4,VALUE]))\',\n\n\n## Usage\n\n\npython Composer.py test \n\n\n\n'

3 Sep 2020,
Created:
The device class has been added to catalogue.
Added by:user67 on:3 Sep 2020, 12:29 p.m.