Skip to content

Commit 9aacae2

Browse files
committed
Handle tanks that do not return mixergyPvType
1 parent a2e2a05 commit 9aacae2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

custom_components/mixergy/tank.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,10 @@ async def fetch_tank_information(self):
347347

348348
tank_configuration_json = tank_url_result["configuration"]
349349
tank_configuration = json.loads(tank_configuration_json)
350-
self._has_pv_diverter = (tank_configuration["mixergyPvType"] != "NO_INVERTER")
350+
351+
# Some tanks do not return a mixergyPvType - so force to NO_INVERTER
352+
tank_configuration_pvtype = tank_configuration.get("mixergyPvType", "NO_INVERTER")
353+
self._has_pv_diverter = (tank_configuration_pvtype != "NO_INVERTER")
351354

352355
_LOGGER.debug("Measurement URL is %s", self._latest_measurement_url)
353356
_LOGGER.debug("Control URL is %s", self._control_url)

0 commit comments

Comments
 (0)