Skip to main content

Control Tasmota devices via their web api

Project description

Tasmota Device Controller

This packag provides async wrappers for Tasmota's web request API.

Only very few requests are implemented so far! If you need other requests, please have a look at the section Contributing, or create an issue.

set methods return a boolean whether the request succeeded, get methods return the value of the fetched item.

Since this package was created for a Home Assistant integration, you can check out that integration for other sample usage.

Example usage:

import asyncio
from tasmotadevicecontroller import TasmotaDevice
from tasmotadevicecontroller import tasmota_types as t

async def main():
    device = await TasmotaDevice.connect('192.168.10.21')

    # Get friendly name (of first output, which is the default output)
    nameResult = await device.getFriendlyName()
    print(nameResult)  # Returns 'My Tasmota Plug'

    # Get power of first output
    getResult = await device.getPower()
    print(getResult)  # Returns True (on)

    # Set power of first output to on
    setResult = await device.setPower(t.PowerType.TOGGLE)
    print(setResult)  # Returns True (command succeeded)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Contributing

If you want to add new requests, can implement these commands and create a merge request on GitHub.

Almost every command is implemented as one getter method and one setter method. Add your command if possible in the same way inside the TasmotaDevice class. Remember to add descriptions to each method. This description can usually be taken from the Tasmota wiki.
Also, remember to always use async await!

If the command takes values from a specific set of values, create an Enum inside tasmota_types.py for it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tasmotadevicecontroller-0.0.4.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

tasmotadevicecontroller-0.0.4-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file tasmotadevicecontroller-0.0.4.tar.gz.

File metadata

  • Download URL: tasmotadevicecontroller-0.0.4.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for tasmotadevicecontroller-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7df6f08705f190d2cb292e1e5b27b64c200edab8b9fdf1a1d5aced5fd0dc17e3
MD5 07b3ad6b1c507619619048c34381a8a7
BLAKE2b-256 dabaaf9668497c45757e0043ce92d277d963818254b14c7d12861e0aedee63b8

See more details on using hashes here.

File details

Details for the file tasmotadevicecontroller-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: tasmotadevicecontroller-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for tasmotadevicecontroller-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2b86f0a2405c32ca2ed97e11e2afafee33c20d8cb1ad9b8c923101ea208a9fb0
MD5 792dbed821dd09612e67f7148a6f2727
BLAKE2b-256 0c5716a51fbdc977759a2ace9907c101f4f69c8e55a0188ce8b25ae2e967f91e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page