scripts/watchwip

120 lines
2.7 KiB
Plaintext

esphome:
name: esphome-web-ad0671
friendly_name: WATCH
min_version: 2024.11.0
name_add_mac_suffix: false
esp8266:
board: esp01_1m
# Enable logging with debug level
logger:
level: DEBUG # Explicitly set logging level to DEBUG
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
platform: esphome
wifi:
ssid: "DNTD"
password: "wifipassword"
ap:
ssid: "Mini-Display-Tv--Yellow"
password: "wifipassword"
font:
- file: "gfonts://Bytesized"
id: font1
size: 16
light:
- platform: neopixelbus
name: "WS2812B LED"
id: ws2812b
pin: GPIO15
num_leds: 1 # Adjust the number of LEDs as per your setup
type: GRB # Set the color order if needed (e.g., GRB for WS2812B)
variant: WS2812 # Specify the variant (WS2812 for WS2812B)
i2c:
sda: GPIO5 # D1
scl: GPIO4 # D2
scan: true
# Text sensors for weather and location information
text_sensor:
# Location name from Home Assistant
- platform: homeassistant
id: weather_location
entity_id: sensor.weather # The entity_id for your weather location
attribute: friendly_name # Use the friendly name attribute
internal: true
# Current weather condition from Home Assistant
- platform: homeassistant
id: weather_condition
entity_id: weather.home # The entity_id for weather condition
internal: true
# Display configuration to show the weather condition and location
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
id: sh1106_display
update_interval: 1s
address: 0x3C # Default I2C address for SH1106
lambda: |-
// Display weather location
it.print(0, 0, id(font1), "Location: ");
it.print(0, 16, id(font1), id(weather_location).state.c_str());
// Display current weather condition
it.print(0, 32, id(font1), "Condition: ");
it.print(0, 48, id(font1), id(weather_condition).state.c_str());
# Define pull-up buttons for GPIOs (as before)
binary_sensor:
- platform: gpio
pin:
number: GPIO1
mode: INPUT_PULLUP
name: "Button GPIO1"
- platform: gpio
pin:
number: GPIO2
mode: INPUT_PULLUP
name: "Button GPIO2"
- platform: gpio
pin:
number: GPIO3
mode: INPUT_PULLUP
name: "Button GPIO3"
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
name: "Button GPIO9"
- platform: gpio
pin:
number: GPIO10
mode: INPUT_PULLUP
name: "Button GPIO10"
- platform: gpio
pin:
number: GPIO12
mode: INPUT_PULLUP
name: "Button GPIO12"
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
name: "Button GPIO13"
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
name: "Button GPIO14"