diff --git a/pyproject.toml b/pyproject.toml index 1638254..5530310 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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="rewardone@gmail.com" }, ] diff --git a/src/ayla_iot_unofficial/__init__.py b/src/ayla_iot_unofficial/__init__.py index e414ede..b4c577f 100644 --- a/src/ayla_iot_unofficial/__init__.py +++ b/src/ayla_iot_unofficial/__init__.py @@ -13,4 +13,4 @@ AylaReadOnlyPropertyError, ) -__version__ = '1.0.8' \ No newline at end of file +__version__ = '1.0.9' \ No newline at end of file diff --git a/src/ayla_iot_unofficial/device.py b/src/ayla_iot_unofficial/device.py index 1c7c98a..8070829 100644 --- a/src/ayla_iot_unofficial/device.py +++ b/src/ayla_iot_unofficial/device.py @@ -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()