Skip to content

Instantly share code, notes, and snippets.

@tkroo
Created November 2, 2024 05:12
Show Gist options
  • Select an option

  • Save tkroo/1e019a6d0e08505926902a508b3300ee to your computer and use it in GitHub Desktop.

Select an option

Save tkroo/1e019a6d0e08505926902a508b3300ee to your computer and use it in GitHub Desktop.
esphome shtcx update interval from number
substitutions:
name: esphome-web-fbb8e8
friendly_name: mini32-shtc3
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
project:
name: esphome.web
version: dev
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
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
# 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/example-configs/esphome-web/esp32.yaml@main
import_full_config: true
# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
# esp32_improv:
# authorizer: none
# To have a "next url" for improv serial
# web_server:
globals:
- id: my_global
type: float
restore_value: false
initial_value: "15.0"
i2c:
sda: 21
scl: 22
scan: true
id: bus_a
number:
- platform: template
id: my_interval
name: "Update Interval"
min_value: 1
max_value: 28800
step: 1
optimistic: true
restore_value: true
initial_value: 15.0
on_value:
then:
- lambda: |-
id(my_global) = float(x);
sensor:
- platform: shtcx
temperature:
name: "Temperature"
humidity:
name: "Humidity"
update_interval:
seconds:
- lambda: return parse_float(id(my_global));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment