Add project files
This commit is contained in:
156
energy-meter.yaml
Normal file
156
energy-meter.yaml
Normal file
@ -0,0 +1,156 @@
|
||||
esphome:
|
||||
name: energy-meter
|
||||
friendly_name: energy-meter
|
||||
on_boot:
|
||||
- priority: 600.0
|
||||
then:
|
||||
- output.turn_off: watchdog_state
|
||||
- delay:
|
||||
seconds: 30
|
||||
- if:
|
||||
condition:
|
||||
lambda: "return !id(ota_running);"
|
||||
then:
|
||||
- output.turn_on: watchdog_state
|
||||
|
||||
esp8266:
|
||||
board: esp01_1m
|
||||
|
||||
# Stop the device from sleeping while ota is running
|
||||
globals:
|
||||
- id: ota_running
|
||||
type: bool
|
||||
initial_value: "false"
|
||||
restore_value: False
|
||||
|
||||
# Disable safe mode so the resets from
|
||||
# the Attiny watchdog don't trigger safe mode
|
||||
safe_mode:
|
||||
disabled: true
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
baud_rate: 0
|
||||
level: INFO
|
||||
|
||||
mqtt:
|
||||
discovery: true
|
||||
# Set your MQTT broker IP here!
|
||||
broker: 192.168.1.2
|
||||
birth_message: # Empty - this prevents status reporting as unavailabile in HA
|
||||
will_message: # Empty - this prevents status reporting as unavailabile in HA
|
||||
on_message:
|
||||
topic: energy-meter/sensor/current_power/state
|
||||
then:
|
||||
- delay:
|
||||
seconds: 1
|
||||
- if:
|
||||
condition:
|
||||
lambda: "return !id(ota_running);"
|
||||
then:
|
||||
- output.turn_on: watchdog_state
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
password: !secret ota_password
|
||||
on_begin:
|
||||
then:
|
||||
- globals.set:
|
||||
id: ota_running
|
||||
value: "true"
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
domain: ".lan"
|
||||
fast_connect: true
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Energy-Meter Fallback Hotspot"
|
||||
password: !secret hotspot_password
|
||||
|
||||
captive_portal:
|
||||
|
||||
web_server:
|
||||
port: 80
|
||||
|
||||
uart:
|
||||
id: uart_bus
|
||||
rx_pin:
|
||||
# RXD0 on ESP-01
|
||||
number: 3
|
||||
inverted: false
|
||||
baud_rate: 9600
|
||||
data_bits: 8
|
||||
parity: NONE
|
||||
stop_bits: 1
|
||||
debug:
|
||||
|
||||
output:
|
||||
# Communication with Attiny85 watchdog
|
||||
- platform: gpio
|
||||
id: watchdog_state
|
||||
pin:
|
||||
number: 1
|
||||
|
||||
sml:
|
||||
id: mysml
|
||||
uart_id: uart_bus
|
||||
|
||||
sensor:
|
||||
- platform: sml
|
||||
retain: False
|
||||
name: "Total energy"
|
||||
sml_id: mysml
|
||||
obis_code: "1-0:1.8.0"
|
||||
unit_of_measurement: kWh
|
||||
accuracy_decimals: 4
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
filters:
|
||||
- multiply: 0.0001
|
||||
|
||||
- platform: sml
|
||||
retain: False
|
||||
name: "Total energy (Tarif 1)"
|
||||
sml_id: mysml
|
||||
obis_code: "1-0:1.8.1"
|
||||
unit_of_measurement: kWh
|
||||
accuracy_decimals: 4
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
filters:
|
||||
- multiply: 0.0001
|
||||
|
||||
- platform: sml
|
||||
retain: False
|
||||
name: "Total energy (Tarif 2)"
|
||||
sml_id: mysml
|
||||
obis_code: "1-0:1.8.2"
|
||||
unit_of_measurement: kWh
|
||||
accuracy_decimals: 4
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
filters:
|
||||
- multiply: 0.0001
|
||||
|
||||
- platform: sml
|
||||
retain: False
|
||||
name: "Current power"
|
||||
sml_id: mysml
|
||||
obis_code: "1-0:16.7.0"
|
||||
unit_of_measurement: W
|
||||
accuracy_decimals: 4
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
|
||||
- platform: adc
|
||||
pin: VCC
|
||||
icon: "mdi:battery"
|
||||
name: "Battery Voltage"
|
||||
|
||||
# The ESP's deep sleep is not being used, but adding it
|
||||
# may prevent the device from showing as offline in Home Assistant
|
||||
deep_sleep:
|
||||
sleep_duration: 5min
|
Reference in New Issue
Block a user