|Since||Origin / Contributor||Maintainer||Source|
This module provides a simple interface to control Somfy blinds via an RF transmitter (433.42 MHz). It is based on Nickduino Somfy Remote Arduino skecth. It also allows listening to commands transmitted by the Somfy remote control.
The hardware used is the standard 433 MHz RF transmitter. Unfortunately these chips are usually transmitting at he frequency of 433.92MHz so the crystal resonator should be replaced with the resonator on this frequency though some reporting that it is working even with the original crystal.
The module is using hardware timer so it cannot be used at the same time with other NodeMCU modules using the hardware timer, i.e.
Builds an frame defined by Somfy protocol and sends it to the RF transmitter.
somfy.sendcommand(pin, remote_address, command, rolling_code, repeat_count, callback)
pinGPIO pin the RF transmitter is connected to.
remote_addressaddress of the remote control. The device to be controlled is programmed with the addresses of the remote controls it should listen to.
commandcommand to be transmitted. Can be one of
rolling_codeThe rolling code is increased every time a button is pressed. The receiver only accepts command if the rolling code is above the last received code and is not to far ahead of the last received code. This window is in the order of a 100 big. The rolling code needs to be stored in the EEPROM (i.e. filesystem) to survive the ESP8266 reset.
repeat_counthow many times the command is repeated
callbacka function to be called after the command is transmitted. Allows chaining commands to set the blinds to a defined position.
My original remote is TELIS 4 MODULIS RTS. This remote is working with the additional info - additional 56 bits that follow data (shortening the Inter-frame gap). It seems that the scrambling algorithm has not been revealed yet.
When I send the
somfy.DOWN command, repeating the frame twice (which seems to be the standard for a short button press), i.e.
repeat_count equal to 2, the blinds go only 1 step down. This corresponds to the movement of the wheel on the original remote. The down button on the original remote sends also
somfy.DOWN command but the additional info is different and this makes the blinds go full down. Fortunately it seems that repeating the frame 16 times makes the blinds go fully down.
To start with controlling your Somfy blinds you need to:
- Choose an arbitrary remote address (different from your existing remote) -
123in this example
- Choose a starting point for the rolling code. Any unsigned int works, 1 is a good start
- Long-press the program button of your existing remote control until your blind goes up and down slightly
somfy.sendcommand(4, 123, somfy.PROG, 1, 2)- the blinds will react and your ESP8266 remote control is now registered
somfy.sendcommand(4, 123, somfy.DOWN, 2, 16)- fully closes the blinds
For more elaborated example please refer to
Using RF receiver listens to Somfy commands and triggers a callback when command is identified.
pinGPIO pin the RF receiver is connected to.
callback(address, command, rc, frame)a function called when a Somfy command is identified. Use
nilto stop listening.
addressof the remote controller sending the command
commandsent by the remote controller. A number between 0 and 0xf. Can be
frameString of 10 characters with the full captured data frame.
somfy.listen(4, function(address, command, rc, frame) print(("Address:\t0x%x\nCommand:\t0x%x\nRolling code:\t%d"):format(address, command, rc)) print(("Frame:\t"..("%02x "):rep(#frame)):format(frame:byte(1, -1))) end)
somfy.listen(4, nil) to unhook the GPIO and free the callback.