Last active
February 23, 2024 17:42
-
-
Save slaclau/0c97c94859370c92dfe43d001a788b57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
name: *** | |
display_name: *** | |
esphome: | |
name: $name | |
friendly_name: $display_name | |
esp32: | |
board: esp32dev | |
framework: | |
type: arduino | |
# Enable logging | |
logger: | |
level: INFO | |
baud_rate: 0 | |
# Enable Home Assistant API | |
api: | |
encryption: | |
key: !secret api_key | |
mqtt: | |
broker: !secret mqtt_broker | |
username: !secret mqtt_username | |
password: !secret mqtt_password | |
ota: | |
web_server: | |
port: 80 | |
include_internal: false | |
external_components: | |
- source: github://oxan/esphome-stream-server | |
uart: | |
id: uart_bus | |
baud_rate: 9600 | |
tx_pin: 19 | |
rx_pin: 22 | |
debug: | |
direction: BOTH | |
after: | |
timeout: 100ms | |
sequence: | |
- lambda: UARTDebug::log_hex(direction, bytes, ' '); | |
- output.turn_on: red_led | |
- delay: 50ms | |
- output.turn_off: red_led | |
- delay: 50ms | |
stream_server: | |
uart_id: uart_bus | |
binary_sensor: | |
- platform: stream_server | |
connected: | |
name: $display_name Connected | |
id: connected | |
sensor: | |
- platform: stream_server | |
connection_count: | |
name: $display_name Number of connections | |
- platform: wifi_signal | |
name: "$display_name WiFi Signal Sensor" | |
update_interval: 60s | |
text_sensor: | |
- platform: wifi_info | |
ip_address: | |
name: "$display_name IP Address" | |
- platform: version | |
name: "$display_name ESPHome Version" | |
light: | |
- platform: fastled_clockless | |
chipset: WS2812B | |
pin: 27 | |
num_leds: 1 | |
rgb_order: GRB | |
id: rgb_led | |
restore_mode: ALWAYS_OFF | |
default_transition_length: 0ms | |
- platform: status_led | |
id: _status_led | |
output: red_led | |
number: | |
- platform: template | |
name: Brightness | |
id: brightness | |
min_value: 0 | |
max_value: 1 | |
step: 0.1 | |
optimistic: true | |
initial_value: 0.5 | |
output: | |
- platform: template | |
id: red_led | |
type: binary | |
write_action: | |
- if: | |
condition: | |
lambda: return state > 0; | |
then: | |
- light.turn_on: | |
id: rgb_led | |
red: 1.0 | |
green: 0.0 | |
blue: 0.0 | |
brightness: !lambda "return id(brightness).state;" | |
else: | |
- light.turn_on: | |
id: rgb_led | |
red: 0.0 | |
green: 0.0 | |
blue: 0.0 | |
brightness: 0% | |
- platform: template | |
id: green_led | |
type: binary | |
write_action: | |
- if: | |
condition: | |
lambda: return state > 0; | |
then: | |
- light.turn_on: | |
id: rgb_led | |
red: 0.0 | |
green: 1.0 | |
blue: 0.0 | |
brightness: !lambda "return id(brightness).state;" | |
else: | |
- light.turn_on: | |
id: rgb_led | |
red: 0.0 | |
green: 0.0 | |
blue: 0.0 | |
brightness: 0% | |
- platform: template | |
id: blue_led | |
type: binary | |
write_action: | |
- if: | |
condition: | |
lambda: return state > 0; | |
then: | |
- light.turn_on: | |
id: rgb_led | |
red: 0.0 | |
green: 0.0 | |
blue: 1.0 | |
brightness: !lambda "return id(brightness).state;" | |
else: | |
- light.turn_on: | |
id: rgb_led | |
red: 0.0 | |
green: 0.0 | |
blue: 0.0 | |
brightness: 0% | |
interval: | |
- interval: 3s | |
then: | |
- if: | |
condition: | |
wifi.connected: | |
then: | |
if: | |
condition: | |
api.connected | |
then: | |
- output.turn_on: blue_led | |
- delay: 0.25s | |
- output.turn_off: blue_led | |
- delay: 0.25s | |
- output.turn_on: blue_led | |
- delay: 0.25s | |
- output.turn_off: blue_led | |
- delay: 0.25s | |
else: | |
- output.turn_on: blue_led | |
- delay: 0.5s | |
- output.turn_off: blue_led | |
- delay: 0.5s | |
else: | |
- output.turn_off: blue_led | |
- if: | |
condition: | |
binary_sensor.is_on: connected | |
then: | |
- output.turn_on: green_led | |
- delay: 0.5s | |
- output.turn_off: green_led | |
- delay: 0.5s | |
else: | |
- output.turn_off: green_led | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: $display_name | |
password: !secret fallback_password | |
captive_portal: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an ESPhome config file for using an M5Stack Atom Lite as a serial to ip adapter.