diff options
Diffstat (limited to 'src/home')
-rw-r--r-- | src/home/api/web_api_client.py | 15 | ||||
-rw-r--r-- | src/home/database/inverter.py | 2 | ||||
-rw-r--r-- | src/home/database/inverter_time_formats.py | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/home/api/web_api_client.py b/src/home/api/web_api_client.py index 4a9f4bc..2884ddb 100644 --- a/src/home/api/web_api_client.py +++ b/src/home/api/web_api_client.py @@ -106,7 +106,20 @@ class WebAPIClient: return MediaNodeClient.record_list_from_serialized(files) return files - def _process_sound_sensor_hits_data(self, data: List[dict]) -> List[dict]: + def inverter_get_consumed_energy(self, s_from: str, s_to: str): + return self._post('inverter/get_consumed_energy/', { + 'from': s_from, + 'to': s_to + }) + + def inverter_get_grid_consumed_energy(self, s_from: str, s_to: str): + return self._post('inverter/get_grid_consumed_energy/', { + 'from': s_from, + 'to': s_to + }) + + @staticmethod + def _process_sound_sensor_hits_data(data: List[dict]) -> List[dict]: for item in data: item['time'] = datetime.fromtimestamp(item['time']) return data diff --git a/src/home/database/inverter.py b/src/home/database/inverter.py index 1e967c4..fc3f74f 100644 --- a/src/home/database/inverter.py +++ b/src/home/database/inverter.py @@ -1,5 +1,5 @@ from time import time -from datetime import datetime +from datetime import datetime, timedelta from typing import Optional from collections import namedtuple diff --git a/src/home/database/inverter_time_formats.py b/src/home/database/inverter_time_formats.py new file mode 100644 index 0000000..7c37d30 --- /dev/null +++ b/src/home/database/inverter_time_formats.py @@ -0,0 +1,2 @@ +FormatTime = '%Y-%m-%d %H:%M:%S' +FormatDate = '%Y-%m-%d' |