OPENTPL

FREEMIUM
Durch stickyMonkeyFlowerLabs | Aktualisiert 15日前 | Energy
Popularität

7.3 / 10

Latenz

1,339ms

Service Level

100%

Health Check

N/A

Follower: 5
Ressourcen:
Produktwebsite Nutzungsbedingungen
API-Ersteller:
Rapid account: Sticky Monkey Flower Labs
stickyMonkeyFlowerLabs
clenox
Melden Sie sich bei Rate API an
Bewertung: 5 - Stimmen: 1

README

OpenTPL is an UNOFFICIAL API providing the ability to monitor and control TP-Link (Kasa) Smart Plugs and Switches.

The HS-110 , HS-100, and KP-115 Smart Plugs, HS-300 Smart Power Switch, and HS-200 Smart Switch are verified to be supported. It may be possible to control other TP-Link smart plugs, but these have not been evaluated by the API developer.

This API allows the user to monitor and control devices across multiple KasaSmart accounts (with valid credentials).

A Python module to call OpenTPL using a simple function is also available for your convenience: https://github.com/clenox/opentpl-module-python

This API accepts “POST” calls with a JSON body the form of:

> {“uuid”: “username”, “body” : {“command”: “foo”, “arg”: “bar”, … } }

The API returns a JSON response in the form of:

> {“error”: “error_response”, “response label”: “response”}

Responses may be nested. If there is no error, the value for “error” will always be False. Otherwise, the error field will indicate the specific error.

See the API ‘Endpoints’ for the full specification and example responses.

Current functionality includes:

Account Management

OpenTPL supports multiple KasaSmart ‘user accounts’ beneath your master RapidAPI account.

Users registered under a RapidAPI ‘master’ account are only accessible to that RapidAPI account. A user is defined by having a TP-Link KasaSmart account. To add a user, the OpenTPL user must provider the username (uuid) and password associated with the user’s KasaSmart account. The OpenTPL user is able to easily interact with all of their registered KasaSmart accounts using only the username of each account.

Account management includes background handling of TP-Link key rotation and re-authentication. This occurs without any intervention needed on the part of the OpenTPL user.

User accounts are created with the

> “create_user”

command

And are deleted with the

> “del_user”

command.

Note this only creates / deletes the KasaSmart user credentials stored in the OpenTPL user’s account. This has no effect on the KasaSmart account itself.

Plug Data and Commands

> “plug_names”

Returns each smart plug’s unique alphanumeric ID as a key, and the plug’s name / alias (set by the user in the KasaSmart app) as a value.

The unique ID (not plug name / alias) of the target smart plug is needed to execute the following commands:

> “status”

Returns the status of the designated plug (online or offline).

> “data”

Returns the current power value reading (in Watts) of the designated plug. Currently acquiring power data from the KP-115, HS-110 and HS-300 models is supported and has been tested. Note that many models DO NOT provide power measurement. In the case that power measurements are not available from a particular model, an error will be returned.

> “ON”

Turns the designated plug on

> “OFF”

Turns the designated plug off

Note that ON, OFF, and data commands invoked through OpenTPL perform a status check behind the scenes . The API will return “offline” as an error message if the plug cannot be reached when a command is executed.

Therefore, there is no need for the OpenTPL user to perform a status check before invoking these commands.