It has been more than 2 years having Sonnof Dual R3 flashed with esphome and working for my shutters at home but they were really affected because my installation shared a live neutral wire that use to generate noise when turning up and down manually or via home assistant. Randomly other shutters start working for few seconds or stop working if at the same time another start to work. It was really annoying.
Things went worst this past week with recent esphome changes on some of the cover functions and I end up just using AI to troubleshoot and get a final working version. Since I had lots of pain I wanted to share with the community my working configs in case someone else can benefit from it.
Note: config is well sutted for my shutters that throw ~200 watt when operating (240V).
yaml for Sonoff Dual R3 Version 1.X
substitutions:
#Let devicename empty for short entities in home assistant
devicename: ""
esphome:
name: my-shutter-name
friendly_name: My Shutter Friendly Name
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret encryp_shutter_key
ota:
- platform: esphome
password: !secret ota_shutter
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
wifi:
networks:
- ssid: !secret ssid
password: !secret pass_wifi
manual_ip:
static_ip: 192.168.1.100
gateway: 192.168.1.1
subnet: 255.255.255.0
uart:
tx_pin: GPIO25
rx_pin: GPIO26
baud_rate: 38400
parity: EVEN
sensor:
- platform: wifi_signal
name: "$devicename WiFi Signal"
update_interval: '30s'
- platform: cse7761
# Fixed 500ms interval: the current_based cover needs fast readings during movement.
# Do NOT dynamically change this with set_update_interval()/call_setup() as it
# reinitializes the sensor, resets filters, and can cause glitched readings.
update_interval: 500ms
id: power_sensor
voltage:
name: 'Voltage'
current_1:
name: 'Current 1'
id: open_current
disabled_by_default: True
filters:
# Zero out readings below 0.15A — eliminates shared neutral wire noise on idle channel
# which was causing false malfunction detection on the opposite channel.
- lambda: !lambda |-
if (x < 0.15) return 0.0;
return x;
# Smooths out momentary dips/spikes caused by shared neutral wire interference.
# Each published value is the average of the last 3 readings (1.5s window).
- sliding_window_moving_average:
window_size: 3
send_every: 1
current_2:
name: 'Current 2'
id: close_current
disabled_by_default: True
filters:
- lambda: !lambda |-
if (x < 0.15) return 0.0;
return x;
- sliding_window_moving_average:
window_size: 3
send_every: 1
active_power_1:
name: 'Active Power 1'
active_power_2:
name: 'Active Power 2'
- platform: uptime
name: "$devicename Uptime"
text_sensor:
- platform: version
name: "$devicename ESPHome Version"
binary_sensor:
- platform: gpio
pin:
number: GPIO32
mode: INPUT_PULLUP
inverted: True
name: "$devicename Open Button"
# Debounce: reject phantom GPIO triggers from shared neutral wire noise
filters:
- delayed_on: 100ms
- delayed_off: 100ms
on_press:
then:
cover.open: blind
#logger.log: "$name Open Button"
on_release:
then:
cover.stop: blind
- platform: gpio
pin:
number: GPIO33
mode: INPUT_PULLUP
inverted: True
name: "$devicename Close Button"
filters:
- delayed_on: 100ms
- delayed_off: 100ms
on_press:
then:
cover.close: blind
on_release:
then:
cover.stop: blind
#logger.log: "$name Close Button"
switch:
- platform: gpio
id: open_relay
interlock: [close_relay]
interlock_wait_time: 200ms
pin: GPIO27
name: "$devicename Open Relay"
restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
id: close_relay
interlock: [open_relay]
interlock_wait_time: 200ms
pin: GPIO14
name: "$devicename Close Relay"
restore_mode: RESTORE_DEFAULT_OFF
# Example configuration entry
cover:
- platform: current_based
name: Blind
id: blind
open_sensor: open_current
open_moving_current_threshold: 0.3
open_duration: 20s
open_action:
- switch.turn_on: open_relay
close_sensor: close_current
close_moving_current_threshold: 0.3
close_duration: 20s
close_action:
- switch.turn_on: close_relay
stop_action:
- switch.turn_off: close_relay
- switch.turn_off: open_relay
obstacle_rollback: 30%
#With corrected threshold (0.3A) and sliding_window filter, 10s should be safe.
start_sensing_delay: 10s
# Malfunction detection MUST be disabled with a shared neutral wire.
# Cross-channel noise causes false "relay welded" detections.
malfunction_detection: false
status_led:
pin:
number: GPIO13
inverted: yes
yaml for Sonoff Dual R3 Version 2.X
substitutions:
#Let devicename empty for short entities in home assistant
devicename: ""
esphome:
name: my-shutter-name
friendly_name: My Shutter Friendly Name
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret encryp_shutter_key
ota:
- platform: esphome
password: !secret ota_shutter
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
wifi:
networks:
- ssid: !secret ssid
password: !secret pass_wifi
manual_ip:
static_ip: 192.168.1.100
gateway: 192.168.1.1
subnet: 255.255.255.0
uart:
tx_pin: GPIO25
rx_pin: GPIO26
baud_rate: 4800
parity: NONE
stop_bits: 2
sensor:
- platform: wifi_signal
name: "$devicename WiFi Signal"
update_interval: '30s'
- platform: bl0939
# Fixed 500ms interval: the current_based cover needs fast readings during movement.
# Do NOT dynamically change this with set_update_interval()/call_setup() as it
# reinitializes the sensor, resets filters, and can cause glitched readings.
update_interval: 500ms
id: power_sensor
voltage:
name: "$devicename Voltage"
current_1:
name: "$devicename Current 1"
id: open_current
filters:
# Zero out readings below 0.15A — eliminates shared neutral wire noise on idle channel
# which was causing false malfunction detection on the opposite channel.
- lambda: !lambda |-
if (x < 0.15) return 0.0;
return x;
# Smooths out momentary dips/spikes caused by shared neutral wire interference.
# Each published value is the average of the last 3 readings (1.5s window).
- sliding_window_moving_average:
window_size: 3
send_every: 1
current_2:
name: "$devicename Current 2"
id: close_current
filters:
- lambda: !lambda |-
if (x < 0.15) return 0.0;
return x;
- sliding_window_moving_average:
window_size: 3
send_every: 1
active_power_1:
name: "$devicename Active Power 1"
active_power_2:
name: "$devicename Active Power 2"
energy_1:
name: "$devicename Energy 1"
energy_2:
name: "$devicename Energy 2"
energy_total:
name: "$devicename Energy Total"
- platform: uptime
name: "$devicename Uptime"
text_sensor:
- platform: version
name: "$devicename ESPHome Version"
binary_sensor:
- platform: gpio
pin:
number: GPIO32
mode: INPUT_PULLUP
inverted: True
name: "$devicename Open Button"
# Debounce: reject phantom GPIO triggers from shared neutral wire noise
filters:
- delayed_on: 100ms
- delayed_off: 100ms
on_press:
then:
cover.open: blind
#logger.log: "$name Open Button"
on_release:
then:
cover.stop: blind
- platform: gpio
pin:
number: GPIO33
mode: INPUT_PULLUP
inverted: True
name: "$devicename Close Button"
filters:
- delayed_on: 100ms
- delayed_off: 100ms
on_press:
then:
cover.close: blind
on_release:
then:
cover.stop: blind
#logger.log: "$name Close Button"
switch:
- platform: gpio
id: open_relay
interlock: [close_relay]
interlock_wait_time: 200ms
pin: GPIO27
name: "$devicename Open Relay"
restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
id: close_relay
interlock: [open_relay]
interlock_wait_time: 200ms
pin: GPIO14
name: "$devicename Close Relay"
restore_mode: RESTORE_DEFAULT_OFF
# Example configuration entry
cover:
- platform: current_based
name: Blind
id: blind
open_sensor: open_current
open_moving_current_threshold: 0.3
open_duration: 25s
open_action:
- switch.turn_on: open_relay
close_sensor: close_current
close_moving_current_threshold: 0.3
close_duration: 24s
close_action:
- switch.turn_on: close_relay
stop_action:
- switch.turn_off: close_relay
- switch.turn_off: open_relay
obstacle_rollback: 30%
start_sensing_delay: 10s
# Malfunction detection MUST be disabled with a shared neutral wire.
# Cross-channel noise causes false "relay welded" detections.
malfunction_detection: false
status_led:
pin:
number: GPIO13
inverted: yes
Hope it can help!