Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################################################################################################
- ## Original post from: https://simondn.blogspot.com/2023/06/usbesphome.html
- ## source code from: https://devices.esphome.io/devices/Sinilink-XY-WFUSB-USB-Switch-Relay
- ######################################################################################################
- substitutions:
- device_name: usb-ctrl
- esphome:
- name: ${device_name}
- friendly_name: USB-Ctrl
- esp8266:
- board: esp01_1m
- # Enable logging
- logger:
- # Enable Home Assistant API
- api:
- ota:
- password: !secret ota_password
- wifi:
- ssid: !secret my_ap_ssid
- password: !secret my_ap_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "${device_name}"
- password: "12345678"
- ap_timeout: 3min
- captive_portal:
- status_led:
- pin:
- number: GPIO16 # Blue LED
- switch:
- # Relay
- - platform: gpio
- id: relay
- pin: GPIO5
- name: "${device_name} Relay"
- on_turn_on:
- - switch.turn_on: green_led
- on_turn_off:
- - switch.turn_off: green_led
- # Green LED
- # LED is on when relay is off
- - platform: gpio
- pin: GPIO14
- id: green_led
- inverted: true # start on
- # Button
- binary_sensor:
- - platform: gpio
- id: button
- pin:
- number: GPIO04
- mode: INPUT_PULLUP
- inverted: True
- on_press:
- - switch.toggle: relay
- - platform: status
- name: "${device_name} WiFi Status"
- sensor:
- - platform: wifi_signal
- name: "${device_name} WiFi Signal"
- update_interval: 60s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement