Skip to content

Instantly share code, notes, and snippets.

@crossan007
Created June 1, 2022 15:23
Show Gist options
  • Save crossan007/2897419290fb0de779b0a773464f64ab to your computer and use it in GitHub Desktop.
Save crossan007/2897419290fb0de779b0a773464f64ab to your computer and use it in GitHub Desktop.
oreo_watch.yaml
substitutions:
devicename: clock
upper_devicename: clock
time:
- platform: homeassistant
id: esptime
sensor:
- platform: homeassistant
id: inside_temperature
entity_id: sensor.charles_office_temperature
internal: true
- platform: homeassistant
id: outside_temperature
entity_id: sensor.kukt_temperature
internal: true
# Example configuration entry
i2c:
sda: 22
scl: 21
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3c
lambda: |-
// Print "Mitt Smarta Hus" in top center.
it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Oreo Watch");
// Print time in HH:MM format
it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());
// Print inside temperature (from homeassistant sensor)
if (id(inside_temperature).has_state()) {
it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state);
}
// Print outside temperature (from homeassistant sensor)
if (id(outside_temperature).has_state()) {
it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state);
}
font:
- file: 'C:\Users\Charles\Documents\GitHub\ESPHome Configurations\times.ttf'
id: font1
size: 10
- file: 'C:\Users\Charles\Documents\GitHub\ESPHome Configurations\times.ttf'
id: font2
size: 40
- file: 'C:\Users\Charles\Documents\GitHub\ESPHome Configurations\times.ttf'
id: font3
size: 14
<<: !include base_charles.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment