pyebus.msgdefdecoder module

Message Definition Decoder.

EBUS message definitions are specified at https://github.com/john30/ebusd/wiki/4.1.-Message-definition#message-definition .

The function decode_msgdef converts a EBUS message defintion string into a MsgDef.

pyebus.msgdefdecoder.decode_msgdef(line)[source]

Decode Message and Field Definition retrieved from ebusd.

The EBUSD command find -a -F type,circuit,name,fields retrieves all message and field definitions of all known and connected devices. The resulting lines are decoded by this method and create a proper MsgDef instance per line.

>>> m = decode_msgdef('r,mc.4,OtShutdownLimit,temp,s,UCH,,°C,"text, text"')
>>> m.circuit, m.name, m.read, m.prio, m.write, m.update
('mc.4', 'OtShutdownLimit', True, None, False, False)
>>> m.children
(FieldDef(0, 'temp', IntType(0, 254), unit='°C', comment='text, text'),)
>>> m = decode_msgdef('w,ui,TempIncrease,temp,m,D2C,,°C,Temperatur')
>>> m.circuit, m.name, m.read, m.prio, m.write, m.update
('ui', 'TempIncrease', False, None, True, False)
>>> m.children
(FieldDef(0, 'temp', IntType(-2047.9, 2047.9, divider=16), unit='°C', comment='Temperatur'),)
pyebus.msgdefdecoder.decodetype(type_)[source]

Decode Type.

>>> decodetype('r')
(True, None, False, False)
>>> decodetype('w')
(False, None, True, False)
>>> decodetype('u')
(False, None, False, True)