mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-04 09:44:14 +00:00
Update docs with more howto examples (#968)
Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
10
docs/source/guides/connect.md
Normal file
10
docs/source/guides/connect.md
Normal file
@@ -0,0 +1,10 @@
|
||||
(connect_target)=
|
||||
# Connect without discovery
|
||||
|
||||
:::{include} ../codeinfo.md
|
||||
:::
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.deviceconfig
|
||||
:noindex:
|
||||
```
|
10
docs/source/guides/device.md
Normal file
10
docs/source/guides/device.md
Normal file
@@ -0,0 +1,10 @@
|
||||
(device_target)=
|
||||
# Interact with devices
|
||||
|
||||
:::{include} ../codeinfo.md
|
||||
:::
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.device
|
||||
:noindex:
|
||||
```
|
11
docs/source/guides/discover.md
Normal file
11
docs/source/guides/discover.md
Normal file
@@ -0,0 +1,11 @@
|
||||
(discover_target)=
|
||||
# Discover devices
|
||||
|
||||
:::{include} ../codeinfo.md
|
||||
:::
|
||||
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.discover
|
||||
:noindex:
|
||||
```
|
27
docs/source/guides/energy.md
Normal file
27
docs/source/guides/energy.md
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
# Get Energy Consumption and Usage Statistics
|
||||
|
||||
:::{note}
|
||||
In order to use the helper methods to calculate the statistics correctly, your devices need to have correct time set.
|
||||
The devices use NTP (123/UDP) and public servers from [NTP Pool Project](https://www.ntppool.org/) to synchronize their time.
|
||||
:::
|
||||
|
||||
## Energy Consumption
|
||||
|
||||
The availability of energy consumption sensors depend on the device.
|
||||
While most of the bulbs support it, only specific switches (e.g., HS110) or strips (e.g., HS300) support it.
|
||||
You can use {attr}`~Device.has_emeter` to check for the availability.
|
||||
|
||||
|
||||
## Usage statistics
|
||||
|
||||
You can use {attr}`~Device.on_since` to query for the time the device has been turned on.
|
||||
Some devices also support reporting the usage statistics on daily or monthly basis.
|
||||
You can access this information using through the usage module ({class}`kasa.modules.Usage`):
|
||||
|
||||
```py
|
||||
dev = SmartPlug("127.0.0.1")
|
||||
usage = dev.modules["usage"]
|
||||
print(f"Minutes on this month: {usage.usage_this_month}")
|
||||
print(f"Minutes on today: {usage.usage_today}")
|
||||
```
|
10
docs/source/guides/feature.md
Normal file
10
docs/source/guides/feature.md
Normal file
@@ -0,0 +1,10 @@
|
||||
(feature_target)=
|
||||
# Interact with features
|
||||
|
||||
:::{include} ../codeinfo.md
|
||||
:::
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.feature
|
||||
:noindex:
|
||||
```
|
26
docs/source/guides/light.md
Normal file
26
docs/source/guides/light.md
Normal file
@@ -0,0 +1,26 @@
|
||||
(light_target)=
|
||||
# Interact with lights
|
||||
|
||||
:::{include} ../codeinfo.md
|
||||
:::
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.interfaces.light
|
||||
:noindex:
|
||||
```
|
||||
|
||||
(lightpreset_target)=
|
||||
## Presets
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.interfaces.lightpreset
|
||||
:noindex:
|
||||
```
|
||||
|
||||
(lighteffect_target)=
|
||||
## Effects
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.interfaces.lighteffect
|
||||
:noindex:
|
||||
```
|
10
docs/source/guides/module.md
Normal file
10
docs/source/guides/module.md
Normal file
@@ -0,0 +1,10 @@
|
||||
(module_target)=
|
||||
# Interact with modules
|
||||
|
||||
:::{include} ../codeinfo.md
|
||||
:::
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.module
|
||||
:noindex:
|
||||
```
|
10
docs/source/guides/strip.md
Normal file
10
docs/source/guides/strip.md
Normal file
@@ -0,0 +1,10 @@
|
||||
(child_target)=
|
||||
# Interact with child devices
|
||||
|
||||
:::{include} ../codeinfo.md
|
||||
:::
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: kasa.smart.modules.childdevice
|
||||
:noindex:
|
||||
```
|
Reference in New Issue
Block a user