Skip to content

Instantly share code, notes, and snippets.

@nikdoof
Created March 17, 2023 10:28
Show Gist options
  • Save nikdoof/3a4adf72acc933a82651b74b8682c2d9 to your computer and use it in GitHub Desktop.
Save nikdoof/3a4adf72acc933a82651b74b8682c2d9 to your computer and use it in GitHub Desktop.
ESPHome Config for a VINDRIKTNING modified with a ESP8266
esphome:
name: "${devicename}"
comment: "${device_description}"
build_path: "${devicename}"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: !secret wifi_domain
fast_connect: true
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${friendly_name}"
password: !secret ap_password
api:
captive_portal:
# Enable logging
logger:
ota:
password: !secret ota_password
# Enable Web server
web_server:
port: 80
prometheus:
time:
- platform: sntp
id: sntp_time
timezone: UTC
servers:
- 10.105.1.1
text_sensor:
- platform: version
name: "ESPHome Version"
sensor:
- platform: wifi_signal
name: "${friendly_name} WiFi Signal"
update_interval: 60s
- platform: uptime
name: "${friendly_name} Uptime"
- platform: total_daily_energy
name: "${friendly_name} kWh"
power_id: power_consumption_watt
filters:
- multiply: 0.001
unit_of_measurement: kWh
binary_sensor:
- platform: status
name: "${friendly_name} Status"
switch:
- platform: restart
name: "${friendly_name} Restart"
interval:
- interval: 1min
then:
- sensor.template.publish:
id: power_consumption_watt
state: $power_consumption
sensor:
- platform: template
name: "${friendly_name} Power Usage"
id: power_consumption_watt
device_class: power
state_class: measurement
unit_of_measurement: W
accuracy_decimals: 4
filters:
- heartbeat: 60s
substitutions:
devicename: bedroom_air_quality
friendly_name: Bedroom Air Quality
device_description: Bedroom AQ Monitor
power_consumption: "0.5696"
esphome:
name: "${devicename}"
platform: ESP8266
board: d1
comment: "${device_description}"
packages:
common: !include include/common.yaml
static_power: !include include/static_power_consumption.yaml
uart:
rx_pin: GPIO02
baud_rate: 9600
sensor:
- platform: pm1006
pm_2_5:
name: "${friendly_name} PM2.5"
accuracy_decimals: 2
filters:
- sliding_window_moving_average:
window_size: 50
send_every: 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment