add statistic data
This commit is contained in:
parent
970888ebfa
commit
ae8f87f787
|
|
@ -49,6 +49,16 @@ class CloudConnection:
|
||||||
break
|
break
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def get_statistic_data(self, inverter_id):
|
||||||
|
url = f"https://app.api.apsystemsema.com:9223/aps-api-web/api/v2/data/device/ezInverter/statistic/{inverter_id}"
|
||||||
|
while True:
|
||||||
|
result = requests.get(url, headers=self._auth_header)
|
||||||
|
self._handle_api_return_codes(result)
|
||||||
|
if result.json()["code"] == 0:
|
||||||
|
data = result.json()["data"]
|
||||||
|
break
|
||||||
|
return data
|
||||||
|
|
||||||
def get_inverter(self):
|
def get_inverter(self):
|
||||||
url = f"https://app.api.apsystemsema.com:9223/aps-api-web/api/v2/data/device/ezInverter/list/{self._user_id}"
|
url = f"https://app.api.apsystemsema.com:9223/aps-api-web/api/v2/data/device/ezInverter/list/{self._user_id}"
|
||||||
inverter = []
|
inverter = []
|
||||||
|
|
|
||||||
10
Inverter.py
10
Inverter.py
|
|
@ -17,11 +17,17 @@ class Inverter:
|
||||||
async def gather(self):
|
async def gather(self):
|
||||||
while self.gather_data:
|
while self.gather_data:
|
||||||
realtime_data: dict = self.cloud_connection.get_realtime_data(self.inverter_id)
|
realtime_data: dict = self.cloud_connection.get_realtime_data(self.inverter_id)
|
||||||
data = InverterData(
|
rt_data = InverterData(
|
||||||
self.inverter_id,
|
self.inverter_id,
|
||||||
realtime_data
|
realtime_data
|
||||||
)
|
)
|
||||||
await self._queue.put(data)
|
statistic: dict = self.cloud_connection.get_statistic_data(self.inverter_id)
|
||||||
|
st_data = InverterData(
|
||||||
|
self.inverter_id,
|
||||||
|
statistic
|
||||||
|
)
|
||||||
|
await self._queue.put(rt_data)
|
||||||
|
await self._queue.put(st_data)
|
||||||
await asyncio.sleep(60)
|
await asyncio.sleep(60)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
version: "3.9"
|
version: "3.3"
|
||||||
services:
|
services:
|
||||||
ez1cloud2mqtt:
|
ez1cloud2mqtt:
|
||||||
image: ez1cloud2mqtt
|
image: ez1cloud2mqtt
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user