I have flashed ESPhome and the Portisch firmware to my Sonoff Bridge
My esphome config is mostly based on the instructions here:
RF Bridge Component — ESPHome?
Everything is working as it should.
Now I want to set up my RF devices. I have a fob and some motion sensors. All of the guides that i can find on line use the remote_receiver: and remote_transmitter: components. and they return a binary code and protocol.
the rf_bridge component returns something like this:
Received RFBridge Code: sync=0x217A low=0x00FA high=0x0334 code=0x870E02
the documentation says
on_code_received
Trigger
With this configuration option you can write complex automations whenever a code is received. To use the code, use a lambda template, the code and the corresponding protocol timings are available inside that lambda under the variables named code
, sync
, high
and low
.
Which i do not understand.I don’t know how to set up my RF sensors. I would really appreciate some help or a link to a tutorial.
my config is here
esphome:
name: rf-bridge
platform: ESP8266
board: esp01_1m
ota:
password: ###
wifi:
ssid: ###
password: ###
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rf-Bridge Fallback Hotspot"
password: ###
captive_portal:
api:
services:
- service: send_rf_code
variables:
sync: int
low: int
high: int
code: int
then:
- rf_bridge.send_code:
sync: !lambda 'return sync;'
low: !lambda 'return low;'
high: !lambda 'return high;'
code: !lambda 'return code;'
- service: learn
then:
- rf_bridge.learn
uart:
tx_pin: 1
rx_pin: 3
baud_rate: 19200
logger:
baud_rate: 0
sensor:
- platform: wifi_signal
name: Sonoff RF Bridge Wifi Signal
update_interval: 10s
- platform: uptime
name: Sonoff RF Bridge Uptime
binary_sensor:
- platform: status
name: Sonoff RF Bridge Status
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);'
and a section from the log is here
[11:57:06][D][sensor:131]: 'Sonoff RF Bridge Wifi Signal': Sending state -31.00000 dBm with 0 decimals of accuracy
[11:57:10][D][rf_bridge:056]: Received RFBridge Code: sync=0x21C0 low=0x0104 high=0x0334 code=0x870E02
[11:57:11][D][rf_bridge:056]: Received RFBridge Code: sync=0x217A low=0x00DC high=0x0316 code=0x870E08
[11:57:12][D][rf_bridge:056]: Received RFBridge Code: sync=0x21A2 low=0x00F0 high=0x030C code=0x870E01