Last active
November 11, 2024 19:14
-
-
Save tkroo/0dfe582ab3b4ba83cbd918e4b5502045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/tkroo/0dfe582ab3b4ba83cbd918e4b5502045 | |
substitutions: | |
name: esphome-web-d00834 | |
friendly_name: supermini-temp-display | |
esphome: | |
name: ${name} | |
friendly_name: ${friendly_name} | |
comment: Temperature and humidity with display | |
min_version: 2024.6.0 | |
name_add_mac_suffix: false | |
project: | |
name: esphome.web | |
version: dev | |
on_boot: | |
priority: -100 | |
then: | |
- logger.log: "setting update interval" | |
- component.update: shtcx_sensor | |
- delay: 2s | |
- component.resume: | |
id: shtcx_sensor | |
update_interval: !lambda |- | |
int foo = id(my_update_interval).state*60000; | |
return foo; | |
esp32: | |
board: esp32-c3-devkitm-1 | |
framework: | |
type: arduino | |
logger: | |
api: | |
ota: | |
- platform: esphome | |
improv_serial: | |
wifi: | |
output_power: 12.5 | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
dashboard_import: | |
package_import_url: github://esphome/firmware/esphome-web/esp32c3.yaml@main | |
import_full_config: true | |
i2c: | |
sda: 8 | |
scl: 9 | |
scan: true | |
id: bus_a | |
frequency: 400kHz | |
sensor: | |
- platform: shtcx | |
id: shtcx_sensor | |
address: 0x70 | |
temperature: | |
id: "temp" | |
name: "Temperature" | |
humidity: | |
id: "hum" | |
name: "Humidity" | |
update_interval: 60s | |
number: | |
- platform: template | |
id: my_update_interval | |
name: "update interval in minutes" | |
optimistic: true | |
min_value: 0 | |
max_value: 9999 | |
restore_value: true | |
step: 1 | |
initial_value: "60" | |
on_value: | |
then: | |
- component.resume: | |
id: shtcx_sensor | |
update_interval: !lambda |- | |
int foo = id(my_update_interval).state*60000; | |
return foo; | |
button: | |
- platform: restart | |
name: "Restart Device" | |
id: restart_button | |
- platform: factory_reset | |
name: "Restart with Default Settings" | |
id: reset_button | |
text: | |
- platform: template | |
id: template_text | |
name: "Template text" | |
optimistic: true | |
min_length: 0 | |
max_length: 18 | |
mode: text | |
restore_value: true | |
initial_value: "REPORTING" | |
font: | |
- file: "gfonts://Roboto" | |
id: roboto_12 | |
size: 12 | |
display: | |
- platform: ssd1306_i2c | |
model: "SSD1306 128x64" | |
address: 0x3C | |
lambda: |- | |
if (id(shtcx_sensor) == id(shtcx_sensor)) { | |
it.printf(0, 0, id(roboto_12), "%s", id(template_text).state.c_str()); | |
it.printf(0, 16, id(roboto_12), "Temp: %.1f F", id(temp).state * (9.0/5.0) + 32.0); | |
it.printf(0, 32, id(roboto_12), "Humi: %.1f %%", id(hum).state); | |
it.printf(0, 48, id(roboto_12), "upate every %g min", id(my_update_interval).state); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment