Sonoff Dual R3 with ESPHome
In questo articolo analizziamo come caricare il firmware ESPHome su un Sonoff Dual R3. Il modello in analisi è quello che riporta sul PCB la sigla DUALR3-Lite POW e come hardware version la rev 1.x.
GPIO Pinout
Pin | Function |
GPIO13 | Status LED (blue / inverted) |
GPIO0 | Push Button (inverted) |
GPIO27 | Relay 1 / LED 1 (red) |
GPIO14 | Relay 2 / LED 2 (red) |
GPIO32 | Switch 1 (inverted) |
GPIO33 | Switch 2 (inverted) |
GPIO25 | Power sensor UART TX |
GPIO26 | Power sensor UART RX |
Per la misura della potenza gli integrati utilizzati sono il CSE7761 Power Sensor (v1.x) oppure il BL0939 Power Sensor (v2.x)
File di configurazione
esphome:
name: sonoff-dual-r3
esp32:
board: esp32dev
logger:
level: INFO
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
encryption:
key: "7RetpFJnndBVHmNtsC3BhB4yYE67GxkTU5TQ4mgj3cY="
ota:
password: "f56fbfc5a380e088be9b8122d6f5bec8"
sensor:
- platform: wifi_signal
name: "RSSI"
id: sensor_rssi
update_interval: 90s
entity_category: "diagnostic"
- platform: uptime
name: "Uptime"
id: sensor_uptime
update_interval: 300s
entity_category: "diagnostic"
button:
- platform: restart
name: "Restart"
id: button_restart
light:
- platform: status_led
name: "LED"
id: led_status
pin:
number: GPIO13
inverted: True
internal: True
switch:
- platform: gpio
name: "1"
pin: GPIO27
id: relay_1
- platform: gpio
name: "2"
pin: GPIO14
id: relay_2
binary_sensor:
- platform: gpio
name: "Button"
id: sensor_button
pin:
number: GPIO00
mode:
input: True
pullup: True
inverted: True
disabled_by_default: True
icon: 'mdi:radiobox-blank'
filters:
- delayed_on: 50ms
on_press:
- switch.toggle: relay_1
- platform: gpio
name: "1"
pin:
number: GPIO32
mode:
input: True
pullup: True
inverted: True
filters:
- delayed_on_off: 50ms
on_press:
- switch.turn_on: relay_1
on_release:
- switch.turn_off: relay_1
- platform: gpio
name: "2"
pin:
number: GPIO33
mode:
input: True
pullup: True
inverted: True
filters:
- delayed_on_off: 50ms
on_press:
- switch.turn_on: relay_2
on_release:
- switch.turn_off: relay_2