Hi all,
A month or two ago I ran out of memory on my RPi SD card and completely crashed my HA installation. Luckily, I was able to successfully restore from a backup onto an SSD and everything is running happily now. Everything, that is, except for one of my ESPHome nodes…
This node (a WeMos D1 Mini clone) is attached to some simple RF rx/tx chips with hand-wound antennae:
- The tx side sends on/off messages to Etekcity outlets (like this one: https://www.etsy.com/listing/4401181168/etekcity-remote-outlet-switch-3-pack ) when triggered from HA.
- The rx side listens for button presses from the Etekcity remote, then uses those to run automations in HA.
This was all working perfectly before the restore from backup. Following the restore, the rx side is nonfunctional: when I check the logs on the ESPHome device, the RF remote button presses are detected as expected, but this data doesn’t make it into HA anymore.
I don’t understand what could be going wrong, nor how to fix it or troubleshoot further. Any advice is appreciated!
The only thing I could think of is that I upgraded HA version and ESPHome (I think) during the restore process. It seems unlikely that this would cause the issue, but I suppose it’s possible…if so, what do I need to change in the code?
Below is the (scrubbed) code that’s running on the ESPHome node.
# detects rf button presses and ingests into HA ("Received n")
# controls physical Etekcity outlets via switches in HA ("Transmit n")
esphome:
name: rf
friendly_name: RF
esp8266:
board: nodemcuv2
# RF Receiver
remote_receiver:
pin: GPIO4 # Wemos D2
# dump: rc_switch # uncomment to print detected codes in the logs
tolerance: 60%
filter: 4us
idle: 4ms
# Define binary sensors for each button pair on the RF remote
binary_sensor:
- platform: remote_receiver
name: "1 - On"
rc_switch_raw:
code: '000100010101010100110011'
protocol:
pulse_length: 180
on_press:
button.press: received_1_on
- platform: remote_receiver
name: "1 - Off"
rc_switch_raw:
code: '000100010101010100111100'
protocol:
pulse_length: 180
on_press:
button.press: received_1_off
- platform: remote_receiver
name: "2 - On"
rc_switch_raw:
code: '000100010101010111000011'
protocol:
pulse_length: 180
on_press:
button.press: received_2_on
- platform: remote_receiver
name: "2 - Off"
rc_switch_raw:
code: '000100010101010111001100'
protocol:
pulse_length: 180
on_press:
button.press: received_2_off
- platform: remote_receiver
name: "3 - On"
rc_switch_raw:
code: '000100010101011100000011'
protocol:
pulse_length: 180
on_press:
button.press: received_3_on
- platform: remote_receiver
name: "3 - Off"
rc_switch_raw:
code: '000100010101011100001100'
protocol:
pulse_length: 180
on_press:
button.press: received_3_off
- platform: remote_receiver
name: "4 - On"
rc_switch_raw:
code: '000100010101110100000011'
protocol:
pulse_length: 180
on_press:
button.press: received_4_on
- platform: remote_receiver
name: "4 - Off"
rc_switch_raw:
code: '000100010101110100001100'
protocol:
pulse_length: 180
on_press:
button.press: received_4_off
- platform: remote_receiver
name: "5 - On"
rc_switch_raw:
code: '000100010111010100000011'
protocol:
pulse_length: 180
on_press:
button.press: received_5_on
- platform: remote_receiver
name: "5 - Off"
rc_switch_raw:
code: '000100010111010100001100'
protocol:
pulse_length: 180
on_press:
button.press: received_5_off
# RF Transmitter
remote_transmitter:
pin: GPIO14
carrier_duty_percent: 100%
# Define input buttons that fire when physical remote buttons are pressed - seems necessary for HA to pick up button presses?
button:
- platform: template
name: "Received 1 On"
id: received_1_on
- platform: template
name: "Received 1 Off"
id: received_1_off
- platform: template
name: "Received 2 On"
id: received_2_on
- platform: template
name: "Received 2 Off"
id: received_2_off
- platform: template
name: "Received 3 On"
id: received_3_on
- platform: template
name: "Received 3 Off"
id: received_3_off
- platform: template
name: "Received 4 On"
id: received_4_on
- platform: template
name: "Received 4 Off"
id: received_4_off
- platform: template
name: "Received 5 On"
id: received_5_on
- platform: template
name: "Received 5 Off"
id: received_5_off
# Define output buttons for use from HA front-end:
- platform: template
name: "Transmit 1 On"
id: transmit_1_on
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101010100110011'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 1 Off"
id: transmit_1_off
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101010100111100'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 2 On"
id: transmit_2_on
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101010111000011'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 2 Off"
id: transmit_2_off
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101010111001100'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 3 On"
id: transmit_3_on
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101011100000011'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 3 Off"
id: transmit_3_off
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101011100001100'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 4 On" # button 4
id: transmit_4_on
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101110100000011'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 4 Off" # button 1
id: transmit_4_off
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010101110100001100'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 5 On" # button 5
id: transmit_5_on
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010111010100000011'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
- platform: template
name: "Transmit 5 Off" # button 5
id: transmit_5_off
on_press:
remote_transmitter.transmit_rc_switch_raw:
code: '000100010111010100001100'
protocol:
inverted: false
pulse_length: 180
repeat:
times: 10
wait_time: 0s
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
platform: esphome
password: "redacted"
wifi:
ssid: "redacted"
password: "redacted"
# Static IP setup
manual_ip:
static_ip: redacted
gateway: redacted
subnet: redacted
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "redacted"
password: "redacted"
captive_portal:
