Skip to content

Commit

Permalink
fix: make some Tile attributes optional in models
Browse files Browse the repository at this point in the history
It appears that depending on the exact model and account
settings, Roth's API doesn't always return a complete set
of fields for a given account or module, leading to
validation errors when listing modules.

Related: home-assistant/core#126503
  • Loading branch information
jnsgruk committed Sep 27, 2024
1 parent a0e02f1 commit 6076a60
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pytouchlinesl/client/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ class ZonesModel(BaseModel):


class ParamsModel(BaseModel):
description: str
description: Optional[str]
working_status: Optional[bool] = Field(None, alias="workingStatus")
txt_id: int = Field(..., alias="txtId")
icon_id: int = Field(..., alias="iconId")
txt_id: Optional[int] = Field(..., alias="txtId")
icon_id: Optional[int] = Field(..., alias="iconId")
version: Optional[str] = None
company_id: Optional[int] = Field(None, alias="companyId")
controller_name: Optional[str] = Field(None, alias="controllerName")
Expand All @@ -149,9 +149,9 @@ class TileModel(BaseModel):

class ModuleModel(BaseModel):
zones: ZonesModel
tiles: List[TileModel]
tiles_order: Any = Field(..., alias="tilesOrder")
tiles_last_update: str = Field(..., alias="tilesLastUpdate")
tiles: Optional[List[TileModel]]
tiles_order: Optional[Any] = Field(..., alias="tilesOrder")
tiles_last_update: Optional[str] = Field(..., alias="tilesLastUpdate")


class AccountModuleModel(BaseModel):
Expand Down

0 comments on commit 6076a60

Please sign in to comment.