{ "info": { "author": "Fran\u00e7ois Wautier", "author_email": "francois@wautier.eu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5" ], "description": "# aiotplink\nLibrary to communicate with TP-Link Smart Plugs and similar devices\n## Features\n\n* Supports TPLink Smart Switches and Lights\n* Python API to interact with device at a low level using asyncio\n\n## About this library\n\nBased on the work done by [SoftSCheck](https://github.com/softScheck/tplink-smartplug)\n and [GadgetReactor](https://github.com/GadgetReactor/pyHS100)\n\n## Installation\n```\n$ sudo pip3 install aiotplink\n\n```\n\nAt this point you should be able to use\n\nYou can try:\n```\npython3 -m aioyplink\n```\nAnd you should be able to turn On/Off your devices\n\n## Using the library.\n\nTo make things simple, you create a class with 2 methods, \"register\" and \"unregister\"\n\n class devices():\n \"\"\" A simple class with a register and unregister methods\n \"\"\"\n def __init__(self):\n self.devices={}\n self.doi=None #device of interest\n\n def register(self,info, addr):\n if \"mac\" in info and info[\"mac\"].lower() not in self.devices:\n self.devices[info[\"mac\"].lower()] = aiot.GetDevice(addr,info,hb=10)\n else:\n self.devices[info[\"mac\"].lower()].addr = addr\n\n def unregister(self,mac):\n if mac.lower() in self.devices:\n print (\"%s is gone\"% self.devices[mac.lower()].name)\n self.devices[mac.lower()].stop()\n del(self.devices[mac.lower()])\n\n def stop(self):\n for dev in self.devices.values():\n dev.stop()\n\nWhen registering, you get an dictionary with the flatten out info from a TP-Link device, and an address with\nthe format (ip address, port). You can pass those information directly to 'GetDevice' to get the correct object.\n\n'GetDevice\" is defined like so\n\n GetDevice(addr,info,hb=HBTIMEOUT,on_change=lambda x: print(x))\n\nWith addr, the address pair, info, the flatten out informaton from discovery, hb, a heatbeat timeout in secs and\non_change a function that will react to whatever is produced by the heartbeat. Note that if the device has an energy meter,\nthose values will automatically be produced with the heartbeat.\n\nAfter that it is quite simple.\n\n MyDevices= devices()\n loop = aio.get_event_loop()\n discovery = aiot.TPLinkDiscovery(loop, MyDevices, repeat=15)\n try:\n loop.add_reader(sys.stdin,readin)\n discovery.start()\n print(\"Hit \\\"Enter\\\" to start\")\n print(\"Use Ctrl-C to quit\")\n loop.run_forever()\n except:\n print(\"Exiting at user's request.\")\n finally:\n MyDevices.stop()\n discovery.cleanup()\n loop.remove_reader(sys.stdin)\n loop.run_until_complete(aio.sleep(10))\n loop.close()\n\nCreate a registrar instance\nCreate a TPLinkDiscovery instance passing the registrar and how often to run discovery\nStart discovery, and you are on your merry way.\n\nThe various device object will have these methods available.\n\n on(): Turning the device on\n off(): Turning the device off\n led_on(): Turn the LED light on (AKA \"Night mode\" off)\n led_off : Turn the LED light off (AKA \"Night mode\" on)\n set_name(name)\n set_brighness)\n set_temperature()\n set_colour(hue, saturation, value)\n\ndepending on their capabilities.\n\nMost commands are defined in the commands.py file.\n\n\n## Troubleshooting\n\nOpen an issue and I'll try to help.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/frawau/aiotplink/archive/0.1.0b1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/frawau/aiotplink", "keywords": "TP-Link,IoT,switch,Smart Plug,automation", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "aiotplink", "package_url": "https://pypi.org/project/aiotplink/", "platform": "", "project_url": "https://pypi.org/project/aiotplink/", "project_urls": { "Download": "https://github.com/frawau/aiotplink/archive/0.1.0b1.tar.gz", "Homepage": "http://github.com/frawau/aiotplink" }, "release_url": "https://pypi.org/project/aiotplink/0.1.0b1/", "requires_dist": null, "requires_python": "", "summary": "API for local communication with TP-Link Smart Plugs devices over a LAN with asyncio.", "version": "0.1.0b1" }, "last_serial": 4525874, "releases": { "0.1.0b1": [ { "comment_text": "", "digests": { "md5": "2f806ce59e3d96c40f8754cca2899d98", "sha256": "223091c74c55f742836d0a8157c0b35b9ed16ad4c54ec5ce82fab30139280e8e" }, "downloads": -1, "filename": "aiotplink-0.1.0b1-py3-none-any.whl", "has_sig": false, "md5_digest": "2f806ce59e3d96c40f8754cca2899d98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17762, "upload_time": "2018-11-25T11:50:20", "url": "https://files.pythonhosted.org/packages/24/39/f80f712d06b40d8b208613b3803d2c5926505100b9943143fbd58fcd32d3/aiotplink-0.1.0b1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "207a7d964df6be1e3222cf228635e681", "sha256": "63bba3a5142f6223fcb03aa92e410320eb79550ee2d44ec6f6893ad2408350f4" }, "downloads": -1, "filename": "aiotplink-0.1.0b1.tar.gz", "has_sig": false, "md5_digest": "207a7d964df6be1e3222cf228635e681", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11961, "upload_time": "2018-11-25T11:50:22", "url": "https://files.pythonhosted.org/packages/2c/8e/0da9fb04d757a39263687d4e3725e53dfecd73a853a5e4b8a19b4053f43a/aiotplink-0.1.0b1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2f806ce59e3d96c40f8754cca2899d98", "sha256": "223091c74c55f742836d0a8157c0b35b9ed16ad4c54ec5ce82fab30139280e8e" }, "downloads": -1, "filename": "aiotplink-0.1.0b1-py3-none-any.whl", "has_sig": false, "md5_digest": "2f806ce59e3d96c40f8754cca2899d98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17762, "upload_time": "2018-11-25T11:50:20", "url": "https://files.pythonhosted.org/packages/24/39/f80f712d06b40d8b208613b3803d2c5926505100b9943143fbd58fcd32d3/aiotplink-0.1.0b1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "207a7d964df6be1e3222cf228635e681", "sha256": "63bba3a5142f6223fcb03aa92e410320eb79550ee2d44ec6f6893ad2408350f4" }, "downloads": -1, "filename": "aiotplink-0.1.0b1.tar.gz", "has_sig": false, "md5_digest": "207a7d964df6be1e3222cf228635e681", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11961, "upload_time": "2018-11-25T11:50:22", "url": "https://files.pythonhosted.org/packages/2c/8e/0da9fb04d757a39263687d4e3725e53dfecd73a853a5e4b8a19b4053f43a/aiotplink-0.1.0b1.tar.gz" } ] }