Skip to content

Commit

Permalink
fix: enable parsing of multiple heater equipments (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptk committed Jun 23, 2023
1 parent 90f9a94 commit 6601300
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pyomnilogic_local/models/mspconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def __init__(self, **data: Any) -> None:

# The heater equipment are nested down inside a list of "Operations", which also includes non Heater-Equipment items. We need to
# first filter down to just the heater equipment items, then populate our self.heater_equipment with parsed versions of those items.
heater_equip_data = [op for op in data.get("Operation", {}) if OmniType.HEATER_EQUIP in op][0]
self.heater_equipment = [MSPHeaterEquip.parse_obj(equip) for equip in heater_equip_data[OmniType.HEATER_EQUIP]]
heater_equip_data = [op[OmniType.HEATER_EQUIP] for op in data.get("Operation", {}) if OmniType.HEATER_EQUIP in op]
self.heater_equipment = [MSPHeaterEquip.parse_obj(equip) for equip in heater_equip_data]


class MSPChlorinatorEquip(OmniBase):
Expand Down Expand Up @@ -235,7 +235,6 @@ def load_xml(xml: str) -> MSPConfig:
OmniType.FAVORITES,
OmniType.FILTER,
OmniType.GROUPS,
OmniType.HEATER_EQUIP,
OmniType.PUMP,
OmniType.RELAY,
OmniType.SENSOR,
Expand Down

0 comments on commit 6601300

Please sign in to comment.