forked from klaasnicolaas/home-assistant-glow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
home_assistant_glow.yaml
120 lines (107 loc) · 2.63 KB
/
home_assistant_glow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
# Home Assistant Glow
#
# Read your electricity meter by means of the pulse LED on your
# meter, useful if you do not have a serial port (P1).
#
substitutions:
device_name: home_assistant_glow
friendly_name: House
device_description: "Measure your energy consumption with the pulse LED on your smart meter"
pulse_pin: GPIO12
status_led: GPIO5
# imp/kWh rate ⬇ #
pulse_rate: '1000'
esphome:
name: '${device_name}'
comment: '${device_description}'
project:
name: "klaasnicolaas.home_assistant_glow"
version: "1.2.0"
platform: ESP32
board: nodemcu-32s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: '${device_name}'
password: !secret fallback_password
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret esphome_api_password
ota:
safe_mode: true
reboot_timeout: 10min
num_attempts: 5
web_server:
port: 80
auth:
username: !secret esphome_web_username
password: !secret esphome_web_password
output:
# - platform: gpio
# pin: GPIO5
# id: output_blue
- platform: gpio
pin: GPIO2
id: output_red
- platform: gpio
pin: GPIO4
id: output_green
light:
- platform: binary
internal: true
id: led_red
name: Red
output: output_red
# Status LED for connection
status_led:
pin:
# Blue LED
number: ${status_led}
# Sensors for ESP version and WIFI information
text_sensor:
- platform: version
hide_timestamp: true
name: "${friendly_name} - ESPHome Version"
- platform: wifi_info
ip_address:
name: "${friendly_name} - IP Address"
icon: mdi:wifi
ssid:
name: "${friendly_name} - Connected SSID"
icon: mdi:wifi-strength-2
sensor:
- platform: pulse_meter
name: '${friendly_name} - Power consumption'
unit_of_measurement: 'W'
state_class: measurement
device_class: power
icon: mdi:flash-outline
accuracy_decimals: 0
pin: ${pulse_pin}
on_value:
then:
- light.turn_on:
id: led_red
flash_length: 400ms
filters:
# multiply value = (60 / imp value) * 1000
# - multiply: 60
- lambda: return x * ((60.0 / ${pulse_rate}) * 1000.0);
total:
name: '${friendly_name} - Total energy'
unit_of_measurement: 'kWh'
icon: mdi:circle-slice-3
last_reset_type: auto
state_class: measurement
device_class: energy
accuracy_decimals: 3
filters:
# multiply value = 1 / imp value
# - multiply: 0.001
- lambda: return x * (1.0 / ${pulse_rate});