Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 align="center">python-kasa</h2>
# python-kasa

[![PyPI version](https://badge.fury.io/py/python-kasa.svg)](https://badge.fury.io/py/python-kasa)
[![Build Status](https://github.com/python-kasa/python-kasa/actions/workflows/ci.yml/badge.svg)](https://github.com/python-kasa/python-kasa/actions/workflows/ci.yml)
Expand Down
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"myst_parser",
]

myst_enable_extensions = [
"colon_fence",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
24 changes: 24 additions & 0 deletions docs/source/deprecated.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Deprecated API

```{currentmodule} kasa
```
The page contains the documentation for the deprecated library API that only works with the older kasa devices.

If you want to continue to use the old API for older devices,
you can use the classes in the `iot` module to avoid deprecation warnings.

```py
from kasa.iot import IotDevice, IotBulb, IotPlug, IotDimmer, IotStrip, IotLightStrip
```


```{toctree}
:maxdepth: 2

smartdevice
smartbulb
smartplug
smartdimmer
smartstrip
smartlightstrip
```
62 changes: 0 additions & 62 deletions docs/source/discover.rst

This file was deleted.

42 changes: 42 additions & 0 deletions docs/source/guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# How-to Guides

This page contains guides of how to perform common actions using the library.

## Discover devices

```{eval-rst}
.. automodule:: kasa.discover
```

## Connect without discovery

```{eval-rst}
.. automodule:: kasa.deviceconfig
```

## 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 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}")
```
12 changes: 12 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```{include} ../../README.md
```

```{toctree}
:maxdepth: 2
Home <self>
cli
library
contribute
SUPPORTED
```
20 changes: 0 additions & 20 deletions docs/source/index.rst

This file was deleted.

15 changes: 15 additions & 0 deletions docs/source/library.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Library usage

```{currentmodule} kasa
```
The page contains all information about the library usage:

```{toctree}
:maxdepth: 2

tutorial
guides
topics
reference
deprecated
```
134 changes: 134 additions & 0 deletions docs/source/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# API Reference

```{currentmodule} kasa
```

## Discover

```{eval-rst}
.. autoclass:: kasa.Discover
:members:
```

## Device

```{eval-rst}
.. autoclass:: kasa.Device
:members:
:undoc-members:
```

## Modules and Features

```{eval-rst}
.. autoclass:: kasa.Module
:noindex:
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. automodule:: kasa.interfaces
:noindex:
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.Feature
:noindex:
:members:
:inherited-members:
:undoc-members:
```

## Protocols and transports

```{eval-rst}
.. autoclass:: kasa.protocol.BaseProtocol
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.iotprotocol.IotProtocol
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.smartprotocol.SmartProtocol
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.protocol.BaseTransport
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.xortransport.XorTransport
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.klaptransport.KlapTransport
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.klaptransport.KlapTransportV2
:members:
:inherited-members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.aestransport.AesTransport
:members:
:inherited-members:
:undoc-members:
```

## Errors and exceptions

```{eval-rst}
.. autoclass:: kasa.exceptions.KasaException
:members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.exceptions.DeviceError
:members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.exceptions.AuthenticationError
:members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.exceptions.UnsupportedDeviceError
:members:
:undoc-members:
```

```{eval-rst}
.. autoclass:: kasa.exceptions.TimeoutError
:members:
:undoc-members:
Loading