Dooya DT82tv Curtain Motors with Sonoff RF Bridge

I just updated this topic Smart Curtain Motors (Broadlink RM Pro, Dooya) but thought it might be worth its own post. with what I ended up getting.

I picked up some Dooya DT82TV with 3 Meters of Rail (£107.97) and a pair of 135 degree joints (£24.15) to fit my bay windows.

I got them from a seller called "Friend Industry Holding Co., Ltd" on Ali Express. They were in a sale after Christmas and in total the whole setup cost me £141 on the complete package with RF Bridge (it would have been £110 without the extra 135 degree joints). A fraction of the cost of other systems. The seller was very good, and we had several email conversations about the exact dimensions I need, he was very keen to get it exactly right. When they in arrived in 8 Days! (fast for the slow boat from china to the UK). They were pre-cut to length. you just have to work out how the hell to put them together without any instructions. I ended up watching this youtube video through a lot and doing lots of pausing / rewinding. The hard bits had been done for you but he supplier.

I got the DT82tv motors because firstly they were cheap (in my experiences so far defiantly not an inferior product, cant fault them). Secondly they had 4 wire control and RF control. I had my doubts about how well RF would work with Home Assistant. I didn’t like the idea of the curtains missing RF Signals and that maybe I couldn’t get the RF Signals to be sent properly from home assistant. This turned out to be unfounded and RF is working perfectly every time. It also has the option of 4 wire control, so you have Live, Natural, Up, Down & Ground (technically 5 wires). So if the RF wasn’t reliable I could revert back to a wired Z-wave Controller, I was thinking of using a Fibaro Roller Shutter 2 but they are £50 just for the controller, which bumps the price quite a lot. So I thought I will try the RF route first. I may still go this route when I re-plaster the living room and run the wires in properly which I am doing in a few months.

I had heard about the Broadlink RM Pro (£30 ish) and heard good things about it. Again budget is a definite element and I had heard about the Sonoff RF bridge (£8.88) flashed with Tasmota is a third of the cost.

I have a lot of Tasmota devices running and it is worth a bash. It took patience and soldering to get working but once I got my head round it all it works great. I wanted to document it to help other people not have the same painful journey I had. This next section my be quite loooong. I would have been a lot easier just to pay the £48 and get a Z-wave controller. But I am pig headed and only spent a fraction of other systems.

Getting the RF Bridge Working

I tried to follow the Dr ZZZ youtube video on flashing the RF Bridge. It is exactly the same to flashing a Sonoff Basic with Tasmota as I am sure many of you have done (if you follow the first part of the Dr ZZZ video he walks you through it. You just have to setup what type of sonoff it is in the web GUI (configuration > Configure Module > Sonoff Bridge (25) and the MQTT Setting like normal. Where I stopped following DR ZZZ’s video was the part where he received a string of data in the console. I wasn’t receiving any signal when I was pressing the RF Remote control I got with the Curtain Motors (Dooya DC2700). So I had to upgrade the RF Chips firmware on Sonoff RF Bridge with Portisch Firmware. This is different to flashing Tasmota onto the device, it is a different chip on the board. but very simple to do. It is all documented on the Tasmota Wiki Page for the RF Bridge.

I soldered two wires onto the rear of the board and scratched off a couple of tracks (Apparently here are other ways to do it without soldering, but I am comfortable doing it so went that way).

Then in the Tasmota GUI go to firmware upgrade and upload the latest version of the hex file found in Portisch Firmware that is on the Tasmota Github page. Then after it uploads and restarts you can go to the console and type the command "rfraw 177". Now when pressing the RF Remote button in the console you get some B0 codes.

Press each button on the remote a few times then copy the section of the sonoff console and save into a txt file.

13:57:08 CMD: rfraw
13:57:08 MQT: stat/sonoff-RF-Bridge/RESULT = {"RfRaw":"OFF"}
13:57:18 CMD: rfraw 177
13:57:18 MQT: stat/sonoff-RF-Bridge/RESULT = {"RfRaw":"ON"}
13:57:18 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AAA055"}}
13:58:42 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 12FC 05D2 02DA 0172 1EBE 0123322332233223233223232332233223233232323223233232323232322332233232232332322324 55"}}
13:58:42 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1306 05D2 02E4 015E 1E8C 0123322332233223233223232332233223233232323223233232323232322332233232232332322324 55"}}
13:58:43 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1306 05C8 02EE 015E 1E96 0123322332233223233223232332233223233232323223233232323232322332233232232332322324 55"}}
13:58:43 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1306 05C8 02E4 015E 1E96 0123322332233223233223232332233223233232323223233232323232322332233232232332322324 55"}}
13:58:43 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1310 05BE 02EE 0154 1FFE 0123322332233223233223232332233223233232323223233232323232322332233232232323233234 55"}}
13:58:47 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 12FC 05E6 02D0 0172 1ED2 0123322332233223233223232332233223233232323223233232323232322332233232322332323224 55"}}
13:58:48 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1306 05C8 02E4 015E 1E96 0123322332233223233223232332233223233232323223233232323232322332233232322332323224 55"}}
13:58:48 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1306 05C8 02E4 015E 1E78 0123322332233223233223232332233223233232323223233232323232322332233232322332323224 55"}}
13:58:48 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1306 05C8 02E4 015E 1E8C 0123322332233223233223232332233223233232323223233232323232322332233232322332323224 55"}}
13:58:48 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1306 05C8 02E4 015E 1E82 0123322332233223233223232332233223233232323223233232323232322332233232322323232334 55"}}
13:58:48 MQT: tele/sonoff-RF-Bridge/RESULT = {"RfRaw":{"Data":"AA B1 05 1310 05C8 02E4 015E 1FF4 0123322332233223233223232332233223233232323223233232323232322332233232322323232334 55"}}

Unfortunately these are B1 codes and to send signals you need B0 codes. So you need to convert them using a program called BitBucket Converter I have to admit this is where I lost hours of my life trying to get this script to run (all due to my inexperience with python, not the quality of the script)

To convert the codes I had to install (on windows 10 laptop)

to be able to run a script called BitBucketConverter. There were lots of slightly different versions out there but this one was the only one I got to work. The link takes you to a script you download and change the extension to *.py. Then in Windows CMD and run …

C:\Python34>BitBucketConverter.py -f sonoffconsole.txt -e 192.168.0.46

This is telling python to run the script "BitBucketConverter.py" using the File (-f) with the console text in it (open.txt) then run it on a device (-e) with the ip address of the RF bridge.

the script will then transmit the B0 commands. If they work, you can copy them and use them as follows in home assistant. You can test them by typing into the Tazmota console "RfRaw" then the B0 code you just converted.

Below are the B0 command I converted (hopefully they just might work for anyone with a Dooya DC2700 remote control like mine

  • Open Curtains: RfRaw AA B0 35 05 04 12F2 05FA 02B2 0140 1EA0 2401233223322332232332232323322332232332323232232332323232323223322332323223323232 55

  • Close Curtains: RfRaw AA B0 35 05 04 1306 05D2 02DA 0168 1E96 2401233223322332232332232323322332232332323232232332323232323223322332322323323223 55

  • Stop Curtains: RfRaw AA B0 35 05 04 1310 05C8 02E4 015E 1E96 0123322332233223233223232332233223233232323223233232323232322332233223322332233224 55

Home Assistant Configuration

That is the hard bit is done. Now you just have to add in the following lines into the Home assistant Configuration.yaml file.

cover:
  - platform: mqtt
    name: "Living Room Curtains"
    command_topic: "cmnd/sonoff-RF-Bridge/backlog"
    payload_open: "rfraw AA B0 35 05 04 12F2 05FA 02B2 0140 1EA0 2401233223322332232332232323322332232332323232232332323232323223322332323223323232 55;rfraw 177"
    payload_close: "rfraw AA B0 35 05 04 1306 05D2 02DA 0168 1E96 2401233223322332232332232323322332232332323232232332323232323223322332322323323223 55;rfraw 177"
    payload_stop: "rfraw AA B0 35 05 04 1310 05C8 02E4 015E 1E96 0123322332233223233223232332233223233232323223233232323232322332233223322332233224 55;rfraw 177"
    set_position_template: "50"
    set_position_topic: "cmnd/sonoff-RF-Bridge/backlog"
    position_topic: "cmnd/sonoff-RF-Bridge/backlog"

(EDIT 6/6/21 add new parts of the config to fix changes to the mqtt cover that were changed in HA v2021.6)

Then you get a nice control in Home assistant UI

Capture

I have setup automatons to open them at 8am in the morning and close them when it gets dark. Which I did by Sun elevation but would be better if you had an outdoor Luminance Sensor.

- id: '1548292477978'
  alias: Living Room - Curtains - Close at sunset
  trigger:
  - below: '-2.5'
    entity_id: sun.sun
    platform: numeric_state
    value_template: '{{ state.attributes.elevation }}'
  condition: []
  action:
  - data:
      entity_id: cover.living_room_curtains
    service: cover.close_cover
  - data:
      entity_id: light.living_room_lamp
    service: light.turn_on
  - data:
      entity_id: light.fireplace
    service: light.turn_on
- id: '1548411184246'
  alias: Living Room -  Curtains - Open in the morning
  trigger:
  - at: 08:00
    platform: time
  condition: []
  action:
  - data:
      entity_id: cover.living_room_curtains
    service: cover.open_cover

So far I have been running them for a month and they haven’t missed a beat. Every morning they open and every morning they shut. No more climbing over the back of the sofa to shut them and when we are on holiday they curtains will make it look like we are home. Great Stuff!

2 Likes

This is awesome. I have been researching doing an automated curtain setup in my house for a few weeks or so and I bought the same set you are using based o your review. I just got the curtain track and motor yesterday and quickly wired it up to see if I could get it working and: voila, I can spin the motor using the sonoff-bridge via home assistant!!

I haven’t actually hung the motor on the track yet but it seems to run forever when it’s disconnected and I hit the up or down on the remote. How do you “train” it to open fully and stop or close full and stop?

I previously bought a bunch of 433MHz door/window, moisture and motion sensors and I’m using the same sonoff-bridge to receive those signals but I noticed yesterday when I tried to trigger one of the door sensors the sonoff-bridge wouldn’t detect it until I went into the console and sent a rfraw off command.

I changed your ;rfraw 177 at the end of your payload_***** messages to ;rfraw off command and it seems to work now!

Thank you so much for posting such a detailed article!
-Greg

Glad to here it Greg. I have got so much help from the community it is nice to give something back.

As for the curtain motor endlessly turning. I think that when you set them up they self calibrate when you first set them up on the rail. They learn the length of the rail so they can slow down just as the two curtains meet.

Out of interest. Did the same effect codes work for you? Or did you have to learn the codes?

I went through the BitBucketConverter.py thing just like you did. It sounds like I may be a bit more familiar with Python than you are (I use it at work day in and out), so it wasn’t too heavy a lift to get it done. Here are the codes I ended up with:

cover:
  - platform: mqtt
    name: "Master Bedroom Curtains"
    command_topic: "cmnd/sonoff-bridge/backlog"
    payload_open: "rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2B2A3B2B2B2 55;rfraw off"
    payload_close: "rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EF0 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2A3A3B2B2A3 55;rfraw off"
    payload_stop: "rfraw AA B0 35 05 04 12FC 05DC 02C6 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2A3B2A3B2A3B2 55;rfraw off"
    set_position_template: "50"

They are similar up to a point. I didn’t actually try dropping your codes in my config file to see if they’d work. I would hope that each device they create has some unique address that keeps it from conflicting with other devices on the 433MHz bandwidth. I know that the moisture, door/window, and motion sensors I have are set up that way.

Any idea what that set_position_template: "50" does? I read through the mqtt cover component and still don’t really understand it.

Because there is no position feedback from the curtains this setting sets the position to the middle. If you don’t have it, when home assistant thinks that the windows are already open it Gray’s out the open button. You could have closed them with the remote or manually closed the curtain. So it would be out of sync and you couldn’t open them again

Thanks for the informative information, setting up python alone seemed to be the hardest part.

Did you happen to play around trying to store the raw B0 data on the Rfbridge for the use as a sensor by any chance? Hoping to intergrate a 443 remote to my home setup.

I am using my dooya with a broadlink rm pro. but it is only a transmitter, so if i use the dooya remote i won’t have feedback to home assistant. With sonoff rf bridge does it give feedback to home assistant? So if i open with manual remote the open button will be greyed out? Thank you

I have the same setup and actually worder about this as well. How to achieve this as sending and receiving are different codes.

I believe so, although I do not use it because it would easily get out of sync and there is no way of resynchronization apart from opening / closing the curtain.

When learning the codes you put the sonoff into read mode with rfraw 177. I believe that when it receives a RF signal it will send it out received B1 code over MQTT. I am currently renovating the room with the curtain so I don’t have it setup so can’t test it for you

I managed to get this done but I had to configure things slightly different. I use the stop position of the motors which means I had to use a template instead of MQTT cover because for the stop position you need to send the stop command 4 times (I use the cover motors not curtains motors but I assume it’s the same). As far as I know this is only possible using a script. I put the RF bridge in 166 mode to continuously listen to commands send by the wireless remote and input booleans to keep track of the status after a reboot.

I tried many different scenarios and it seems to work flawlessly. I can use the remote, HA front-end, automations, etc to control the blinds and HA always shows the actual position.

Hey i have been trying to get the B0 but every time the B1 code is different. here is a sample of the RfRaw Data that i got from the Sonoff RF Bridge.

00:13:29 CMD: rfraw 177
00:13:29 MQT: stat/ESPChip/RESULT = {"RfRaw":"ON"}
00:13:29 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AAA055"}}
00:13:41 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A1E 12FC 04E2 0262 7E04 48080808080808092A3B2A2A2A2B3A3B2B3A3B2B3A2B3A3B3B3B2B3A3B3B2A3B2A3B3B3B2A3B2B3B3A2B3A3B3B2A3B3B2B 55"}}
00:13:58 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 04 04EC 026C 0A14 134C B0819080808091819190819091808191909191809181909191919191819091918190918091819091819A2A2A2A2A2A2A 55"}}
00:14:04 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 04 0546 02D0 0A14 1338 B0819080808091809191819091819081909191809181909191919191819091918190918091819091819A2A2A2A2A2A2A 55"}}
00:14:09 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 04 0500 028A 0A0A 134C B0819080808091809180809181909191919191809181909191919191819091918190918091819091819A2A2A2A2A2A2A 55"}}
00:14:10 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 06 04E2 026C 0B90 00AA 010E 1338 D0819080808091808081909181919191909191809182BCC1C0C19191819091918190918091819091819A2A2A2A2A2A2A 55"}}
00:14:14 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 04EC 026C 017C 0A0A 134C C081908080809180819191909181A190809191809181909191919191819091918190918091819091819B3B3B3B3B3B3B 55"}}
00:14:28 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A0A 12F2 04EC 0276 7E0E 48080808080808092A3B2A2A2A2B3A3B2A3B3B2B3A2B3B3A2B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:30 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A0A 12F2 04EC 026C 7E04 48080808080808092A3B2A2A2A2B3A3B3B2B3A2B3A2A3B2B3B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:33 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 03 0532 02A8 053C A80918 55"}}
00:14:33 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A0A 12FC 04EC 026C 7E04 48080808080808092A3B2A2A2A2B3A3B3B3B2A2B3A2A2B3B3B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:35 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 03 0212 049C 06A4 280808091809 55"}}
00:14:35 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A1E 12FC 04E2 026C 7E22 48080808080808092A3B2A2A2A2B3A3B3B3B3B3B2B3A2A2A2B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:37 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A0A 12F2 04EC 026C 7E0E 48080808080808092A3B2A2A2A2B3A2B3B3B3A2B3A3B2A2B3B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:41 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A14 12FC 04E2 0262 7E04 48080808080808092A3B2A2A2A2B3A2B3A3B3B2B3A3B2B3A2B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:42 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A14 1306 04EC 026C 7E04 48080808080808092A3B2A2A2A2B3A2A2B3A2B3A3B3B3B2B3B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:43 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A0A 12F2 04EC 026C 7E04 48080808080808092A3B2A2A2A2B3A2A2A3B2B3A3B3B3B3B2B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:45 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A1E 12FC 04E2 0262 7E22 48080808080808092A3B2A2A2A2B3A2A3B2A2B3A3B3B2B3B3B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:46 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 03 021C 04B0 06AE 280808091809 55"}}
00:14:47 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 05 0A1E 1306 04E2 026C 7E22 48080808080808092A3B2A2A2A2B3A2A3B3B3B2B3A3B3B2A2B3B3B3B3B3A2B3B3B3A2B3A2B3B3B3B3A2B3B3B3B3A2B3B3A2B 55"}}
00:14:48 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 03 0212 049C 0672 280809 55"}}
00:14:50 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 04 04EC 0280 0A0A 1342 B08190808080918190808091809191919191819091918091809191918091819190819091918091918A2A2A2A2A2A2A 55"}}
00:15:01 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 03 0212 0492 05B4 280809 55"}}
00:15:03 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 04 0532 02BC 0A14 140A B08190808080918190919180918091809191819091918091809191918091819190819091918091918A2A2A2A2A2A2A 55"}}
00:15:10 MQT: tele/ESPChip/RESULT = {"RfRaw":{"Data":"AA B1 03 0208 049C 0596 280809 55"}}

Convert to B0 and try them out, then you’d know which one works.

@c_wolsey or @sjee

Have these curtain motors provided reliable in operation?

I am looking at replacing my standalone motor as the gears are stripping. It was only about £40 of ebay.

The living room died pretty soon as my window is 3.6M wide and the bedroom one is pretty much shot.

Does anyone happen to know how to convert these to the broadlink rm pro packet format? Or have them? … as I’m struggling with getting the codes from either broadlink.learn or the e-control dump method.

  • Open Curtains: RfRaw AA B0 35 05 04 12F2 05FA 02B2 0140 1EA0 2401233223322332232332232323322332232332323232232332323232323223322332323223323232 55
  • Close Curtains: RfRaw AA B0 35 05 04 1306 05D2 02DA 0168 1E96 2401233223322332232332232323322332232332323232232332323232323223322332322323323223 55
  • Stop Curtains: RfRaw AA B0 35 05 04 1310 05C8 02E4 015E 1E96 0123322332233223233223232332233223233232323223233232323232322332233223322332233224 55

HI Amazing description it saved me a lot of work when i was about to drop the issue.

thanks to your explanation i manged to install python etc etc on windows and i managed to make work few code however they only worked once.

this is the remote model

RE1011

This are BO that worked ONCE

light on:

rfraw AA B0 57 05 08 01C2 0136 0ECE 02D0 5CEE 4818181818181818080808080808080808080808080808283B08083B08380B08083B0808083B083B0838080B3808080808080B3808080808080B0838080B0808080808380B3B08083B0838 55;rfraw off

rfraw AA B0 54 05 08 01C2 0136 0EC4 02EE 5CE4 48181818181818180808080808080808080808080808082808380808080B3B380808080B083B3808080B3B083B3B380B083B3B380B0838080B3B380808080B080808380808080B38 55;rfraw off

close:

rfraw AA B0 55 05 08 01C2 012C 0ECE 02EE 5E60 4818181818080808080808080808080808080808080808280808080808083B08080808080838080B080808083B083B3B3B08083B3B3B08083B08083B380B3B3B08080808080808083B 55;rfraw off
rfraw AA B0 53 05 08 01D6 0118 0EC4 02EE 5CDA 481818181818181818181818181818080808080808180828183B080808380B3B0808083B380B080808380B08083B3B3B08083B3B3B080808083B083B380B08380B3B0808083808 55;rfraw off
rfraw AA B0 51 05 08 01C2 012C 0ECE 02EE 5CBC 481818181818180808080808080808080808080808080828083B08380B3B3B08380B08380B08380B3B0808380B380B0808380B380B0808083B3B3B380B08083B3B08380B38 55;rfraw off

Does anyone knows why ?

This has been probably the most helpful thread for me so far, once I got the Sonoff flashed anyhow. I’m trying to do the same thing, but for some reason when I try to send commands from HA, the Sonoff isn’t getting them, and I think it has to do with it not being subscribed to the MQTT channel. And I am having trouble figuring out how. When I click on the “down” command from the badge in HA, I can see that the broker is getting the message, using MQTT.fx. Here also is my HA configuration.yaml portion for this entity as well as my mqtt broker settings. Any guidance on how to make this last hurdle would be greatly appreciated.
If it matters, I’m running HA in docker on Ubuntu 18.04, but the MQTT broker(Mosquitto) is not dockerized, but is on the same device (same IP, that’s why the loopback address for broker IP)

Broker settings:

mqtt:
  broker: 127.0.0.1
  discovery: true
  discovery_prefix: RF_Bridge
  username: xxxx
  password: xxxx

Entity:

cover:
  - platform: mqtt
    name: "LR Blinds"
    command_topic: "cmnd/sonoffRFBridge/Backlog"
    payload_open: "rfraw AA B0 36 05 08 09A6 0668 0140 028A 15EA C092A3A3A3A3A3A3B2B2B2B2A3B2B2B2A3B2B2A3A3A3B2A3A3A3B2A3A3A3A3A3A3A3A3A3B2A3B2B2B2A3 55; rfraw off"
    payload_stop: "rfraw AA B0 36 05 08 09A6 0668 014A 028A 15EA C092A3A3A3A3A3A3B2B2B2B2A3B2B2B2A3B2B2A3A3A3B2A3B2A3B2A3A3A3A3A3A3A3A3A3B2A3B2B2A3A3 55; rfraw off"
    payload_close: "rfraw AA B0 36 05 08 09A6 065E 014A 028A 15EA C092A3A3A3A3A3A3B2B2B2B2A3B2B2B2A3B2B2A3A3A3A3A3B2B2B2A3A3A3A3A3A3A3A3A3B2A3A3A3B2B2 55; rfraw off"

mqtt-fx

EDIT:
I was able to get it working…by simply wiping the config of the Sonoff RF Bridge and putting back in the settings one at a time. Either something got corrupted or maybe I put in some setting that was screwing things up that I just didn’t see. Anyhow, this is a great thread for figuring out how to send commands to devices that don’t have “built in” rf codes and that have to be learned, converted, etc.
I do have another problem that isn’t related now…seems that HA Cloud is somehow relaying to Alexa that this device is a “door” and not a “cover”, so I am only getting a toggle option to control in creating a voice controlled routine. Gonna see if I can get some assistance from NabuCase on that one.

Anyone who is using this solution, I have a quick update. I was unable to use the position_template thing that c_wolsey was using to determine position/state and earlier I was looking for a way to retain the states of my door/window sensors when I found this thread.

The thread shows you how to set up automations for simple sensors that don’t have MQTT/Sonoff stored position data. That way, the automations can force retention of the sensor’s state by the MQTT broker. Anyway, I used that model to set up a way to store the state data for the curtain when I send a command from my remote or HA. This is what my automation looks like:

- id: publish_mqtt_from_master_bedroom_curtain_codes
  alias: Publish MQTT From Master Bedroom Curtain Codes
  trigger:
    - platform: mqtt
      topic: 'cmnd/sonoff-bridge/backlog'
  condition:
    - condition: template
      value_template: "{{ trigger.payload in ('rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2B2A3B2B2B2 55;rfraw off', 'rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EF0 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2A3A3B2B2A3 55;rfraw off', 'rfraw AA B0 35 05 04 12FC 05DC 02C6 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2A3B2A3B2A3B2 55;rfraw off') }}"
  action:
    - service: mqtt.publish
      data_template:
        topic: "433/Master_Bedroom_Curtain"
        payload: >-
          {%- if trigger.payload == 'rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2B2A3B2B2B2 55;rfraw off' -%}
            ON
          {%- else -%}
            OFF
          {%- endif -%}
        retain: True

Now I have a state_topic in MQTT called 433/Master_Bedroom_Curtain and if I add to my curtain cover the state_topic, state_open and state_closed like this:

  - platform: mqtt
    device_class: curtain
    name: "Master Bedroom Curtains"
    command_topic: "cmnd/sonoff-bridge/backlog"
    payload_open: "rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2B2A3B2B2B2 55;rfraw off"
    payload_close: "rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EF0 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2A3A3B2B2A3 55;rfraw off"
    payload_stop: "rfraw AA B0 35 05 04 12FC 05DC 02C6 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2A3B2A3B2A3B2 55;rfraw off"
    state_topic: "433/Master_Bedroom_Curtain"
    state_open: "ON"
    state_closed: "OFF"

It will set the state when I click a button. Click ‘open’ and the icon changes to opened, click ‘close’ and the icon changes to closed. Obviously, this isn’t ideal/perfect because there is a delay on the curtain to open/close but it works very well since we don’t have a native position value from the unit. You’ll notice that if I hit the ‘stop’ button it’ll act like the curtain is closed – not sure what to do with that… :slight_smile:

==EDIT==

So I’ve been messing with this thing a little more and I found that I can setup and if, elif, else integrating the stop button and taking advantage of the position_topic instead of the state_topic. It works even better!

configuration.yaml:

cover:
  - platform: mqtt
    device_class: curtain
    name: "Master Bedroom Curtains"
    command_topic: "cmnd/sonoff-bridge/backlog"
    payload_open: "rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2B2A3B2B2B2 55;rfraw off"
    payload_close: "rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EF0 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2A3A3B2B2A3 55;rfraw off"
    payload_stop: "rfraw AA B0 35 05 04 12FC 05DC 02C6 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2A3B2A3B2A3B2 55;rfraw off"
    position_topic: "433/Master_Bedroom_Curtain"

automation.yaml:

automation:
- id: publish_mqtt_from_master_bedroom_curtain_codes
  alias: Publish MQTT From Master Bedroom Curtain Codes
  trigger:
    - platform: mqtt
      topic: 'cmnd/sonoff-bridge/backlog'
  condition:
    - condition: template
      value_template: "{{ trigger.payload in ('rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2B2A3B2B2B2 55;rfraw off', 'rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EF0 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2A3A3B2B2A3 55;rfraw off', 'rfraw AA B0 35 05 04 12FC 05DC 02C6 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2A3B2A3B2A3B2 55;rfraw off') }}"
  action:
    - service: mqtt.publish
      data_template:
        topic: "433/Master_Bedroom_Curtain"
        payload: >-
          {%- if trigger.payload == 'rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EE6 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2B2A3B2B2B2 55;rfraw off' -%}
            100
          {%- elif trigger.payload == 'rfraw AA B0 35 05 04 12FC 05DC 02D0 0168 1EF0 A481A3A3B2B2B2A3A3A3B2A3A3A3B2B2A3A3A3A3A3A3B2A3B2B2B2B2B2B2B2A3B2A3B2B2A3A3B2B2A3 55;rfraw off' -%}
            0
          {%- else -%}
            50
          {%- endif -%}
        retain: True

Anyway, thought I’d share.
-Greg

1 Like

Hi All,

Does anybody has any idea or can address me to the possible solution?

Anyone have a Dooya DD2700H remote? Seems potentially different from the above, as I can’t get the B1 codes sniffed for it.

I am using a Sonoff 433 RF Bridge running the latest Tasmota+Portisch firmware in bridg (25) mode, and when I run rfraw 177, nothing shows up. I can get codes when testing with another MinkaAire RF remote so I know the portisch firmware is otherwise working.