From 34d4c347d27fbbc7a0190bba801071278d2e08fa Mon Sep 17 00:00:00 2001 From: macxq Date: Tue, 9 Nov 2021 21:32:21 +0100 Subject: [PATCH] pv1 pv2 pv3 pv4 power second fix --- custom_components/foxess/sensor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/foxess/sensor.py b/custom_components/foxess/sensor.py index 799be2a..0a22b69 100644 --- a/custom_components/foxess/sensor.py +++ b/custom_components/foxess/sensor.py @@ -148,7 +148,7 @@ async def async_update_data(): now = datetime.now() methodRaw = "POST" - rawData = '{"deviceID":"'+deviceID+'","variables":["generationPower","feedinPower","batChargePower","batDischargePower","gridConsumptionPower","loadsPower","SoC","batTemperature"],"timespan":"day","beginDate":{"year":'+now.strftime("%Y")+',"month":'+now.strftime("%_m")+',"day":'+now.strftime("%_d")+'}}' + rawData = '{"deviceID":"'+deviceID+'","variables":["generationPower","feedinPower","batChargePower","batDischargePower","gridConsumptionPower","loadsPower","SoC","batTemperature","pv1Power","pv2Power","pv3Power","pv4Power"],"timespan":"day","beginDate":{"year":'+now.strftime("%Y")+',"month":'+now.strftime("%_m")+',"day":'+now.strftime("%_d")+'}}' restRaw = RestData(hass, methodRaw, _ENDPOINT_RAW, None, headersData, None, rawData, DEFAULT_VERIFY_SSL) @@ -169,7 +169,7 @@ async def async_update_data(): allData['raw'][variableName] = None - reportData = '{"deviceID":"'+deviceID+'","reportType":"month","variables":["feedin","generation","gridConsumption","chargeEnergyToTal","dischargeEnergyToTal","loads","pv1Power","pv2Power","pv3Power","pv4Power"],"queryDate":{"year":'+now.strftime("%Y")+',"month":'+now.strftime("%_m")+'}}' + reportData = '{"deviceID":"'+deviceID+'","reportType":"month","variables":["feedin","generation","gridConsumption","chargeEnergyToTal","dischargeEnergyToTal","loads"],"queryDate":{"year":'+now.strftime("%Y")+',"month":'+now.strftime("%_m")+'}}' restReport= RestData(hass, methodRaw, _ENDPOINT_REPORT, None, headersData, None, reportData, DEFAULT_VERIFY_SSL) @@ -368,7 +368,7 @@ def __init__(self, coordinator, name, deviceID): @property def native_value(self) -> str | None: - return self.coordinator.data["report"]["pv1Power"] + return self.coordinator.data["raw"]["pv1Power"] class FoxESSPV2Power(CoordinatorEntity,SensorEntity): @@ -391,7 +391,7 @@ def __init__(self, coordinator, name, deviceID): @property def native_value(self) -> str | None: - return self.coordinator.data["report"]["pv2Power"] + return self.coordinator.data["raw"]["pv2Power"] class FoxESSPV3Power(CoordinatorEntity,SensorEntity): @@ -414,7 +414,7 @@ def __init__(self, coordinator, name, deviceID): @property def native_value(self) -> str | None: - return self.coordinator.data["report"]["pv3Power"] + return self.coordinator.data["raw"]["pv3Power"] class FoxESSPV4Power(CoordinatorEntity,SensorEntity): @@ -437,7 +437,7 @@ def __init__(self, coordinator, name, deviceID): @property def native_value(self) -> str | None: - return self.coordinator.data["report"]["pv4Power"] + return self.coordinator.data["raw"]["pv4Power"] class FoxESSEnergyGenerated(CoordinatorEntity,SensorEntity):