Configuration
esphome:
name: mini-r2
friendly_name: Sonoff Mini R2
esp8266:
board: esp01_1m # Mini R2 = ESP8285, 1 MB flash
logger:
baud_rate: 0
wifi:
ssid: !secret wifi_ssid_2
password: !secret wifi_password_2
# manual_ip:
# static_ip: ${device_ip}
# gateway: 192.168.x.x
# subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "ESPHOME"
password: "12345678"
api:
reboot_timeout: 15min
# encryption:
# key: !secret api_encryption_key
ota:
platform: esphome
# password: !secret ota_password
# the web_server & sensor components can be removed without affecting core functionaility.
web_server:
port: 80
sensor:
- platform: wifi_signal
name: ${device_name} Wifi Signal Strength
update_interval: 60s
- platform: uptime
name: ${device_name} Uptime
#######################################
# Device specific Config Begins Below #
#######################################
binary_sensor:
- platform: gpio
pin: GPIO00
id: reset
internal: true
filters:
- invert:
- delayed_off: 10ms
on_press:
- switch.toggle:
id: relay_1
- platform: gpio
name: ${device_name}_status
pin: GPIO04
id: switch_1
on_press:
then:
- switch.toggle:
id: relay_1
on_release:
then:
- switch.toggle:
id: relay_1
switch:
- platform: gpio
name: ${device_name}_switch
icon: "mdi:lightbulb_outline"
pin: GPIO12
id: relay_1
restore_mode: restore_default_off
status_led:
pin:
number: GPIO13
allow_other_uses: true
inverted: true
output:
- platform: esp8266_pwm
id: blue_led
pin:
number: GPIO13
allow_other_uses: true
inverted: True
light:
# the 4 lines below define the Blue LED light on Sonoff Mini, to expose in HomeAssistant remove line "internal: true"
- platform: monochromatic
name: ${device_name}_blueled
output: blue_led
internal: true # hides the Blue LED from HomeAssistantConfiguration
source esphome/bin/activate
esphome run sonoff_mini_r2.yaml --device 192.168.178.51
Links
https://community.home-assistant.io/t/flash-sonoff-minir2-firmware-3-6-0-with-esphome-over-the-air/311042
https://community.home-assistant.io/t/flash-sonoff-minir2-firmware-3-6-0-with-esphome-over-the-air/311042
https://devices.esphome.io/devices/sonoff-mini-relay/