Brel offers some great motors for blinds and screens, for inside and outside use. Now there is a gateway in the form of the Brel Home Hub, which can be controlled from your smartphone. Ofcourse we want Domoticz to be able to communicate with the Home Hub aswel, and now we can!
If you want to know more what the Brel Home Hub is all about, check their website: (https://www.brel-motors.nl/brel-app.html
). But for now, let's read ahead and check out this plugin!
The plugin supports and is able to controll the following devices:
The plugin doesn't work with:
Most systems capable of running domoticz and has a version of python3 available should be able to run the plugin.
$ cd domoticz/plugins/
$ git clone https://github.com/superjunky/Domoticz-Brel-Plugin.git Domoticz-Brel-Plugin
$ pip3 install -U pip
The plugin uses the pycrypto python module (https://pypi.org/project/pycrypto/
)
$ pip3 install pycryptodome
Domoticz may not have the path to the pycrypto library in its python environment. In this case you will observe something starting like that in the log:
To find where pycrypto is installed, in a shell:
$ pip3 show pycrypto
The Crypto directory should be present in the directory indicated with Location.
When you have it installed, just add a symbolic link to it in Domoticz-Brel-Plugin directory with ln -s
.
Example:
$ cd ~/domoticz/plugins/Domoticz-Brel-Plugin
$ ln -s /home/pi/.local/lib/python3.5/site-packages/Crypto Crypto
Don't forget to enable "Allow new Hardware" in the Domoticz settings page.
Let's start with an example:
-1:{"o":{"P":15,"A":25},"c":{"P":80,"A":80}}
In conclusion, a full array could look like this:
-1:{"o":{"P":15,"A":25},"c":{"P":100,"A":90}}, 0:{"o":{"A":25}}, 3:{"c":{"P":80,"A":80}}
To update the plugin to the newest version, stop domoticz, enter the plugin directory, pull the latest changes from git and restart domoticz:
$ cd domoticz/plugins/Domoticz-Brel-Plugin
$ git pull
None so far.
Devices have to be added to the gateway as per Brel's instructions, using the official Brel app.
Domoticz sets the position of a blind as a percentage between 0 (fully open) to 100 (fully closed). You need to set the minimum/maximum posistions of the blind before using Domoticz. Please refer to the instructions from Brel on how to set the maximum positions of a blind.
Besides the position, Domoticz can set the angle of a venetian blind in degrees. An additional device is created, where the name will end with "Tilt". For this device you can set a percentage between 0 and 100, and is converted by the plugin into degrees between 0 and 180. To open your blinds, set the angle to 50% (which translates to 90 degrees).
By default this Tilt-device in Domoticz will send a 90-degrees-command when switched on, and a 0-degrees-command when switched of. Use the slider to choose a custom position.
So, you have Domoticz running at home, AND you have an iPhone? Chances are you have a copy of Homebridge running aswel. Then go ahead:
{idx_position}
and {idx_tilt}
with the idx's of the Domoticz devices...And there you go, your Brel-blinds can be controlled from within your Apple's Homekit :)
{
"accessory": "mqttthing",
"type": "windowCovering",
"name": "{Blinds name}",
"topics": {
"getCurrentPosition": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == {idx_position} ? Math.round( 100 - JSON.parse(message).svalue1 ) : undefined"
},
"setTargetPosition": {
"topic": "domoticz/in",
"apply": "return JSON.stringify({command: 'switchlight', idx: {idx_position}, switchcmd: 'Set Level', level: Math.round( 100 - message ) })"
},
"getTargetPosition": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == {idx_position} ? Math.round( 100 - JSON.parse(message).svalue1 ) : undefined"
},
"getPositionState": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == {idx_position} || JSON.parse(message).idx == {idx_tilt} ? 'STOPPED' : undefined"
},
"setTargetHorizontalTiltAngle": {
"topic": "domoticz/in",
"apply": "return JSON.stringify({command: 'switchlight', idx: {idx_tilt}, switchcmd: 'Set Level', level: Math.round( (message + 90) / 1.8) })"
},
"getTargetHorizontalTiltAngle": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == {idx_tilt} ? Math.round( (JSON.parse(message).svalue1 * 1.8) - 90 ) : undefined"
},
"getCurrentHorizontalTiltAngle": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == {idx_tilt} ? Math.round( (JSON.parse(message).svalue1 * 1.8) - 90 ) : undefined"
}
},
"startPub": [
{
"topic": "domoticz/in",
"message": "{\"command\": \"getdeviceinfo\", \"idx\": {idx_position} }"
},
{
"topic": "domoticz/in",
"message": "{\"command\": \"getdeviceinfo\", \"idx\": {idx_tilt} }"
}
],
"manufacturer": "Brel",
"model": "Venetian Blinds",
"serialNumber": "Idx {idx_position}"
}