This is an automated archive made by the Lemmit Bot.

The original was posted on /r/homeassistant by /u/njain2686 on 2023-07-06 13:04:05+00:00.


Greetings!

I flashed my sonoff Dual R3 with ESPhome. Every thing is working except my switches are not being recognised as rocker switch but as bell switch ( push button )

My Yaml is

substitutions:
  devicename: sonoffdual

esphome:
  name: $devicename

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: .lan

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "$devicename Fallback Hotspot"
    password: "123456789"

captive_portal:

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
  active: true

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: 60s
  - platform: bl0939
    update_interval: 30s
    voltage:
      name: "$devicename Voltage"
    current_1:
      name: "$devicename Current 1"
    current_2:
      name: "$devicename Current 2"
    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"
  - platform: wifi_info
    ip_address:
      name: ESP IP Address
    ssid:
      name: ESP Connected SSID
    bssid:
      name: ESP Connected BSSID
    mac_address:
      name: ESP Mac Wifi Address

output:
  - platform: gpio
    pin: GPIO27
    id: relay1
  - platform: gpio
    pin: GPIO14
    id: relay2

switch:
  - platform: output
    name: "$devicename Relay 1"
    output: relay1
    id: sw1
  - platform: output
    name: "$devicename Relay 2"
    output: relay2
    id: sw2

status_led:
  pin:
    number: GPIO13
    inverted: yes

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "$devicename Button"
    on_press:
      - logger.log: "$devicename Button"
      - switch.toggle: sw1
  - platform: gpio
    pin:
      number: GPIO32
      mode: INPUT_PULLUP
      inverted: True
    name: "$devicename Switch 1"
    on_press:
      - logger.log: "$devicename Switch 1"
      - switch.toggle: sw1
  - platform: gpio
    pin:
      number: GPIO33
      mode: INPUT_PULLUP
      inverted: True
    name: "$devicename Switch 2"
    on_press:
      - logger.log: "$devicename Switch 2"
      - switch.toggle: sw2