Skip to main content

Controller for TP-Link Tapo P100 and other devices

Project description

Plug P100

This is a fork of original work of @K4CZP3R

The purpose of this fork is to provide the library as PyPi package.

How to install

pip install plugp100

Code example

import asyncio
import os

from plugp100.api.light_effect_preset import LightEffectPreset
from plugp100.api.tapo_client import TapoClient
from plugp100.common.credentials import AuthCredential
from plugp100.discovery.arp_lookup import ArpLookup
from plugp100.discovery.tapo_discovery import TapoDiscovery


async def main():
    # print("Scanning network...")
    # discovered_devices = list(TapoDiscovery.scan(5))
    # for x in discovered_devices:
    #     print(x)

    # if len(discovered_devices) > 0:
    #     print("Trying to lookup with mac address")
    #     lookup = await ArpLookup.lookup(
    #         discovered_devices[0].mac.replace("-", ":"),
    #         "192.168.1.0/24",
    #         allow_promiscuous=False,
    #     )
    #     print(lookup)

    # create generic tapo api
    username = os.getenv("USERNAME", "<tapo_email>")
    password = os.getenv("PASSWORD", "<tapo_password>")

    credentials = AuthCredential(username, password)
    client = TapoClient.create(credentials, "<tapo_device_ip>")

    print(await client.get_device_info())
    print(await client.get_energy_usage())
    print(await client.get_current_power())
    print(await client.get_child_device_list())
    print(await client.get_child_device_component_list())
    print(await client.set_lighting_effect(LightEffectPreset.Aurora.to_effect()))
    # plug = PlugDevice(TapoClient(username, password), "<tapo_device_ip>")
    # light = LightDevice(TapoClient(username, password), "<tapo_device_ip>")
    # ledstrip = LedStripDevice(TapoClient(username, password), "<tapo_device_ip>")

    # - hub example
    # hub = HubDevice(client)
    # print(await hub.get_children())
    # print(await hub.get_state_as_json())


if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.run_until_complete(main())
    loop.run_until_complete(asyncio.sleep(0.1))
    loop.close()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tapo_forky-4.0.3-py3-none-any.whl (86.7 kB view details)

Uploaded Python 3

File details

Details for the file tapo_forky-4.0.3-py3-none-any.whl.

File metadata

  • Download URL: tapo_forky-4.0.3-py3-none-any.whl
  • Upload date:
  • Size: 86.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.10

File hashes

Hashes for tapo_forky-4.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b0a00b9a7e701e866169ad4f277fd5c5d491cf40f779e2385d51930a01a4014c
MD5 ed99968b61068228bb8468776bee4cce
BLAKE2b-256 85819c28bc6b066c67365fffec6b7e76a5fb571bcdfe948acb3dd74d395f447e

See more details on using hashes here.

Supported by

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