Skip to content

Commit

Permalink
ensure property name
Browse files Browse the repository at this point in the history
  • Loading branch information
rewardone committed Oct 15, 2023
1 parent 487ed76 commit 1c21c3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ayla_iot_unofficial"
version = "1.0.8"
version = "1.0.9"
authors = [
{ name="Reward One", email="[email protected]" },
]
Expand Down
2 changes: 1 addition & 1 deletion src/ayla_iot_unofficial/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
AylaReadOnlyPropertyError,
)

__version__ = '1.0.8'
__version__ = '1.0.9'
6 changes: 6 additions & 0 deletions src/ayla_iot_unofficial/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,12 @@ async def async_set_property_value(self, property_name: PropertyName, value: Pro
if isinstance(value, Enum):
value = value.value

if self.properties_full.get(property_name, {}).get('read_only'):
raise AylaReadOnlyPropertyError(f'{property_name} is read only')
else:
""" Get the name of the property. Case sizing for 'SET' varies """
property_name = self.properties_full.get(property_name).get("name")

async with await self.ayla_api.async_request('post', self.datapoints_endpoint, json=self.set_datapoint_payload(property_name, value)) as resp:
resp_data = await resp.json()
await self.async_update()
Expand Down

0 comments on commit 1c21c3b

Please sign in to comment.