You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So from my point of view HomeAttribute (or really any thing in model.py) is only a convenience wrapper around the data returned by the API. It is really just used to "strong type" the data so that it is easier to work with (intelisense etc.).
Which is why I would personally go with your Option 2. I would add a new class HomeeAttributeOptions that strong types all the options and return it from HomeeAttribute:
Most interestingly the last part is exaclty my approach - this is how it looks like in my draft:
@propertydefoptions(self) ->HomeeAttributeOptions:
"""The options collection of the attribute. Optional, not on every attribute."""returnHomeeAttributeOptions(self._data["options"])
An Attribute in Homee can have options.
The currently known are:
At least the last one is useful for other applications acessing Homee. So it is desired to expose them in pymee.
There are two possible approaches:
Option 1
Iterate over the options and convert the dict to an object:
Option 2
Add getters for the known possible options and return empty values if they don't exist.
@FreshlyBrewedCode: Since it is your project, I want to get your opinion on which approach to use before I do a pull request
Example code of an Attribute with options:
The text was updated successfully, but these errors were encountered: