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:hli48800ei57200ee1:tli2163ei1925ei1092ei1354ee1:wi10677ee\0\r\n ')  
{'meta': {'node': '999', 'profile': 'h1', 'protocol': 'beradio2', 'network': 'None', 'time': ..., '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)
get_envelope(node=None)
identifiers = {'#': {'convert': <type 'str'>, 'meta': True, 'name': 'node', 'attname': 'direct'}, '_': {'convert': <type 'str'>, 'meta': True, 'name': 'profile', 'attname': 'direct'}, 'h': {'scale-encode': <function <lambda> at 0x7fdffe1f6f50>, 'name': 'hum', 'scale-decode': <function <lambda> at 0x7fdffe1fd050>}, 'l': {'scale-encode': <function <lambda> at 0x7fdffe1fd2a8>, 'name': 'loops', 'scale-decode': <function <lambda> at 0x7fdffe1fd320>}, 'r': {'scale-encode': <function <lambda> at 0x7fdffe1fd1b8>, 'name': 'rssi', 'scale-decode': <function <lambda> at 0x7fdffe1fd230>}, 't': {'scale-encode': <function <lambda> at 0x7fdffe1f6e60>, 'name': 'temp', 'scale-decode': <function <lambda> at 0x7fdffe1f6ed8>}, 'w': {'scale-encode': <function <lambda> at 0x7fdffe1fd0c8>, 'name': 'wght', 'scale-decode': <function <lambda> at 0x7fdffe1fd140>}}

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:hli48800ei57200ee1:tli2163ei1925ei1092ei1354eee'
>>> message.weight(106.77)
>>> str(message)
'd1:#i999e1:_2:h11:hli48800ei57200ee1:tli2163ei1925ei1092ei1354ee1:wi10677ee'
class beradio.message.BERadioMessage(nodeid, profile='h1')
clear()
classmethod decode(payload)
encode()
humidity(*args)
classmethod json(payload)
protocol_factory

alias of beradio.protocol.BERadioProtocol2

temperature(*args)
weight(*args)
class beradio.message.BERadioMessageDecoder(reassembly_timeout=None)
MODE_COLLECT = 1
MODE_EMIT = 2
REASSEMBLY_TIMEOUT = 2.5
assemble()
emit()
read(payload)
release()
subscribe(subscriber)
to_json(strip_time=False)
wait()
class beradio.message.ResettableTimer(interval, function)
make_timer()
reset()