I ordered a sun awning with a tubular motor expecting it to have a four core flex attached (open, close, earth, neutral). When it arrived it had a motor fitted with integrated 433mhz receiver and only a three core flex attached.
That blew my plans of using a Sonoff duo to control it out of the water.
Instead it led me down the rabbit hole of RF.
I searched for reasonable priced RF bridges and the sonoff one seemed great at only £8.
The trouble is most people seem to have had to chop it to bits and patch wires and resistors all over to get it to do what they want. I didn’t like the idea of that.
Here’s what I did to get it working with a Dooya motor.
Flashing the bridge:
The bridge contains two main chips with seperate firmware. An esp8266 and also an RF specific chip.
I wanted to use esphome as I use this elsewhere and wanted to make use of the time based cover component.
The problem is the RF chip is locked down to sonoff signals so it needs to be flashed also. I couldn’t find a way to do this through esphome but tasmota provided a simple solution.
I opened up the bridge by removing the four screws underneath. Gentle bending up the large led panel, gives you access to an RF switch and the headers.
I turned off the RF switch and connected my usb serial interface to the headers closest to the LEDs legs. Holding the only button I plugged in the usb interface and provided power to the bridge.
Using espflasher I uploaded tasmota.bin to the bridge.
The bridge then set up a hotspot, which I connected to on my phone and configured my WiFi details.
Scanning for devices on my network I was able to find the op used by the bridge and load it in my browser.
I then configured the bridge as a Sonoff RF Bridge (25). It reboots.
Flashing the RF chip:
Tasmota makes it easy to flash the RF chip, however this can’t be done if you are using the usb socket to power it during the flash, instead you need to keep the 3v3 and gnd wires from the serial interface connected for powering the bridge during this next step.
Also it’s necessary to put two bridge wires in place (I didn’t solder just wedges them in place) gpio4 to c2d and gpio5 to c2ck. This allows the firmware to be sent from the esp to the RF chip
The RF firmware can be found here: https://github.com/arendst/Tasmota/tree/master/tools/fw_SonoffRfBridge_efm8bb1
With the bridge wires in place, go to the tasmota web interface and click firmware update, upload the RF firmware and click update. A few seconds and it’s done.
Now all the temporary wires can be removed and the RF switched can be turned back on. The bridge can be reassembled and powered by usb.
Now in the tasmota interface load the console.
Type rfraw 177, press enter
Press the open button on the RF remote 4 or 5 times.
The raw RF data will be shown on the console.
Copy and paste this into notepad.
Repeat for the other buttons.
An online tool called bitbucket convertor is used to convert this data into codes you can send to control the motor. Follow their instructions for this bit.
Now you can replace tasmota with ESPHome using the firmware update system we used earlier.
Here’s my esphome config.
esphome:
name: rfbridge
platform: ESP8266
board: esp01_1m
wifi:
ssid: "myssid"
password: "my password"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rfbridge Fallback Hotspot"
password: "another password"
captive_portal:
ota:
password: "and another"
api:
password: "and another"
#this is important as the RF chip talks to esp on these pins at this baud rate
uart:
tx_pin: 1
rx_pin: 3
baud_rate: 19200
#need to disable uart logging as it will interfere
logger:
baud_rate: 0
#this allows ha to when RF signals are received, I'm not using this for anything yet.
rf_bridge:
on_code_received:
then:
- homeassistant.event:
event: esphome.rf_code_received
data:
sync: !lambda 'char buffer [10];return itoa(data.sync,buffer,16);'
low: !lambda 'char buffer [10];return itoa(data.low,buffer,16);'
high: !lambda 'char buffer [10];return itoa(data.high,buffer,16);'
code: !lambda 'char buffer [10];return itoa(data.code,buffer,16);'
# the interesting bit, controlling the awning motor
cover:
- platform: time_based
name: "Sun Awning"
device_class: awning
assumed_state: true
has_built_in_endstop: true
open_action:
- rf_bridge.send_raw:
raw: "output from bitbucket converter with spaces removed"
open_duration: 60s
close_action:
- rf_bridge.send_raw:
raw: "output from bitbucket converter with spaces removed"
close_duration: 60s
stop_action:
- rf_bridge.send_raw:
raw: "output from bitbucket converter with spaces removed"
Compile and upload and all working perfectly. A cover is available for control in ha.
This took me a few hours because.i.was having to put together pieces of instructions from about 6 different sites. I hope this helps someone else.