My Sonoff RF Bridge 433 ESPHome YAML looks like the below code:
I have a captive portal abd wifi fallback enable and static ip.
The output comes on the HA event bus and there is a service call to send codes too.
This is based on this guide:
esphome:
name: rfbridge1
esp8266:
board: esp01_1m
# Enable logging
#logger:
# Enable Home Assistant API
api:
password: !secret api_pass
encryption:
key: !secret api_key
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
ota:
password: !secret esphome_ota_pass
wifi:
ssid: DWsh
password: !secret dwsh_pass
manual_ip:
static_ip: 10.10.12.14
subnet: 255.255.255.0
gateway: 10.10.12.1
dns1: 10.10.12.1
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
password: !secret esphome_fallback_wifi_pass
captive_portal:
uart:
tx_pin: 1
rx_pin: 3
baud_rate: 19200
logger:
baud_rate: 0
rf_bridge:
on_code_received:
- homeassistant.event:
event: esphome.rf_code_received
data:
sync: !lambda 'return format_hex(data.sync);'
low: !lambda 'return format_hex(data.low);'
high: !lambda 'return format_hex(data.high);'
code: !lambda 'return format_hex(data.code);'
output:
- platform: esp8266_pwm
id: green_led
pin: GPIO13
inverted: true
light:
- platform: monochromatic
name: "RF Bridge 1 LED"
output: green_led