diff --git a/custom_components/saj_esolar_air/esolar.py b/custom_components/saj_esolar_air/esolar.py index d6cbce0..66e06ba 100644 --- a/custom_components/saj_esolar_air/esolar.py +++ b/custom_components/saj_esolar_air/esolar.py @@ -244,7 +244,8 @@ def web_get_plant_detailed_chart(session, plant_info): if (plant_chart["type"]) == 0: tmp = {} tmp.update({"devicesn": inverter}) - tmp.update({"peakPower": plant_chart["peakPower"]}) + # I'm not sure about wich kind of data we need to pick here + tmp.update({"peakPower": plant_chart["refreshPeakPower"]}) peak_pow.append(tmp) plant.update({"peakList": peak_pow}) # plant.update({"peakPower": plant_chart["peakPower"]}) diff --git a/custom_components/saj_esolar_air/sensor.py b/custom_components/saj_esolar_air/sensor.py index b418c58..2764154 100644 --- a/custom_components/saj_esolar_air/sensor.py +++ b/custom_components/saj_esolar_air/sensor.py @@ -701,7 +701,7 @@ async def async_update(self) -> None: if "kitList" not in plant or plant["kitList"] is None: continue for kit in plant["kitList"]: - if inverter == kit["devicesn"] and kit["onLineStr"] == "1": + if inverter == kit["devicesn"] and kit["type"] == 2: installed_power += kit["storeDevicePower"]["batCapcity"] available_power += ( kit["storeDevicePower"]["batCapcity"] @@ -724,7 +724,7 @@ def native_value(self) -> float | None: if "kitList" not in plant or plant["kitList"] is None: continue for kit in plant["kitList"]: - if inverter == kit["devicesn"] and kit["onLineStr"] == "1": + if inverter == kit["devicesn"] and kit["type"] == 2: installed_power += kit["storeDevicePower"]["batCapcity"] available_power += ( kit["storeDevicePower"]["batCapcity"] @@ -1139,7 +1139,7 @@ async def async_update(self) -> None: if "kitList" not in plant or plant["kitList"] is None: continue for kit in plant["kitList"]: - if kit["devicesn"] == self.inverter_sn: + if kit["devicesn"] == self.inverter_sn and kit["type"] == 2: self._attr_extra_state_attributes[I_MODEL] = kit["devicetype"] self._attr_extra_state_attributes[I_SN] = kit["devicesn"] self._attr_extra_state_attributes[B_CAPACITY] = kit[ @@ -1147,10 +1147,9 @@ async def async_update(self) -> None: ]["batCapcityStr"] # Setup state - if kit["onLineStr"] == "1": - self._attr_native_value = kit["storeDevicePower"][ - "batEnergyPercent" - ] + self._attr_native_value = kit["storeDevicePower"][ + "batEnergyPercent" + ] @property def native_value(self) -> float | None: @@ -1163,7 +1162,7 @@ def native_value(self) -> float | None: if "kitList" not in plant or plant["kitList"] is None: continue for kit in plant["kitList"]: - if self.inverter_sn == kit["devicesn"] and kit["onLineStr"] == "1": + if self.inverter_sn == kit["devicesn"] and kit["type"] == 2: value = float(kit["storeDevicePower"]["batEnergyPercent"]) # Setup dynamic attributes