Update watchwip
up down and center press rocker works, display works, parsing json responses from home assistant works
This commit is contained in:
parent
24041448de
commit
6467dddf3d
86
watchwip
86
watchwip
|
|
@ -7,8 +7,9 @@ esphome:
|
|||
esp8266:
|
||||
board: esp01_1m
|
||||
|
||||
# Enable logging
|
||||
# Enable logging with debug level
|
||||
logger:
|
||||
level: DEBUG # Explicitly set logging level to DEBUG
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
|
|
@ -27,7 +28,7 @@ wifi:
|
|||
font:
|
||||
- file: "gfonts://Bytesized"
|
||||
id: font1
|
||||
size: 8
|
||||
size: 16
|
||||
|
||||
light:
|
||||
- platform: neopixelbus
|
||||
|
|
@ -43,6 +44,22 @@ i2c:
|
|||
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"
|
||||
|
|
@ -50,32 +67,53 @@ display:
|
|||
update_interval: 1s
|
||||
address: 0x3C # Default I2C address for SH1106
|
||||
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:
|
||||
- platform: gpio
|
||||
pin: GPIO0 # Possibly DP09, assuming GPIO0 is used
|
||||
name: "Button Up"
|
||||
on_press:
|
||||
- light.toggle: ws2812b
|
||||
pin:
|
||||
number: GPIO1
|
||||
mode: INPUT_PULLUP
|
||||
name: "Button GPIO1"
|
||||
- platform: gpio
|
||||
pin: GPIO2 # Possibly DP10, assuming GPIO2 is used
|
||||
name: "Button Down"
|
||||
on_press:
|
||||
- light.toggle: ws2812b
|
||||
pin:
|
||||
number: GPIO2
|
||||
mode: INPUT_PULLUP
|
||||
name: "Button GPIO2"
|
||||
- platform: gpio
|
||||
pin: GPIO16 # Button A (changed from GPIO4 to GPIO16)
|
||||
name: "Button A"
|
||||
on_press:
|
||||
- light.toggle: ws2812b
|
||||
pin:
|
||||
number: GPIO3
|
||||
mode: INPUT_PULLUP
|
||||
name: "Button GPIO3"
|
||||
- platform: gpio
|
||||
pin: GPIO12 # Side Button 1 (kept as is)
|
||||
name: "Side Button 1"
|
||||
on_press:
|
||||
- light.toggle: ws2812b
|
||||
pin:
|
||||
number: GPIO9
|
||||
mode: INPUT_PULLUP
|
||||
name: "Button GPIO9"
|
||||
- platform: gpio
|
||||
pin: GPIO14 # Side Button 2 (kept as is)
|
||||
name: "Side Button 2"
|
||||
on_press:
|
||||
- light.toggle: ws2812b
|
||||
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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue