Skip to content

Instantly share code, notes, and snippets.

@greghesp
Created January 20, 2023 21:17
Show Gist options
  • Save greghesp/4cf5ce17b6021196bce05e35a7a47976 to your computer and use it in GitHub Desktop.
Save greghesp/4cf5ce17b6021196bce05e35a7a47976 to your computer and use it in GitHub Desktop.
esphome:
name: living-room-display
esp8266:
board: d1_mini
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret 24_wifi_ssid
password: !secret wifi_password
captive_portal:
time:
- platform: homeassistant
id: esptime
sensor:
- platform: homeassistant
id: glucose_level
entity_id: sensor.dexcom_glucose_value
- platform: homeassistant
id: current_temp
entity_id: climate.linnea_heater
attribute: current_temperature
- platform: homeassistant
id: target_temp
entity_id: climate.linnea_heater
attribute: temperature
text_sensor:
- platform: homeassistant
id: glucose_trend
entity_id: sensor.dexcom_glucose_trend
- platform: homeassistant
id: linnea_status
entity_id: climate.linnea_heater
font:
- file: "gfonts://Roboto"
id: levels
size: 38
- file: "gfonts://Roboto"
id: mmol
size: 18
- file: "gfonts://Roboto"
id: trend
size: 14
i2c:
sda: D6
scl: D5
scan: true
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
reset_pin: GPIO0
address: 0x3C
id: my_display
pages:
- id: page1
lambda: |-
it.printf(0, 0, id(levels), TextAlign::TOP_LEFT , "%.1f", id(glucose_level).state);
it.printf(80, 20, id(mmol), "mmol");
it.printf(0, 45, id(trend), "%s", id(glucose_trend).state.c_str());
# - id: page2
# lambda: |-
# it.printf(0, 0, id(levels), TextAlign::TOP_LEFT , "%i °C", id(target_temp));
# it.printf(80, 20, id(mmol),"%s", id(linnea_status).state.c_str());
# it.printf(0, 45, id(trend), "Currently %i °C", id(current_temp));
# on_...:
# - display.page.show_next: my_display
# - display.page.show_previous: my_display
# For example cycle through pages on a timer
# interval:
# - interval: 5s
# then:
# - display.page.show_next: my_display
# - component.update: my_display
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment