Skip to content

Commit

Permalink
Remove attributes for unknown devices
Browse files Browse the repository at this point in the history
  • Loading branch information
sopelj committed Dec 26, 2023
1 parent 0cce46c commit 70e6618
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ember_mug/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@ def device_type(self) -> DeviceType: # type: ignore[override]
def device_attributes(self) -> set[str]:
"""Attributes to update based on model and extra."""
attributes = EXTRA_ATTRS | INITIAL_ATTRS | UPDATE_ATTRS
if not self.model or self.device_type in (DeviceType.CUP, DeviceType.TUMBLER):
unknown = (None, DeviceModel.UNKNOWN_DEVICE)
if self.model in unknown or self.device_type in (DeviceType.CUP, DeviceType.TUMBLER):
# The Cup and Tumbler cannot be named
attributes -= {"name"}
elif not self.model or self.device_type == DeviceType.TRAVEL_MUG:
elif self.model in unknown or self.device_type == DeviceType.TRAVEL_MUG:
# Tge Travel Mug does not have an LED colour, but has a volume attribute
attributes = (attributes - {"led_colour"}) | {"volume_level"}
if self.model != DeviceModel.TRAVEL_MUG_12_OZ:
Expand Down

0 comments on commit 70e6618

Please sign in to comment.