Skip to content

Commit

Permalink
pv1 pv2 pv3 pv4 power second fix
Browse files Browse the repository at this point in the history
  • Loading branch information
macxq committed Nov 9, 2021
1 parent 340655b commit 34d4c34
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/foxess/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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):

Expand All @@ -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):

Expand All @@ -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):

Expand All @@ -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):
Expand Down

0 comments on commit 34d4c34

Please sign in to comment.