Skip to main content

Python library for DIO Chacon wifi's protocol for shutters and switches

Project description

Dio Chacon Wifi API

PyPi GitHub Release Python Version Black Read the docs Codecov Github Activity

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/

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 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 or test_integrations_shutter.py that provide effective implementations.

The library is published in 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. 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 library that we use as a http client for REST requests and websocket exchange. All the library is asynchronous and based on asyncio.

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.

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

dio_chacon_wifi_api-1.2.1-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file dio_chacon_wifi_api-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dio_chacon_wifi_api-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c5b15527f838a5eda0da4406c174cb02893ca991b809b07a639adcd4e5ba167
MD5 954ecf83e30c6232a37b3b685cf6244d
BLAKE2b-256 6333b86789b9e37f33550517769d754540d9d0abc6cbf833a30064cb8cc57130

See more details on using hashes here.

Supported by

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