mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 18:54:08 +00:00
Add some device fixtures (#948)
Adds some device fixtures by courtesy of @jimboca, thanks! This is a slightly patched and rebased version of #441. --------- Co-authored-by: JimBo <jimboca3@gmail.com> Co-authored-by: sdb9696 <steven.beth@gmail.com>
This commit is contained in:
@@ -33,7 +33,8 @@ class IotLightStrip(IotBulb):
|
||||
Currently active effect:
|
||||
|
||||
>>> strip.effect
|
||||
{'brightness': 50, 'custom': 0, 'enable': 0, 'id': '', 'name': ''}
|
||||
{'brightness': 100, 'custom': 0, 'enable': 0,
|
||||
'id': 'bCTItKETDFfrKANolgldxfgOakaarARs', 'name': 'Flicker'}
|
||||
|
||||
.. note::
|
||||
The device supports some features that are not currently implemented,
|
||||
|
@@ -45,6 +45,9 @@ class LightPreset(IotModule, LightPresetInterface):
|
||||
self._presets = {
|
||||
f"Light preset {index+1}": IotLightPreset(**vals)
|
||||
for index, vals in enumerate(self.data["preferred_state"])
|
||||
# Devices may list some light effects along with normal presets but these
|
||||
# are handled by the LightEffect module so exclude preferred states with id
|
||||
if "id" not in vals
|
||||
}
|
||||
self._preset_list = [self.PRESET_NOT_SET]
|
||||
self._preset_list.extend(self._presets.keys())
|
||||
@@ -133,7 +136,9 @@ class LightPreset(IotModule, LightPresetInterface):
|
||||
def _deprecated_presets(self) -> list[IotLightPreset]:
|
||||
"""Return a list of available bulb setting presets."""
|
||||
return [
|
||||
IotLightPreset(**vals) for vals in self._device.sys_info["preferred_state"]
|
||||
IotLightPreset(**vals)
|
||||
for vals in self._device.sys_info["preferred_state"]
|
||||
if "id" not in vals
|
||||
]
|
||||
|
||||
async def _deprecated_save_preset(self, preset: IotLightPreset):
|
||||
|
Reference in New Issue
Block a user