Hello readers,
this time I want to talk with you about a project I’m following for a friend of mine. He have a villa which he recently restructured and he basically started with the electricians to implement in his house this new kind of controllers for lights and curtains.
The system is easy to configure but the problem he had was the fact that the curtain controller was not compatible with the curtains motors he installed.
Basically the controllers was meant to work with a 3 wires motors but the motors are meant to be controlled with RF remote.
What are we using?
The controller is branded Jinvoo and inside is controlled by an ENC8266 on which runs a firmware owned from Tuya.
This controller is installed in a wall-mount and is meant to control a motor through 3 wires. Through this cables he is able to tell the motor in which direction he have to spin and the controller can read the current absorption to learn and check in which position is the roll-up curtain.

The product is very good looking. It works whit different apps: one is from the same Jinvoo but the one we preferred is called “Smart Life” from Tuya.
The curtain motor is build from Dooya and is a tubular motor which can be controlled through a remote. The tent motor have a single button on it which is used for all the setup operation. Very important is the remote, in this case we have the one given from the producer of the curtain.

They noticed this compatibility problem after all the electric system and the curtains were already been installed.
At this point he had to choose if going fto change all the motors (16 of them) or to remove the wall mounted controllers and control the tents with the remote.

So one day passing by his shop he mention me the situation he was having and I started thinking about how I could have solved the problem.
I thought it could be easy but as usual nothing is how you expect.
Basically I had to put together 2 technology not meant to work together and in the case of the controller switch I realized it was a closed environment not able to work with the products which were not based on Tuya environment.
How am I going to solve this rebus?
I’ve already run all the tests and at the end I came up with a solution which involve a Raspberry Pi with installed OpenHab and the Broadlink RM Pro+ which will be needed to send the command through RF to the curtains.

Starting from the curtain controller after I noticed they are not able to work with products not belonging to the Tuya environment I had to find another way.
My goal was to see which button was being pressed and make elaborate that information from the Raspberry.
I had 3 choices: proxy all the connections from the Controller so I could read their values and figure out which button was being pressed, use a program available on GitHub which can connect to the “Tuya cloud” or Flash a new firmware inside the controllers.
Flashing a new firmware
After several tries I went for flashing a new firmware inside the controller even because the other 2 solution could have lead to future problems because a future firmware update of the controllers could have vanished all my work.
As new firmware for my controllers I opted for Tasmota which was compatible and already tested on this devices.
The flashing procedure is easy since it doesn’t involve to open every device to flash it but a tool has been released for this purpose which allow you to use a flaw in their firmware update procedure to implant your new one.
The GitHub project is TUYA-CONVERT
Comunicate with OpenHab
Tasmota has the opportunity to comunicate with MQTT which is the communication technology I’m going to use in this project.
This communication is based on “topics” in which you’re going to write a value that is going to be available for all the other devices that are listening to it.
MQTT is based on a server called “MQTT broker” which is going run on the Raspberry thanks to an already built-it function of OpenHab.
In this way every time someone is going to push a button on the controller OpenHab will now it and we will be able to give this orders now even from the OpenHab panel after we will set it up.
Control the curtain through Broadlink
Next step is to send the order to our tents and here we have our Broadlink device ready to help us. This system supports some commands received through some APIs so now we have to find the way to do this.
OpenHab yet doesn’t have a built in function for this but on GitHub I found 2 persons who made some programs in Python which can listen on MQTT topics and send the content of them to our Broadlink RM Pro+:
I’ve tried both of this programs and at the end I opted for the one of “fbacker” which has a built in web page that gives you a graphical interface to setup everything instead being there working directly on terminal and files. (I chose this way because since I have to work with many devices is going to result more in order by my perspective).
This way our OpenHab is able through this script to communicate with the Broadlink which is going to cast it the air the order previously recorded (which is basically a string of letters, numbers and symbols) and activate like this our tents motor.
End of this article
Of course the setup is going to be hard if you’re not familiar with this world.
Is not for someone who is getting into it now. This is not “programming” but you must have specific knowledge.
If you want to get into this project more or you’re looking for something similar let me know and I will help you as best as I can.
Till next post guyz .