Preface
The integration of the Dyson air purifier was my first attempt to integrate a device into openHAB. Therefore this post can change time to time and for sure there are better ways on implementing some of the stuff. If you have feedback or questions on something, just post it.
At the first version of this post, I included all file content in here. In the meantime I decided to outsource it to github into a repository with all needed files included.
The repository can be found here -> https://github.com/mecks52/openhab2-dyson475
Problem Statement
You are the happy owner of a Dyson Pure Cool Link air purifier and you want to integrate it into openHAB.
Used Versions
- OS: Ubuntu 16.04 LTS
- openHAB: 2.4.0 Release Build
- Dyson SW-Ver.: 21.03.08
- Python 3.5
Overview
The solution uses binding-mqtt and transformation-jsonpath to communicate with the air purifier and parsing the received messages.
Openhab subscribes on the Dyson, which acts as mqtt-broker. On changes of the state, the air purifier sends messages to the subscribers and a rule parses the information to the Items. The current sensor values are only send on demand. Therefore a rule requests them each 30 seconds. Another rule parses the answer. Together with the sensor data, the current state is also sent and parsed. If an Item is commanded, a message is created and sent to the air purifier and triggers a state change message on the Dyson.
The goal was to implement the functionality of the Android App. The details about which functionality is implemented are stated in the README file within the repository.
Preconditions
I assume, your air purifier is already connected to your network and binding-mqtt and transformation-jsonpath are installed on openhab. Also python 3 is installed on the PC.
You will need the “Product SSID” and “Product WiFi Password” from the sticker beyond the filter of the Dyson. Additionally the ip address of the air purifier is needed.
Step 1: Prepare files
Download the files from the repository and start the script “prepare.py”. It will ask you for the needed data and modifies the files to match your device.
Step 2: Copy files to openhab
Now copy “dyson475.items” to “openhab2/items”, “dyson475.rules” to “openhab2/rules”, both “dyson475-**.sitemap” to “openhab2/sitemaps” and “dysonapbroker.things” to “openhab2/things”.
Usage
You can use the air purifier now out of the box from one of the given sitemaps. Alternatively you can use the Items in your own sitemaps and rules.