Update watchwip

up down and center press rocker works, display works, parsing json responses from home assistant works
This commit is contained in:
void 2025-03-22 03:33:14 +00:00
parent 24041448de
commit 6467dddf3d
1 changed files with 62 additions and 24 deletions

View File

@ -7,8 +7,9 @@ esphome:
esp8266: esp8266:
board: esp01_1m board: esp01_1m
# Enable logging # Enable logging with debug level
logger: logger:
level: DEBUG # Explicitly set logging level to DEBUG
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@ -27,7 +28,7 @@ wifi:
font: font:
- file: "gfonts://Bytesized" - file: "gfonts://Bytesized"
id: font1 id: font1
size: 8 size: 16
light: light:
- platform: neopixelbus - platform: neopixelbus
@ -43,6 +44,22 @@ i2c:
scl: GPIO4 # D2 scl: GPIO4 # D2
scan: true 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: display:
- platform: ssd1306_i2c - platform: ssd1306_i2c
model: "SH1106 128x64" model: "SH1106 128x64"
@ -50,32 +67,53 @@ display:
update_interval: 1s update_interval: 1s
address: 0x3C # Default I2C address for SH1106 address: 0x3C # Default I2C address for SH1106
lambda: |- lambda: |-
it.print(0, 0, id(font1), "ESPHome Watch"); // Display weather location
it.print(0, 0, id(font1), "Location: ");
it.print(0, 16, id(font1), id(weather_location).state.c_str());
# Buttons configuration // 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: binary_sensor:
- platform: gpio - platform: gpio
pin: GPIO0 # Possibly DP09, assuming GPIO0 is used pin:
name: "Button Up" number: GPIO1
on_press: mode: INPUT_PULLUP
- light.toggle: ws2812b name: "Button GPIO1"
- platform: gpio - platform: gpio
pin: GPIO2 # Possibly DP10, assuming GPIO2 is used pin:
name: "Button Down" number: GPIO2
on_press: mode: INPUT_PULLUP
- light.toggle: ws2812b name: "Button GPIO2"
- platform: gpio - platform: gpio
pin: GPIO16 # Button A (changed from GPIO4 to GPIO16) pin:
name: "Button A" number: GPIO3
on_press: mode: INPUT_PULLUP
- light.toggle: ws2812b name: "Button GPIO3"
- platform: gpio - platform: gpio
pin: GPIO12 # Side Button 1 (kept as is) pin:
name: "Side Button 1" number: GPIO9
on_press: mode: INPUT_PULLUP
- light.toggle: ws2812b name: "Button GPIO9"
- platform: gpio - platform: gpio
pin: GPIO14 # Side Button 2 (kept as is) pin:
name: "Side Button 2" number: GPIO10
on_press: mode: INPUT_PULLUP
- light.toggle: ws2812b 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"