pyblinky


Namepyblinky JSON
Version 4.1.0 PyPI version JSON
download
home_pageNone
SummaryBelkin brand Wemo plug control
upload_time2024-12-21 19:52:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseThe MIT License (MIT) Copyright (c) 2024 pdumoulin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords belkin smart home wemo
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyblinky

Control Belkin brand Wemo smart plugs synchronously or asynchronously.


## Options

| Parameter | Default | Description |
| --- | --- | --- |
| ip | _Required_ | Network location of plug[^1] |
| timeout | 3 | Seconds to wait for response |
| name_cache_age | 0 | Seconds to store plug name before re-querying it |

## Actions

| Action | Parameters | Description |
| --- | --- | --- |
| on | _None_ | Turn plug on |
| off | _None_ | Turn plug off |
| toggle | _None_ | Change plug status |
| burst | seconds | Turn on plug, wait num seconds, then turn off |
| status | _None_ | Get status of plug as (bool) |
| identify | _None_ | Get name of plug (str) |
| rename | name | Rename plug |

A more thorough list of available actions on the plug is documented [here](https://gist.github.com/nstarke/018cd98d862afe0a7cda17bc20f31a1e) and some may be implemented here in the future.

## Examples

### Synchronous

```python
from pyblinky import Wemo

plug = Wemo('192.168.1.87')
print(plug.status())
print(plug.identify())
plug.on()
```


### Asynchronous

```python
import asyncio

from pyblinky import AsyncWemo

plugs = [
	AsyncWemo('192.168.1.87'),
	AsyncWemo('192.168.1.88'),
	AsyncWemo('192.168.1.89')
]

async def main():
    result = await asyncio.gather(
        *(
            [
                x.status()
                for x in plugs
            ] +
            [
                y.identify()
                for y in plugs
            ]
        )
    )
    print(result)

if __name__ == '__main__':
    asyncio.run(main())
```

[^1]: This project does not implement [UPnP](https://en.wikipedia.org/wiki/Universal_Plug_and_Play) interface for device discovery, instead talking to plugs directly by IP address. It is highly recommended to set static IPs for plugs. Discovery may be added at a later date if a suitable library can be found.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyblinky",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "belkin, smart home, wemo",
    "author": null,
    "author_email": "Paul Dumoulin <paul.l.dumoulin@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5e/cc/08c48884494566c12cf5cfc246d4ec579df98b64f2add95bd423e8ed1f24/pyblinky-4.1.0.tar.gz",
    "platform": null,
    "description": "# pyblinky\n\nControl Belkin brand Wemo smart plugs synchronously or asynchronously.\n\n\n## Options\n\n| Parameter | Default | Description |\n| --- | --- | --- |\n| ip | _Required_ | Network location of plug[^1] |\n| timeout | 3 | Seconds to wait for response |\n| name_cache_age | 0 | Seconds to store plug name before re-querying it |\n\n## Actions\n\n| Action | Parameters | Description |\n| --- | --- | --- |\n| on | _None_ | Turn plug on |\n| off | _None_ | Turn plug off |\n| toggle | _None_ | Change plug status |\n| burst | seconds | Turn on plug, wait num seconds, then turn off |\n| status | _None_ | Get status of plug as (bool) |\n| identify | _None_ | Get name of plug (str) |\n| rename | name | Rename plug |\n\nA more thorough list of available actions on the plug is documented [here](https://gist.github.com/nstarke/018cd98d862afe0a7cda17bc20f31a1e) and some may be implemented here in the future.\n\n## Examples\n\n### Synchronous\n\n```python\nfrom pyblinky import Wemo\n\nplug = Wemo('192.168.1.87')\nprint(plug.status())\nprint(plug.identify())\nplug.on()\n```\n\n\n### Asynchronous\n\n```python\nimport asyncio\n\nfrom pyblinky import AsyncWemo\n\nplugs = [\n\tAsyncWemo('192.168.1.87'),\n\tAsyncWemo('192.168.1.88'),\n\tAsyncWemo('192.168.1.89')\n]\n\nasync def main():\n    result = await asyncio.gather(\n        *(\n            [\n                x.status()\n                for x in plugs\n            ] +\n            [\n                y.identify()\n                for y in plugs\n            ]\n        )\n    )\n    print(result)\n\nif __name__ == '__main__':\n    asyncio.run(main())\n```\n\n[^1]: This project does not implement [UPnP](https://en.wikipedia.org/wiki/Universal_Plug_and_Play) interface for device discovery, instead talking to plugs directly by IP address. It is highly recommended to set static IPs for plugs. Discovery may be added at a later date if a suitable library can be found.\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)  Copyright (c) 2024 pdumoulin  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Belkin brand Wemo plug control",
    "version": "4.1.0",
    "project_urls": {
        "Homepage": "https://github.com/pdumoulin/blinky",
        "Issues": "https://github.com/pdumoulin/blinky/issues",
        "Repository": "https://github.com/pdumoulin/blinky.git"
    },
    "split_keywords": [
        "belkin",
        " smart home",
        " wemo"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "daad7891b4d6f5ce500a15827b864e227d27c291717fd365c7dacb0f724c2aca",
                "md5": "54c4269a3714b19c98aeb42be7e7bc12",
                "sha256": "d6fdf14ac3683eaf397f0b0f63931a4d3533eb70ff1fae44df27845b0eb2528e"
            },
            "downloads": -1,
            "filename": "pyblinky-4.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "54c4269a3714b19c98aeb42be7e7bc12",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5454,
            "upload_time": "2024-12-21T19:52:19",
            "upload_time_iso_8601": "2024-12-21T19:52:19.345141Z",
            "url": "https://files.pythonhosted.org/packages/da/ad/7891b4d6f5ce500a15827b864e227d27c291717fd365c7dacb0f724c2aca/pyblinky-4.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ecc08c48884494566c12cf5cfc246d4ec579df98b64f2add95bd423e8ed1f24",
                "md5": "61d2499d676e73a9cdc94d07a08106fb",
                "sha256": "6320d21ae3c7e5b0a8edf106c4bcea70b2b20adeca57d08f273178f4c1a842c8"
            },
            "downloads": -1,
            "filename": "pyblinky-4.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "61d2499d676e73a9cdc94d07a08106fb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5601,
            "upload_time": "2024-12-21T19:52:22",
            "upload_time_iso_8601": "2024-12-21T19:52:22.806694Z",
            "url": "https://files.pythonhosted.org/packages/5e/cc/08c48884494566c12cf5cfc246d4ec579df98b64f2add95bd423e8ed1f24/pyblinky-4.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-21 19:52:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pdumoulin",
    "github_project": "blinky",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyblinky"
}
        
Elapsed time: 0.61574s