tapo-forky


Nametapo-forky JSON
Version 4.0.3 PyPI version JSON
download
home_pagehttps://github.com/miumer/tapo
SummaryController for TP-Link Tapo P100 and other devices
upload_time2024-01-13 00:19:08
maintainer
docs_urlNone
author@miumer
requires_python
licenseGPL3
keywords tapo
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Plug P100
This is a fork of original work of [@K4CZP3R](https://github.com/K4CZP3R/tapo-p100-python)

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

# How to install
```pip install plugp100```

# Code example

```python
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()
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/miumer/tapo",
    "name": "tapo-forky",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Tapo",
    "author": "@miumer",
    "author_email": "siimpoldre@gmail.com",
    "download_url": "https://github.com/miumer/tapo",
    "platform": null,
    "description": "# Plug P100\nThis is a fork of original work of [@K4CZP3R](https://github.com/K4CZP3R/tapo-p100-python)\n\nThe purpose of this fork is to provide the library as PyPi package. \n\n# How to install\n```pip install plugp100```\n\n# Code example\n\n```python\nimport asyncio\nimport os\n\nfrom plugp100.api.light_effect_preset import LightEffectPreset\nfrom plugp100.api.tapo_client import TapoClient\nfrom plugp100.common.credentials import AuthCredential\nfrom plugp100.discovery.arp_lookup import ArpLookup\nfrom plugp100.discovery.tapo_discovery import TapoDiscovery\n\n\nasync def main():\n    # print(\"Scanning network...\")\n    # discovered_devices = list(TapoDiscovery.scan(5))\n    # for x in discovered_devices:\n    #     print(x)\n\n    # if len(discovered_devices) > 0:\n    #     print(\"Trying to lookup with mac address\")\n    #     lookup = await ArpLookup.lookup(\n    #         discovered_devices[0].mac.replace(\"-\", \":\"),\n    #         \"192.168.1.0/24\",\n    #         allow_promiscuous=False,\n    #     )\n    #     print(lookup)\n\n    # create generic tapo api\n    username = os.getenv(\"USERNAME\", \"<tapo_email>\")\n    password = os.getenv(\"PASSWORD\", \"<tapo_password>\")\n\n    credentials = AuthCredential(username, password)\n    client = TapoClient.create(credentials, \"<tapo_device_ip>\")\n\n    print(await client.get_device_info())\n    print(await client.get_energy_usage())\n    print(await client.get_current_power())\n    print(await client.get_child_device_list())\n    print(await client.get_child_device_component_list())\n    print(await client.set_lighting_effect(LightEffectPreset.Aurora.to_effect()))\n    # plug = PlugDevice(TapoClient(username, password), \"<tapo_device_ip>\")\n    # light = LightDevice(TapoClient(username, password), \"<tapo_device_ip>\")\n    # ledstrip = LedStripDevice(TapoClient(username, password), \"<tapo_device_ip>\")\n\n    # - hub example\n    # hub = HubDevice(client)\n    # print(await hub.get_children())\n    # print(await hub.get_state_as_json())\n\n\nif __name__ == \"__main__\":\n    loop = asyncio.new_event_loop()\n    loop.run_until_complete(main())\n    loop.run_until_complete(asyncio.sleep(0.1))\n    loop.close()\n```\n\n",
    "bugtrack_url": null,
    "license": "GPL3",
    "summary": "Controller for TP-Link Tapo P100 and other devices",
    "version": "4.0.3",
    "project_urls": {
        "Download": "https://github.com/miumer/tapo",
        "Homepage": "https://github.com/miumer/tapo"
    },
    "split_keywords": [
        "tapo"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85819c28bc6b066c67365fffec6b7e76a5fb571bcdfe948acb3dd74d395f447e",
                "md5": "ed99968b61068228bb8468776bee4cce",
                "sha256": "b0a00b9a7e701e866169ad4f277fd5c5d491cf40f779e2385d51930a01a4014c"
            },
            "downloads": -1,
            "filename": "tapo_forky-4.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed99968b61068228bb8468776bee4cce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 86661,
            "upload_time": "2024-01-13T00:19:08",
            "upload_time_iso_8601": "2024-01-13T00:19:08.553797Z",
            "url": "https://files.pythonhosted.org/packages/85/81/9c28bc6b066c67365fffec6b7e76a5fb571bcdfe948acb3dd74d395f447e/tapo_forky-4.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-13 00:19:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "miumer",
    "github_project": "tapo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "tapo-forky"
}
        
Elapsed time: 0.17124s