Skip to content

Commit

Permalink
Fix read-only check for miotsimulator (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti committed Jan 26, 2023
1 parent 437e038 commit 4c58eed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions miio/devtools/simulators/miotsimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from miio import PushServer
from miio.miot_cloud import MiotCloud
from miio.miot_models import DeviceModel, MiotProperty, MiotService
from miio.miot_models import DeviceModel, MiotAccess, MiotProperty, MiotService

from .common import create_info_response, mac_from_model

Expand Down Expand Up @@ -62,7 +62,7 @@ def verify_value(cls, v, values):
"""
if v == UNSET:
return create_random(values)
if "write" not in values["access"]:
if MiotAccess.Write not in values["access"]:
raise ValueError("Tried to set read-only property")

try:
Expand Down Expand Up @@ -271,7 +271,6 @@ def miot_simulator(file, model):
dev = SimulatedDeviceModel.parse_raw(data)
else:
cloud = MiotCloud()
# TODO: fix HACK
dev = SimulatedDeviceModel.parse_obj(cloud.get_model_schema(model))

loop = asyncio.get_event_loop()
Expand Down

0 comments on commit 4c58eed

Please sign in to comment.