Hey friends,
I made a tiny Home Assistant dashboard with an OLED, ESP32, custom PCB and 3D printed enclosure. All running ESPHome. It displays:
- Last motion
- Number of lights on
- Average house temperature
- Any open window
- Coffee Maker on/off
- Mail having been delivered
- Washing machine on/off
- Vacuum state
esphome:
name: esp_test
platform: ESP32
board: esp-wrover-kit
wifi:
ssid: "SSID"
password: "PWD"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp Test Fallback Hotspot"
password: "PWDHere"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
text_sensor:
- platform: homeassistant
name: "Mailbox Status"
entity_id: sensor.mail_status
id: mailbox_status
internal: true
- platform: template
name: "Template Text Sensor"
id: template_text
internal: true
- platform: template
name: "Template Text Sensor 2"
id: template_text2
internal: true
- platform: homeassistant
name: "Vacuum Status"
entity_id: vacuum.xiaomi_vacuum_cleaner
id: vacuum_status
on_value:
- if:
condition:
text_sensor.state:
id: vacuum_status
state: 'docked'
then:
- text_sensor.template.publish:
id: template_text2
state: "Docked"
- if:
condition:
text_sensor.state:
id: vacuum_status
state: 'cleaning'
then:
- text_sensor.template.publish:
id: template_text2
state: "Clean"
- if:
condition:
text_sensor.state:
id: vacuum_status
state: 'idle'
then:
- text_sensor.template.publish:
id: template_text2
state: "Idle"
internal: true
- platform: homeassistant
name: "Last Motion"
entity_id: sensor.last_motion
id: last_motion
on_value:
- if:
condition:
text_sensor.state:
id: last_motion
state: 'Office Motion Sensor'
then:
- text_sensor.template.publish:
id: template_text
state: "Office"
- if:
condition:
text_sensor.state:
id: last_motion
state: 'Hallway Motion Sensor'
then:
- text_sensor.template.publish:
id: template_text
state: "Hallway"
- if:
condition:
text_sensor.state:
id: last_motion
state: 'Kids Room Motion Sensor'
then:
- text_sensor.template.publish:
id: template_text
state: "Kids"
- if:
condition:
text_sensor.state:
id: last_motion
state: 'Kitchen Motion Sensor'
then:
- text_sensor.template.publish:
id: template_text
state: "Kitchen"
- if:
condition:
text_sensor.state:
id: last_motion
state: 'Living Room Motion Sensor'
then:
- text_sensor.template.publish:
id: template_text
state: "Living"
- if:
condition:
text_sensor.state:
id: last_motion
state: 'Bathroom Motion Sensor'
then:
- text_sensor.template.publish:
id: template_text
state: "Bath"
internal: true
sensor:
- platform: homeassistant
name: "Number of lights on"
entity_id: sensor.total_lights_on
id: total_lights_on
internal: true
- platform: homeassistant
name: "House Temperature"
entity_id: sensor.average_temperature
id: average_temperature
internal: true
binary_sensor:
- platform: homeassistant
name: "Any window open"
entity_id: binary_sensor.any_open_window
id: any_open_window
internal: true
- platform: homeassistant
name: "Coffee Maker State"
entity_id: input_boolean.coffee_maker_state
id: coffee_maker_state
internal: true
- platform: homeassistant
name: "Washing Machine State"
entity_id: input_boolean.washing_machine_state
id: washing_machine_state
internal: true
font:
- file: "dealer.ttf"
id: bigFont
size: 60
- file: "arial.ttf"
id: smallFont
size: 12
- file: 'materialdesignicons-webfont.ttf'
id: icon
size: 12
glyphs:
- "\U000F070E" # mdi-run
- "\U000F0335" # mdi-lightbulb
- "\U000F050F" # mdi-thermometer
- "\U000F05AE" # mdi-window-close
- "\U000F0176" # mdi-coffee
- "\U000F01EE" # mdi-email
- "\U000F072A" # mdi-washing-machine
- "\U000F070D" # mdi-robot-vacuum
i2c:
sda: 27
scl: 25
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: my_display
lambda: |-
it.print(0, 0, id(icon), TextAlign::LEFT, "\U000F070E");
it.printf(15, 0, id(smallFont), "%s", id(template_text).state.c_str());
it.print(0, 16, id(icon), TextAlign::LEFT, "\U000F0335");
it.printf(15, 16, id(smallFont), "%.0f", id(total_lights_on).state);
it.print(0, 32, id(icon), TextAlign::LEFT, "\U000F050F");
it.printf(15, 32, id(smallFont), "%.1f", id(average_temperature).state);
it.print(0, 48, id(icon), TextAlign::LEFT, "\U000F05AE");
it.printf(15, 48, id(smallFont), "%s", id(any_open_window).state ? "Open" : "Closed");
it.print(70, 0, id(icon), TextAlign::LEFT, "\U000F0176");
it.printf(87, 0, id(smallFont), "%s", id(coffee_maker_state).state ? "On" : "Off");
it.print(70, 16, id(icon), TextAlign::LEFT, "\U000F01EE");
it.printf(87, 16, id(smallFont), "%s", id(mailbox_status).state.c_str());
it.print(70, 32, id(icon), TextAlign::LEFT, "\U000F072A");
it.printf(87, 32, id(smallFont), "%s", id(washing_machine_state).state ? "On" : "Off");
it.print(70, 48, id(icon), TextAlign::LEFT, "\U000F070D");
it.printf(87, 48, id(smallFont), "%s", id(template_text2).state.c_str());