Skip to content

feat: Add support for Somfy RTS commands#8

Merged
balloob merged 2 commits into
home-assistant-libs:mainfrom
L-Henke:feat/add-somfy-rts
May 11, 2026
Merged

feat: Add support for Somfy RTS commands#8
balloob merged 2 commits into
home-assistant-libs:mainfrom
L-Henke:feat/add-somfy-rts

Conversation

@L-Henke
Copy link
Copy Markdown
Contributor

@L-Henke L-Henke commented May 6, 2026

This PR adds support for Somfy RTS roller blinds. The protocol was reversed by those awesome guys over there: https://pushstack.wordpress.com/somfy-rts-protocol/

For transparency: Claude Code was used transfer an existing c++ implementation for ESPHome of the protocol that I created with the help of the reversed protocol a while back.

The Somfy RTS system is using a rolling code and thus cannot be loaded from a .sub file. This implementation is thus instantiating the SomfyRTSCommand on every send action.

I have an integration ready for Home Assistant core that is able to use this library to successfully control my roller blinds via the new ESPHome radio_frequency component. I'll open a PR there soon.

@Misiu
Copy link
Copy Markdown

Misiu commented May 7, 2026

In theory, this should also support garage gates, for example, Somfy GDK 700 (https://www.instrukcjaobslugipdf.pl/somfy/gdk-700/instrukcja?p=4), as it uses the same protocol.
However, the remote uses a single toggle button behavior.
Each button press advances the door state in sequence:
open → stop → close → stop → open ...
The controller does not send separate open/close commands.
Instead, every press triggers the next action depending on the current door state.

@L-Henke
Copy link
Copy Markdown
Contributor Author

L-Henke commented May 7, 2026

In theory, this should also support garage gates, for example, Somfy GDK 700 (https://www.instrukcjaobslugipdf.pl/somfy/gdk-700/instrukcja?p=4), as it uses the same protocol. However, the remote uses a single toggle button behavior. Each button press advances the door state in sequence: open → stop → close → stop → open ... The controller does not send separate open/close commands. Instead, every press triggers the next action depending on the current door state.

Based on the manual, you could also use a remote with up, down and stop buttons, which looks like the exact same remote that is working for the roller blinds. I would guess that this would then also directly work with that garage door. Based on the reversed protocol, the keys are just a single hex digit that are send by the remote, so probably the single button remote would also be using one of those values. The only question is which one is set to that single button.

image https://pushstack.wordpress.com/somfy-rts-protocol/

@Misiu
Copy link
Copy Markdown

Misiu commented May 7, 2026

I think I need to order CC1101 and give this a try. If I could have a dedicated up/down/stop button, then I could finally control the direction from HA.
Is there a way to sniff the command that is sent to the receiver?

When it comes to pairing the remote with the opener, you need to put the opener in the programming mode, and then you press a button on the remote. This way, you could use a single remote with two openers (assuming you have two buttons on a remote). Basically, what you do is you assign a specific button on a remote with the gate opener.

@L-Henke
Copy link
Copy Markdown
Contributor Author

L-Henke commented May 7, 2026

If you want to try that out, you must not wait until this is merged. Here you can find my fully working implementation in ESPHome that I'm using for years in different variations. I recently changed it to use the newly added CC1101 support in ESPHome.

The original blog post made a lot of effort to sniff the signals with an SDR. As I didn't had one, I was struggling a lot with the initial implementation as I had no way to verify if I send the correct timings.

Since there cannot be that many button presses, you could simply insert them here and have a look if your garage door would react the way you want. But based on page 21 of that manual, you should be able to just pair the remote with the prog button like for a cover and could then enjoy full up/down/stop control.

Another advantage of the ESPHome implementation is, that they support time based covers, which estimate the exact position of a cover based on the runtime for a full open/close cycle. You just measure the open and close time of your cover and HA will then show how much the cover is currently opened.

As every remote in Somfy RTS has a unique ID, you must set a random 6-digit hex value like 0x1234FF for your remote to be able to pair it here.

@Misiu
Copy link
Copy Markdown

Misiu commented May 7, 2026

For now, I use Shelly Uni with two magnetic door sensors, so I know when the gate is fully opened or closed. I also ordered parts for a potentiometer circuit to use an analog input of Uni and calculate the position from that, but I would prefer to have open, stop and close as dedicated functions. I'm going to order CC1101 and test the code you provided.

@Misiu
Copy link
Copy Markdown

Misiu commented May 10, 2026

While waiting for the module I contacted somfy, asking for a compatible remote with up and down functionality.
They responded with two links:
https://sklep.somfy.pl/smoove-sensitive-1-rts-pure-diy-1.html
https://sklep.somfy.pl/1-rts-pure-pilot-situo.html
So I think it's possible.

Comment thread rf_protocols/__init__.py Outdated
from .commands import ModulationType, OOKCommand, RadioFrequencyCommand
from .loader import CodeCollection, get_codes
from .parser import parse_sub_content
from .somfy_rts import SomfyRTSButton, SomfyRTSCommand
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not put this in the main import. We should probably move commands out too. Those are gong to cause all files to be loaded while an integration might just use 1 code with 1 command.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just refactored the package to better fit this. See #12

Comment thread rf_protocols/commands/somfy_rts.py
Comment thread rf_protocols/somfy_rts.py Outdated
the output strictly alternates between positive (mark) and negative
(space) microseconds.
"""
button_codes = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CAn't we make the value of SomfyRTSButton.MY already be 0x1 ?

Copy link
Copy Markdown
Contributor

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase and address comments.

@balloob balloob force-pushed the feat/add-somfy-rts branch from 30fde94 to 64cfcaa Compare May 11, 2026 02:48
Mirrors the codes-folder pattern from infrared-protocols: button enums
live alongside other device codes and expose `to_command()` to build
the protocol command. SomfyRTSCommand now takes `button: int`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@balloob balloob merged commit a8a561b into home-assistant-libs:main May 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants