python-kasa/kasa/smart
Steven B c5d65b624b
Make get_module return typed module (#892)
Passing in a string still works and returns either `IotModule` or
`SmartModule` type when called on `IotDevice` or `SmartDevice`
respectively. When calling on `Device` will return `Module` type.

Passing in a module type is then typed to that module, i.e.:
```py
smartdev.get_module(FanModule)  # type is FanModule
smartdev.get_module("FanModule")  # type is SmartModule
```
Only thing this doesn't do is check that you can't pass an `IotModule`
to a `SmartDevice.get_module()`. However there is a runtime check which
will return null if the passed `ModuleType` is not a subclass of
`SmartModule`.

Many thanks to @cdce8p for helping with this.
2024-05-03 17:01:21 +02:00
..
modules Add LightEffectModule for dynamic light effects on SMART bulbs (#887) 2024-05-02 16:31:12 +02:00
__init__.py Move SmartBulb into SmartDevice (#874) 2024-04-29 18:19:44 +01:00
smartchilddevice.py Add support for waterleak sensor (T300) (#876) 2024-04-30 17:31:47 +02:00
smartdevice.py Make get_module return typed module (#892) 2024-05-03 17:01:21 +02:00
smartmodule.py Add ColorModule for smart devices (#840) 2024-04-20 17:18:35 +02:00