.

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

# Composer DS

System Message: WARNING/2 (<string>, line 2)

Title underline too short.

# Composer DS
=======

# Composer

Composer creates dynamic attributes and propagate signals from lower level devices. Compatible with HTTP, MQTT and Modbus device server. Based on [HttpComposer](https://gitlab.com/s2innovation/internal/icams/http-composer). <br> Composer provides a mechanism that retrieves values from JSON, XML, HTML documents, raw MQTT strings, Modbus register. Available methods are the following: * extract_from_json(value_raw, json_pointer) - JSON Pointer selector as specified in [RFC 6901](<https://tools.ietf.org/html/rfc6901>) * extract_from_xml(value_raw, xpath) * extract_from_html(value_raw, xpath) * extract_from_raw(value_raw, regex) * extract_from_modbus(value) * pack_to_json(value_raw) * pack_to_html_xml(value_raw) * pack_to_raw(value_raw)

## Examples of dynamic attributes ## ```

System Message: WARNING/2 (<string>, line 18); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 18); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (<string>, line 20)

Unexpected indentation.

[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]))

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)})]))', 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>")]))', 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)]))',

Temperature_json_HTTP = DevString(extract_from_json(COMM("test/http_access/1/Get", "?q=Krakow,pl&units=metric&mode=json"), "/main/temp"))', Temperature_xml_HTTP = DevString(extract_from_xml(COMM("test/http_access/1/Get", "?q=Krakow,pl&units=metric&mode=xml"), "/current/temperature/@value"))', 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()"))',

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]))',

System Message: WARNING/2 (<string>, line 31)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (<string>, line 31); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 31); backlink

Inline interpreted text or phrase reference start-string without end-string.

## Usage

` python Composer.py test `

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