# Dio Chacon Wifi API
[![PyPi](https://img.shields.io/pypi/v/dio-chacon-wifi-api)](https://pypi.org/project/dio-chacon-wifi-api)
[![GitHub Release](https://img.shields.io/github/release/cnico/dio-chacon-wifi-api.svg)](https://github.com/cnico/dio-chacon-wifi-api/releases)
[![Python Version](https://img.shields.io/pypi/pyversions/dio-chacon-wifi-api)](https://pypi.org/project/dio-chacon-wifi-api/)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Read the docs](https://img.shields.io/readthedocs/dio-chacon-wifi-api/latest.svg?label=Read%20the%20Docs)](https://dio-chacon-wifi-api.readthedocs.io/)
[![Codecov](https://codecov.io/gh/cnico/dio-chacon-wifi-api/branch/main/graph/badge.svg)](https://codecov.io/gh/cnico/dio-chacon-wifi-api)
[![Github Activity](https://img.shields.io/github/commit-activity/y/cnico/dio-chacon-wifi-api.svg)](https://github.com/cnico/dio-chacon-wifi-api/commits/main)
DIO Chacon are devices mainly distributed in the European market.
Chacon provide various device to control switches, shutters, camera, lights, etc.
The website contains it all : [https://chacon.com/](https://chacon.com/)
The cool thing about their device is that they have RF (433Mhz, used by remote control in house) and Wifi protocols (used by the mobile App).
The wifi protocol is cloud based with their server and quite reactive through permanent connections (via websockets).
This project is a simple implementation, based on the Wifi protocol, of a python client to give the possibility to connect and acts on the devices. It currently supports switches (plugs or wall box for lights) and shutters. It can lists all registered devices (via the mobile app), get their status (on/off ; open level) and act on them (switch on/off ; move up/down/stop cover or move a given percentage of openess).
It is used in a [HomeAssistant](<https://home-assistant.io/>) integration but is also usable in other automation platforms (jeedom, etc).
## Using this library
To implement a client that interact with Chacon devices, simply have look at [test_integrations_switch.py](https://github.com/cnico/dio-chacon-wifi-api/blob/main//tests/test_integrations_switch.py) or [test_integrations_shutter.py](https://github.com/cnico/dio-chacon-wifi-api/blob/main//tests/test_integrations_shutter.py) that provide effective implementations.
The library is published in [pypi.org](https://pypi.org/) and so can be very easily used in any python project (with python > 3.10).
`pip install dio-chacon-wifi-api`
Note that after the first API call, the connection to the chacon's cloud server is a open in a form of a websocket. To close it, you have to call disconnect method.
Note also that this client has auto reconnection implemented in case of a network temporary failure for example.
## Contributing to this project
If you find bugs or want to improve the library, simply open an issue and propose PR to merge.
Chacon have lots of devices that could be managed via this library.
## Design principles
The wifi protocol is described in [Protocol.md](https://github.com/cnico/dio-chacon-wifi-api/blob/main/Protocol.md).
You can test this protocol manually through postman with establishing a connection via correct authentification (email + password of your chacon mobile app account) ; then upgrade the connection to Websocket and then interact with json messages in the Websocket stream.
For the implementation of the library, it is based on the great [aiohttp](https://docs.aiohttp.org/) library that we use as a http client for REST requests and websocket exchange.
All the library is asynchronous and based on [asyncio](https://docs.python.org/3/library/asyncio-dev.html).
The websocket permanent connection is established lazily when it is necessary (for example for devices discovery) by an asyncio task. This tasks keeps the connection permanent via automatic ping/pong messages.
The protocol is based two types of interaction :
- Requests / Responses : this is handled via json message sent in the websocket with an id (the library automatically manages this id) and a response received from the server that has the same id has the request.
- Server side sent messages : these push messages (for example a switch manually switched on/off with the button or other event) are sent back to the registerer callback method when you initialize the client.
Raw data
{
"_id": null,
"home_page": "https://github.com/cnico/dio-chacon-wifi-api",
"name": "dio-chacon-wifi-api",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "dio, chacon, shutter, switch, api",
"author": "cnico",
"author_email": null,
"download_url": null,
"platform": null,
"description": "# Dio Chacon Wifi API\n\n[![PyPi](https://img.shields.io/pypi/v/dio-chacon-wifi-api)](https://pypi.org/project/dio-chacon-wifi-api)\n[![GitHub Release](https://img.shields.io/github/release/cnico/dio-chacon-wifi-api.svg)](https://github.com/cnico/dio-chacon-wifi-api/releases)\n[![Python Version](https://img.shields.io/pypi/pyversions/dio-chacon-wifi-api)](https://pypi.org/project/dio-chacon-wifi-api/)\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Read the docs](https://img.shields.io/readthedocs/dio-chacon-wifi-api/latest.svg?label=Read%20the%20Docs)](https://dio-chacon-wifi-api.readthedocs.io/)\n[![Codecov](https://codecov.io/gh/cnico/dio-chacon-wifi-api/branch/main/graph/badge.svg)](https://codecov.io/gh/cnico/dio-chacon-wifi-api)\n[![Github Activity](https://img.shields.io/github/commit-activity/y/cnico/dio-chacon-wifi-api.svg)](https://github.com/cnico/dio-chacon-wifi-api/commits/main)\n\nDIO Chacon are devices mainly distributed in the European market.\nChacon provide various device to control switches, shutters, camera, lights, etc.\nThe website contains it all : [https://chacon.com/](https://chacon.com/)\n\nThe cool thing about their device is that they have RF (433Mhz, used by remote control in house) and Wifi protocols (used by the mobile App).\n\nThe wifi protocol is cloud based with their server and quite reactive through permanent connections (via websockets).\n\nThis project is a simple implementation, based on the Wifi protocol, of a python client to give the possibility to connect and acts on the devices. It currently supports switches (plugs or wall box for lights) and shutters. It can lists all registered devices (via the mobile app), get their status (on/off ; open level) and act on them (switch on/off ; move up/down/stop cover or move a given percentage of openess).\n\nIt is used in a [HomeAssistant](<https://home-assistant.io/>) integration but is also usable in other automation platforms (jeedom, etc).\n\n## Using this library\n\nTo implement a client that interact with Chacon devices, simply have look at [test_integrations_switch.py](https://github.com/cnico/dio-chacon-wifi-api/blob/main//tests/test_integrations_switch.py) or [test_integrations_shutter.py](https://github.com/cnico/dio-chacon-wifi-api/blob/main//tests/test_integrations_shutter.py) that provide effective implementations.\n\nThe library is published in [pypi.org](https://pypi.org/) and so can be very easily used in any python project (with python > 3.10).\n\n`pip install dio-chacon-wifi-api`\n\nNote that after the first API call, the connection to the chacon's cloud server is a open in a form of a websocket. To close it, you have to call disconnect method.\n\nNote also that this client has auto reconnection implemented in case of a network temporary failure for example.\n\n## Contributing to this project\n\nIf you find bugs or want to improve the library, simply open an issue and propose PR to merge.\nChacon have lots of devices that could be managed via this library.\n\n## Design principles\n\nThe wifi protocol is described in [Protocol.md](https://github.com/cnico/dio-chacon-wifi-api/blob/main/Protocol.md).\nYou can test this protocol manually through postman with establishing a connection via correct authentification (email + password of your chacon mobile app account) ; then upgrade the connection to Websocket and then interact with json messages in the Websocket stream.\n\nFor the implementation of the library, it is based on the great [aiohttp](https://docs.aiohttp.org/) library that we use as a http client for REST requests and websocket exchange.\nAll the library is asynchronous and based on [asyncio](https://docs.python.org/3/library/asyncio-dev.html).\n\nThe websocket permanent connection is established lazily when it is necessary (for example for devices discovery) by an asyncio task. This tasks keeps the connection permanent via automatic ping/pong messages.\nThe protocol is based two types of interaction :\n\n- Requests / Responses : this is handled via json message sent in the websocket with an id (the library automatically manages this id) and a response received from the server that has the same id has the request.\n- Server side sent messages : these push messages (for example a switch manually switched on/off with the button or other event) are sent back to the registerer callback method when you initialize the client.\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "Python library for DIO Chacon wifi's protocol for shutters and switches",
"version": "1.2.1",
"project_urls": {
"Documentation": "https://dio-chacon-wifi-api.readthedocs.io",
"Homepage": "https://github.com/cnico/dio-chacon-wifi-api",
"Repository": "https://github.com/cnico/dio-chacon-wifi-api"
},
"split_keywords": [
"dio",
" chacon",
" shutter",
" switch",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6333b86789b9e37f33550517769d754540d9d0abc6cbf833a30064cb8cc57130",
"md5": "954ecf83e30c6232a37b3b685cf6244d",
"sha256": "4c5b15527f838a5eda0da4406c174cb02893ca991b809b07a639adcd4e5ba167"
},
"downloads": -1,
"filename": "dio_chacon_wifi_api-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "954ecf83e30c6232a37b3b685cf6244d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 22690,
"upload_time": "2024-08-18T21:00:36",
"upload_time_iso_8601": "2024-08-18T21:00:36.654452Z",
"url": "https://files.pythonhosted.org/packages/63/33/b86789b9e37f33550517769d754540d9d0abc6cbf833a30064cb8cc57130/dio_chacon_wifi_api-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-18 21:00:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cnico",
"github_project": "dio-chacon-wifi-api",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "dio-chacon-wifi-api"
}