Somfy RTS support with Tasmota - GitHobi/Tasmota GitHub Wiki

The intention of this fork was to provide support for Somfy RTS blinds, using a CC1101 serial transmitter. This fork is based on the work of

Background

I'm having Home Assistant running and wanted to control my blinds. I had this already running with FHEM and a CUL based on CC1101 (Signalduino), which worked pretty good. But I did not find a simple integration into Home Assistant, so decided to send commands from Home Assistant to FHEM using mqtt to control the blinds.

The integration in FHEM however had always one issue: The CUL does not give a feedback if the command was actually sent, or not. If the command was not sent, FHEM incremented the rolling code of the blind - which finally cases the blind to not work any more. This happened about once all 3-4 weeks - fixing this was annoying.

As I found the work of he-so I decided to adapt this solution, as this way no FHEM is needed any more + the chance to mess up the rolling codes is much smaller

Attention I do currently not plan to merge back my chances to Tasmota. This is mainly because I'm not familiar enough with the Tasmota code base to implement it in the correct way. I'm pretty sure my work is "horrible" for real Tasmota developers.

Features

  • support for the standard commands of Somfy RTS (up, down, stop, prog)
  • support for CC1101
  • support for more than one remote
  • integration in Tasmotas "Blinds and Shutters" feature possible

What to do to get it running

This is a standard fork of Tasmota, so you should be able to compile it as usual. In "my_user_config.h" you need to make sure that this line is uncommented:

#define USE_SOMFY

In "tasmota.h" there is a setting to define how many virtual Somfy RTS remotes you want. By default there are two (I needed two).

#define MAX_SOMFY_REMOTES 2

You can increase the value as needed. Each remote takes about 6 bytes for "settings" - so be aware that you might run out of flash memory for the settings. If you want to control the blinds with Tasmota, more than 4 makes no sense, as this is the upper limit of the hardware (ESP8266).

Communication with the CC1101 is (currently) done using the ELECHOUSE CC1101 library. This mainly means that you need to have the full SPI connected to your CC1101. The needed pins cannot be used for other things (like blind relais!). In addition you need to configure the PIN for GDO0 (in my setup I'm using D1).

The whole wiring for a WeMo Mini should look as described here

Attention

I had issues to have Tasmota to store the needed Somfy RTS settings. I'm pretty sure that my setup will mess up the settings structure of Tasmota. So do not expect that your settings will survive if you apply this code! You'll need to re-configure your device.

Operating the blinds

You can operate the blinds with these commands:

Command Parameters
SomfySet<x> <addr> <code> 1..n (default=1).
Sets the parameters for the blind.
<addr> is the address / identifier for the blind (24bit),
<code> is the rolling code (16 bit). If you want to connect a new blind, you can choose arbitrary values.
Both values can be given in as integer or hex.
Example:
SomfySet 0x200812 0x4711
SomfySet1 123455 0
SomfyProg<x> 1..n (default=1).
Send a "prog" command to the blind,
needed to register your virtual remote with the blind
SomfyUp<x> 1..n (default=1).
Move the blind upwards
SomfyDown<x> 1..n (default=1).
Move the blind downwards
SomfyStop<x> 1..n (default=1).
Stop the movement of the blind.
If the blind is not moving the blind will be sent to the "my-pos" position.
SomfyValues<x> 1..n (default=1).
Outputs the values for
and
Useful if you need to restore the settings.

Configuring Tasmota

In my setup I have two blinds. For that reason I need to assign relais-1 ... relais-4 to any open GPIO. In my setup I'm using D0, D2, D3, D4. (Please notice: I'm using a CC1101 ... so D5, D6, D7, D8, D1 are occupied!)

In the end things look like this:

Tasmota Configuration

Then we need to enable Shutter support: SetOption80 1

Now tell Tasmota, that we have two shutters: ShutterRelay1 1 ShutterRelay2 3 This means that shutter 1 is controlled by relais 1 (and 2) - and shutter 2 is controlled by relais 3 (and 4)

We need to configure the buttons Backlog ShutterButton1 1 up 0; ShutterButton1 2 down 0; ShutterButton2 3 up 0; ShutterButton2 4 down 0

Finally we need to tell Tasmota how long it takes to close / open a Shutter: ShutterCloseDuration1 23 ShutterCloseDuration2 23 ShutterOpenDuration1 23 ShutterOpenDuration2 23

Using rules to control blinds

How to enable the general blind support is pretty good explained at "Blinds and Shutters". To have the blinds use your "virtual" Somfy RTS remote, you need to use rules like this:

Rule1
ON ShutterPosition1#Data DO if (%value%==100) Var2 1 endif ENDON
ON ShutterPosition1#Data DO if (%value%==0) Var2 -1 endif ENDON
ON Shutter1#Position DO Var3 %value% ENDON
ON Power1#state==1 DO SomfyUp1  ENDON
ON Power2#state==1 DO SomfyDown1  ENDON
ON Power1#state==0 DO if ((Var2==0) or ((Var3>5) and (Var3<95))) SomfyStop1 endif  ENDON
ON Power2#state==0 DO if ((Var2==0) or ((Var3>5) and (Var3<95))) SomfyStop1 endif  ENDON
ON Power1#state==0 DO Var2 0  ENDON
ON Power2#state==0 DO Var2 0  ENDON

Rule2
ON ShutterPosition2#Data DO if (%value%==100) Var4 1 endif ENDON
ON ShutterPosition2#Data DO if (%value%==0) Var4 -1 endif ENDON
ON Shutter2#Position DO Var5 %value% ENDON
ON Power3#state==1 DO SomfyUp2  ENDON
ON Power4#state==1 DO SomfyDown2  ENDON
ON Power3#state==0 DO if ((Var4==0) or ((Var5>5) and (Var5<95))) SomfyStop2 endif  ENDON
ON Power4#state==0 DO if ((Var4==0) or ((Var5>5) and (Var5<95))) SomfyStop2 endif  ENDON
ON Power3#state==0 DO Var4 0  ENDON
ON Power4#state==0 DO Var4 0  ENDON

The main problem is that Tasmota tries to control the movement of the blinds on its own. So if you lift /lower the blind the hole way up / down, Tasmota will wait for a certain amount of time and then send a "stop" command. If at this point in time the blind has already stopped, this "stop" will actually cause a "go-my" function, not a "stop".

So the above rules try to distinguish between a complete movement, where no "stop" is needed and movements where a "stop" needs to be executed.

The alternative would be to tune the timings that exact that a "stop" is needed in every case - but that sounded to much work to me.

⚠️ **GitHub.com Fallback** ⚠️