scottyphillips / pychonet

A simple to use library for interfacing with the ECHONETlite protocol
GNU General Public License v3.0
19 stars 17 forks source link

Add friendly descriptions, reduce verbosity and PEP8 formatting. #32

Closed gvswastaken closed 2 years ago

gvswastaken commented 2 years ago

Human-readable output is more helpful than looking up codes in the spec. I also ran it through autopep8 and reduced print statements (all the info is captured anyways in the final output) so it is easier to output JSON (by changing the pprint() call) in the future.

Example output:

python3 ./example_async.py
[{'class': ('0xff', 'Controller'),
  'getmap': [('0x9e', 'Set property map'),
             ('0x9f', 'Get property map'),
             ('0x9d', 'Status change announcement property map'),
             ('0x81', 'Installation location'),
             ('0x82', 'Standard version information'),
             ('0x8a', 'Manufacturer code'),
             ('0x80', 'Operation status'),
             ('0x88', 'Fault status')],
  'group': ('0x5', 'Management/control-related device group'),
  'host': '10.0.0.134',
  'instance': '0x1',
  'manufacturer': 'Panasonic',
  'setmap': [('0x81', 'Installation location')],
  'uid': None},
 {'class': ('0x30', 'Home air conditioner'),
  'getmap': [('0x80', 'Operation status'),
             ('0xa0', 'Air flow rate setting'),
             ('0xb0', 'Operation mode setting'),
             ('0x81', 'Installation location'),
             ('0xa1', 'Automatic control of air flow direction setting'),
             ('0x82', 'Standard version information'),
             ('0x83', 'Identification number'),
             ('0x93', 'Remote control setting'),
             ('0xb3', 'Set temperature value'),
             ('0xa4', 'Air flow direction (vertical) setting'),
             ('0x85', 'Measured cumulative power consumption'),
...