Untitled

 avatar
unknown
plain_text
a month ago
2.2 kB
5
Indexable
substitutions:
  device_name: "minir4-01"

esphome:
  name: ${device_name}
  comment: "Sonoff MiniR4 Extreme"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key

# Configure WiFi
wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case WiFi connection fails
  ap:
    ssid: ${device_name}
    password: ""

captive_portal:

# OTA updates
ota:
  - platform: esphome
    password: !secret ota_password

# Web server
web_server:
  port: 80

# Sensors
sensor:
  - platform: wifi_signal
    name: ${device_name} Wifi Signal Strength
    update_interval: 90s
    entity_category: "diagnostic"

  - platform: uptime
    name: ${device_name} Uptime
    update_interval: 300s
    entity_category: "diagnostic"

text_sensor:
  - platform: wifi_info
    ssid:
      name: Connected SSID
    ip_address:
      name: IP Address
    dns_address:
      name: DNS Address

#######################################
# Device specific Config Begins Below #
#######################################

# Status LED configuration
status_led:
  pin:
    number: GPIO19
    inverted: true

# Output configuration for relay
output:
  # Physical relay on GPIO
  - platform: gpio
    pin: GPIO26
    id: relay_1

# Light configuration
light:
  - platform: binary
    id: light_1
    name: ${device_name}
    icon: mdi:ceiling-light-multiple-outline
    restore_mode: restore_default_off
    output: relay_1

# Binary sensor configurations
binary_sensor:
  - platform: gpio
    pin: GPIO00
    id: button
    filters:
      - invert:
      - delayed_off: 50ms
    on_press:
      - light.toggle:
          id: light_1

  - platform: gpio
    name: s1
    pin: GPIO27
    id: s1
    filters:
      - invert:
      - delayed_off: 50ms
    on_press:
      then:
        - light.turn_on:
            id: light_1
    on_release:
      then:
        - light.turn_off:
            id: light_1
Editor is loading...
Leave a Comment