mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Update docs with more howto examples (#968)
Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
@@ -1,4 +1,44 @@
|
||||
"""Module for base light effect module."""
|
||||
"""Interact with a TPLink Light Effect.
|
||||
|
||||
>>> from kasa import Discover, Module, LightState
|
||||
>>>
|
||||
>>> dev = await Discover.discover_single(
|
||||
>>> "127.0.0.3",
|
||||
>>> username="user@example.com",
|
||||
>>> password="great_password"
|
||||
>>> )
|
||||
>>> await dev.update()
|
||||
>>> print(dev.alias)
|
||||
Living Room Bulb
|
||||
|
||||
Light effects are accessed via the LightPreset module. To list available presets
|
||||
|
||||
>>> if dev.modules[Module.Light].has_effects:
|
||||
>>> light_effect = dev.modules[Module.LightEffect]
|
||||
>>> light_effect.effect_list
|
||||
['Off', 'Party', 'Relax']
|
||||
|
||||
To view the currently selected effect:
|
||||
|
||||
>>> light_effect.effect
|
||||
Off
|
||||
|
||||
To activate a light effect:
|
||||
|
||||
>>> await light_effect.set_effect("Party")
|
||||
>>> await dev.update()
|
||||
>>> light_effect.effect
|
||||
Party
|
||||
|
||||
If the device supports it you can set custom effects:
|
||||
|
||||
>>> if light_effect.has_custom_effects:
|
||||
>>> effect_list = { "brightness", 50 }
|
||||
>>> await light_effect.set_custom_effect(effect_list)
|
||||
>>> light_effect.has_custom_effects # The device in this examples does not support \
|
||||
custom effects
|
||||
False
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
Reference in New Issue
Block a user