python-kasa/docs/source/featureattributes.md
Steven B. 59e5073509
Update docs for new FeatureAttribute behaviour ()
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-12-13 22:23:58 +01:00

590 B

Some modules have attributes that may not be supported by the device. These attributes will be annotated with a FeatureAttribute return type. For example:

    @property
    def hsv(self) -> Annotated[HSV, FeatureAttribute()]:
        """Return the current HSV state of the bulb."""

You can test whether a FeatureAttribute is supported by the device with {meth}kasa.Module.has_feature or {meth}kasa.Module.get_feature which will return None if not supported. Calling these methods on attributes not annotated with a FeatureAttribute return type will return an error.