diff --git a/sense_energy/__init__.py b/sense_energy/__init__.py index bed8278..4662ea7 100644 --- a/sense_energy/__init__.py +++ b/sense_energy/__init__.py @@ -8,4 +8,4 @@ from .plug_instance import PlugInstance from .sense_link import SenseLink -__version__ = "0.9.1" +__version__ = "0.9.2" diff --git a/sense_energy/sense_api.py b/sense_energy/sense_api.py index 8ca9d9e..fa693d8 100644 --- a/sense_energy/sense_api.py +++ b/sense_energy/sense_api.py @@ -188,7 +188,10 @@ def active_devices(self): return [d['name'] for d in self._realtime.get('devices', {})] def get_trend(self, scale, key): - key = 'consumption' if key == 'usage' else key + if isinstance(key, bool): + key = 'production' if key is True else 'consumption' + else: + key = 'consumption' if key == 'usage' else key if key not in self._trend_data[scale]: return 0 # Perform a check for a valid type if not isinstance(self._trend_data[scale][key], (dict, float, int)): return 0 diff --git a/setup.py b/setup.py index 6c8ec22..a934d16 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ 'websockets;python_version>="3.5"', 'aiohttp;python_version>="3.5"', ], - version = '0.9.1', + version = '0.9.2', description = 'API for the Sense Energy Monitor', long_description=long_description, long_description_content_type="text/markdown",