API of beradio

class beradio.protocol.BERadioProtocol2(network_id=None, gateway_id=None)

Example payload:

d1:#i999e1:_2:h11:hli488ei572ee1:tli2163ei1925ei1092ei1354ee1:wi10677ee

Decoded:

{'w': 10677, 'h': [488, 572], '#': 999, 't': [2163, 1925, 1092, 1354], '_': 'h1'}

Mapped:

{
    "meta": {
        "node": "999",
        "profile": "h1",
        "protocol": "beradio2",
        "network": "efc54ed2-b010-42ee-bfb6-183f148885f1",
        "gateway": "tug22"
    },
    "data": {
        "wght1": 106.77,
        "hum1": 488.0,
        "hum2": 572.0,
        "temp1": 21.63,
        "temp2": 19.25,
        "temp3": 10.92,
        "temp4": 13.54
    }
}
VERSION = 2
decode(payload)

Decode BERadio2 message.

>>> BERadioProtocol2().decode('d1:#i999e1:_2:h11:hli488ei572ee1:tli2163ei1925ei1092ei1354ee1:wi10677ee\0\r\n ')
{'meta': {'node': '999', 'profile': 'h1', 'protocol': 'beradio2', 'network': 'None', 'gateway': 'None'}, 'data': OrderedDict([('wght1', 106.77), ('hum1', 488.0), ('hum2', 572.0), ('temp1', 21.63), ('temp2', 19.25), ('temp3', 10.92), ('temp4', 13.54)])}
decode_value(value, rule)
encode_value(identifier, value)
encode_values(identifier, values)
identifiers = {'w': {'scale-encode': <function <lambda> at 0x7f3438487230>, 'name': 'wght', 'scale-decode': <function <lambda> at 0x7f34384872a8>}, 'h': {'scale-encode': <function <lambda> at 0x7f3438487140>, 'name': 'hum', 'scale-decode': <function <lambda> at 0x7f34384871b8>}, '#': {'convert': <type 'str'>, 'meta': True, 'name': 'node', 'attname': 'direct'}, 't': {'scale-encode': <function <lambda> at 0x7f3438487050>, 'name': 'temp', 'scale-decode': <function <lambda> at 0x7f34384870c8>}, '_': {'convert': <type 'str'>, 'meta': True, 'name': 'profile', 'attname': 'direct'}}

class beradio.message.BERadioMessage(nodeid, profile='h1')
__init__(nodeid, profile='h1')
>>> message = BERadioMessage(999)
>>> str(message)
'd1:#i999e1:_2:h1e'
>>> message.temperature(21.63, 19.25, 10.92, 13.54)
>>> str(message)
'd1:#i999e1:_2:h11:tli2163ei1925ei1092ei1354eee'
>>> message.humidity(488.0, 572.0)
>>> str(message)
'd1:#i999e1:_2:h11:hli488ei572ee1:tli2163ei1925ei1092ei1354eee'
>>> message.weight(106.77)
>>> str(message)
'd1:#i999e1:_2:h11:hli488ei572ee1:tli2163ei1925ei1092ei1354ee1:wi10677ee'
class beradio.message.BERadioMessage(nodeid, profile='h1')
clear()
classmethod decode(payload)
encode()
humidity(*args)
protocol_factory

alias of BERadioProtocol2

temperature(*args)
weight(*args)