EspHome Sensor Box
Print Profile(1)

Description
Temperature and Humidity EspHome Sensor box.
Parts used:
ESP32 S2 Mini (with PSRAM)
SSD1306 lcd 128x64
AHT20 BMP280 Sensor
Boost Me (for free)
Want to help keep sharing this projects, give me a boost :)
##### EspHome Template ######
substitutions:
name: esp-temperature-sensor2
friendly_name: "ESP Temperature Sensor 2"
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
platformio_options:
board_build.flash_mode: dio
project:
name: esphome.web
version: dev
esp32:
board: esp32-s2-saola-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API and failsafe mechanisms
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
#fast_connect: true
# Enable fallback hotspot (captive portal) in case wifi connection fails, using your wifi's password
ap:
ssid: "EspTempSensor"
password: !secret wifi_password
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/firmware/esphome-web/esp32s2.yaml@main
import_full_config: true
# To have a "next url" for improv serial
web_server:
debug:
update_interval: 5s
font:
- file: 'gfonts://Rubik@300'
id: font_small
size: 16
- file: 'gfonts://Rubik@300'
id: font_large
size: 20
- file: 'materialdesignicons-webfont.ttf'
id: weather_icons
size: 20
glyphs:
- "\U000F0594" #"clear-night"
- "\U000F0590" #"cloudy"
- "\U000F0591" #"fog"
- "\U000F0592" #"hail"
- "\U000F0593" #"lightning"
- "\U000F067E" #"lightning-rainy"
- "\U000F0595" #"partlycloudy"
- "\U000F0596" #"pouring"
- "\U000F0597" #"rainy"
- "\U000F0598" #"snowy"
- "\U000F067F" #"snowy-rainy"
- "\U000F0599" #"sunny"
- "\U000F059D" #"windy"
- "\U000F059E" #"windy-variant"
- "\U000F050F" #"thermometer"
- file: 'materialdesignicons-webfont.ttf'
id: sensor_icons
size: 20
glyphs:
- "\U000F050F" #"thermometer"
- "\U000F058C" #"water"
- "\U000F07E4" #"CO2"
- "\U000F005C" #"arrow-top-right"
- "\U000F0043" #"arrow-bottom-right"
- "\U000F0054" #"arrow-right"
color:
- id: white
hex: FFFFFF
- id: grey
hex: AAAAAA
- id: light_grey
hex: CCCCCC
- id: yellow
hex: FFFA72
- id: orange
hex: FF9C32
- id: red
hex: FF1616
- id: purple
hex: FF16e0
display:
- platform: ssd1306_i2c
i2c_id: i2c_2
model: "SSD1306 128x64"
address: 0x3C
update_interval: 10s
rotation: 180°
lambda: |-
// Display weather condition icon top center
if (id(weather_condition).has_state()) {
std::map<std::string, std::string> weather_icon_map
{
{"clear-night", "\U000F0594"},
{"cloudy", "\U000F0590"},
{"fog", "\U000F0591"},
{"hail", "\U000F0592"},
{"lightning", "\U000F0593"},
{"lightning-rainy", "\U000F067E"},
{"partlycloudy", "\U000F0595"},
{"pouring", "\U000F0596"},
{"rainy", "\U000F0597"},
{"snowy", "\U000F0598"},
{"snowy-rainy", "\U000F067F"},
{"sunny", "\U000F0599"},
{"windy", "\U000F059D"},
{"windy-variant", "\U000F059E"},
};
it.printf(80, 0, id(weather_icons), TextAlign::TOP_CENTER, weather_icon_map[id(weather_condition).state.c_str()].c_str());
}
// Print time in HH:MM format top left
it.strftime(0, 0, id(font_small), TextAlign::TOP_LEFT, "%H:%M", id(esptime).now());
// Print outside temperature top right
it.printf(it.get_width(), 0, id(font_small), TextAlign::TOP_RIGHT, "%.0f°", id(outside_temperature).state);
// Draw horizontal line
it.line(0, 20, it.get_width(), 20);
it.printf(0, 25, id(sensor_icons), TextAlign::LEFT, "\U000F050F");
it.printf(128, 25, id(font_small), TextAlign::RIGHT, "%.1f°C", id(temp_aht20).state);
it.printf(0, 45, id(sensor_icons), TextAlign::LEFT, "\U000F058C");
it.printf(128, 45, id(font_small), TextAlign::RIGHT, "%.1f%%", id(hum_aht20).state);
i2c:
- sda: GPIO08
scl: GPIO09
scan: true
id: i2c_2
- sda: GPIO16
scl: GPIO17
scan: true
id: i2c_main
time:
- platform: homeassistant
id: esptime
text_sensor:
- platform: homeassistant
id: weather_condition
entity_id: weather.forecast_home
internal: true
sensor:
- platform: homeassistant
id: outside_temperature
entity_id: weather.forecast_home
attribute: temperature
internal: true
- platform: aht10
#address: 0x38
i2c_id: i2c_main
variant: AHT20
temperature:
name: "AHT20 Temperature"
id: temp_aht20
humidity:
name: "AHT20 Humidity"
id: hum_aht20
update_interval: 10s
License
You shall not share, sub-license, sell, rent, host, transfer, or distribute in any way the digital or 3D printed versions of this object, nor any other derivative work of this object in its digital or physical format (including - but not limited to - remixes of this object, and hosting on other digital platforms). The objects may not be used without permission in any way whatsoever in which you charge money, or collect fees.






Comment & Rating (1)