xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
3k stars 638 forks source link

Sonoff Rf Bridge - RF Support 433_6 - Controls #386

Closed xoseperez closed 6 years ago

xoseperez commented 6 years ago

Originally reported by: Marlon Challouts (Bitbucket: marlonchallouts, GitHub: marlonchallouts)


Good afternoon

I'm trying to record two controls of the same model, but by pressing the "learn" button, Sonoff Rf Bridge can not learn the control.

Control = http://www.intelbras.com.br/sites/default/files/downloads/manual_xac_2000_tx_site.pdf

I made tests using the RC-switch library and the control is using protocol 6.

Can not Espurna learn controls with protocol 6?

Best regards

xoseperez commented 6 years ago

The PR was merged in the dev branch and will be released with 1.12.2, albeit disabled by default. You will have to enable the feature in ESPurna (look for RF_RAW_SUPPORT in general.h) and you will also have to flash the EFM8 with a new firmware. Head over to https://github.com/rhx/RF-Bridge-EFM8BB1 for instructions.

xoseperez commented 6 years ago

Original comment by Marlon Challouts (Bitbucket: marlonchallouts, GitHub: marlonchallouts):


Any predictions of when it will be merge?

xoseperez commented 6 years ago

The RF bridge has a secondary microcontroller responsible for decoding RF signals. If the firmware in that microcontroller does not support the protocol then ESPurna can't do anything. There is a project to replace the firmware in that secondary microcontroller and a pull request to allow ESPurna to send custom messages through it, but it's not yet merged/tested.

xoseperez commented 6 years ago

This is the info in the above mentioned PR (it got lost on the migration):

By default, the Sonoff RF bridge only supports a fixed 24 bit encoding. I have forked Portisch's 8051 firmware (for the EFM8BB1 chip) that is compatible with all the original Sonoff RFBRIDGE commands, but mine now also allows sending arbitrary RF codes (consisting of up to 16 different RF timing "buckets" with precise code repetition timing):

https://github.com/rhx/RF-Bridge-EFM8BB1

This allows to use the RF bridge as a truly universal remote for common light and other home automation devices that use, e.g., tri-state or Manchester codes. Please note that truly universal learning is not possible via the RF bridge at the moment (and may exceed the capabilities of the EFM8BB1), but this can easily be done via an Arduino with an RF receiver using the RFControl library (see more details and examples below):

https://github.com/pimatic/RFControl

This pull request adds support for sending raw RF codes to Espurna using the new 0xB0 bucket send command (from the RF-Bridge-EFM8BB1 firmware). The format is documented on the RF-Bridge-EFM8BB1 github page, but here is a short summary and example of the byte sequence (spaces are for readability, but need to be removed before pasting into the RFBRIDGE web interface (switch ON or switch OFF)):

AA B0 20 04 1A 0120 01C0 0300 2710 01212122012201212121212121220121212201212203 55

So how to learn these codes? The RFControl Arduino library above comes with a "compressed" example sketch:

https://github.com/pimatic/RFControl/tree/master/examples/compressed

This sketch will output something like:

b: 288 448 768 10000 0 0 0 0 t: 01212122012201212121212121212121212122012203

which means it has detected 4 buckets (out of a possible 8, line b:) with the given timing sequence for the received commend (line t:). Putting them together (after converting the bucket times to hex) gives the 0xB0 command in the example above.

Here is an overview of the comments for the commits in this pull request:

xoseperez commented 6 years ago

Will be released with 1.12.2