devices.esphome.io
Lingan SWA1
Lingan SWA1
Device Type: plugBoard: esp8266
GPIO Pinout
| Pin | Function |
|---|---|
| GPIO4 | Blue Status LED (HIGH = off, LOW = on) |
| GPIO5 | Relay and Red LED (HIGH = on, LOW = off) |
| GPIO13 | Push Button (HIGH = off, LOW = on) |
Basic Configuration - as a light entity
substitutions: devicename: esphome-device-name friendly_name: My Friendly Name restore_mode: RESTORE_DEFAULT_OFF
esphome: name: "${devicename}" friendly_name: "${friendly_name}" esp8266: board: esp01_1m restore_from_flash: true
# OTA flashingota: - platform: esphome
wifi: # Your Wifi network details # Enable fallback hotspot in case wifi connection fails ap:
# Enabling the logging componentlogger: baud_rate: 0 # disable logging over uart level: WARN
# Enable Home Assistant APIapi:
# Enable the captive portalcaptive_portal:
# Enable the Web Server component webserver:
binary_sensor: - platform: gpio pin: number: GPIO13 # push button mode: INPUT_PULLUP inverted: true name: "button" internal: true # dont export to HA frontend on_press: - light.toggle: component_sw
light: - platform: binary id: component_sw name: none # none = use friendly name output: output_relay restore_mode: ${restore_mode}
output: - id: output_relay platform: gpio pin: GPIO5 # relay
- platform: esp8266_pwm # dimmer for status LED pin: GPIO4 # LED frequency: 3333Hz id: status_led max_power: 0.20 # on brightness (0 = off) => (1 = full on) min_power: 0.00 # off brightness (0 = off) => (1 = full on) inverted: true
script:- id: flash_wifi_error mode: restart then: - while: condition: lambda: |- return true; then: - output.turn_on: status_led - delay: 500ms - output.turn_off: status_led - delay: 500ms
interval: # Check wifi is connected. - interval: 2s then: - if: condition: wifi.connected: then: - script.stop: flash_wifi_error# - output.turn_on: status_led # Wifi connected, LED on. - output.turn_off: status_led # Wifi connected, LED off. else: - script.execute: flash_wifi_errorBasic Configuration - as a switch entity
substitutions: devicename: esphome-device-name friendly_name: My Friendly Name restore_mode: RESTORE_DEFAULT_OFF
esphome: name: "${devicename}" friendly_name: "${friendly_name}" esp8266: board: esp01_1m restore_from_flash: true
# OTA flashingota: - platform: esphome
wifi: # Your Wifi network details # Enable fallback hotspot in case wifi connection fails ap:
# Enabling the logging componentlogger: baud_rate: 0 # disable logging over uart level: WARN
# Enable Home Assistant APIapi:
# Enable the captive portalcaptive_portal:
# Enable the Web Server component webserver:
binary_sensor: - platform: gpio pin: number: GPIO13 # push button mode: INPUT_PULLUP inverted: true name: "button" internal: true # dont export to HA frontend on_press: - switch.toggle: component_sw
switch: - platform: gpio name: none # none = use friendly name pin: GPIO5 # relay id: component_sw restore_mode: ${restore_mode}
output: - platform: esp8266_pwm # dimmer for status LED pin: GPIO4 # LED frequency: 3333Hz id: status_led max_power: 0.20 # on brightness (0 = off) => (1 = full on) min_power: 0.00 # off brightness (0 = off) => (1 = full on) inverted: true
script:- id: flash_wifi_error mode: restart then: - while: condition: lambda: |- return true; then: - output.turn_on: status_led - delay: 500ms - output.turn_off: status_led - delay: 500ms
interval: # Check wifi is connected. - interval: 2s then: - if: condition: wifi.connected: then: - script.stop: flash_wifi_error# - output.turn_on: status_led # Wifi connected, LED on. - output.turn_off: status_led # Wifi connected, LED off. else: - script.execute: flash_wifi_errorBasic Configuration - as a fan entity
substitutions: devicename: esphome-device-name friendly_name: My Friendly Name restore_mode: RESTORE_DEFAULT_OFF
esphome: name: "${devicename}" friendly_name: "${friendly_name}" esp8266: board: esp01_1m restore_from_flash: true
# OTA flashingota: - platform: esphome
wifi: # Your Wifi network details
# Enable fallback hotspot in case wifi connection fails ap:
# Enabling the logging componentlogger: baud_rate: 0 # disable logging over uart level: WARN
# Enable Home Assistant APIapi:
# Enable the captive portalcaptive_portal:
binary_sensor: - platform: gpio pin: number: GPIO13 # push button mode: INPUT_PULLUP inverted: true name: "button" internal: true # dont export to HA frontend on_press: - fan.toggle: component_sw
fan: - platform: binary id: component_sw name: none # none = use friendly name output: output_relay restore_mode: ${restore_mode}
output: - id: output_relay platform: gpio pin: GPIO5 # relay
- platform: esp8266_pwm # dimmer for status LED pin: GPIO4 # LED frequency: 3333Hz id: status_led max_power: 0.20 # on brightness (0 = off) => (1 = full on) min_power: 0.00 # off brightness (0 = off) => (1 = full on) inverted: true
script:- id: flash_wifi_error mode: restart then: - while: condition: lambda: |- return true; then: - output.turn_on: status_led - delay: 500ms - output.turn_off: status_led - delay: 500ms
interval: # Check wifi is connected. - interval: 2s then: - if: condition: wifi.connected: then: - script.stop: flash_wifi_error# - output.turn_on: status_led # Wifi connected, LED on. - output.turn_off: status_led # Wifi connected, LED off. else: - script.execute: flash_wifi_error