Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyomnilogic_local/models/mspconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ class MSPConfig(BaseModel):
backyard: MSPBackyard = Field(alias="Backyard")
groups: list[MSPGroup] | None = None
schedules: list[MSPSchedule] | None = None
checksum: int = Field(alias="CHECKSUM")

def __init__(self, **data: Any) -> None:
# Extract groups from the Groups container if present
Expand Down
4 changes: 1 addition & 3 deletions pyomnilogic_local/omnilogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class OmniLogic:
_api: OmniLogicAPI | OmniLogicMockAPI
_mspconfig_last_updated: float = 0.0
_telemetry_last_updated: float = 0.0
_mspconfig_checksum: int = 0
_telemetry_dirty: bool = True
_refresh_lock: asyncio.Lock
# This is the minimum supported MSP version for full functionality
Expand Down Expand Up @@ -129,7 +128,7 @@ async def refresh(
update_mspconfig = False
if force_mspconfig:
update_mspconfig = True
if self.telemetry.backyard.config_checksum != self._mspconfig_checksum:
if not hasattr(self, "mspconfig") or self.telemetry.backyard.config_checksum != self.mspconfig.checksum:
update_mspconfig = True

if (
Expand All @@ -149,7 +148,6 @@ async def refresh(
if update_mspconfig:
self.mspconfig = await self._api.async_get_mspconfig()
self._mspconfig_last_updated = time.time()
self._mspconfig_checksum = self.telemetry.backyard.config_checksum

if update_mspconfig or update_telemetry:
self._update_equipment()
Expand Down
Loading