-
Notifications
You must be signed in to change notification settings - Fork 16
/
smartmeter.yaml
120 lines (109 loc) · 2.26 KB
/
smartmeter.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
---
substitutions:
device: smartmeter
name: Smartmeter
location: Meterkast
reboot_timeout: 1h
update_interval: 10min
esphome:
name: ${device}
<<: !include common/common.yaml
<<: !include common/logger.yaml
status_led:
pin:
number: D4
inverted: true
i2c:
sda: D2
scl: D1
esp8266:
board: d1_mini_pro
restore_from_flash: true
preferences:
flash_write_interval: ${update_interval}
globals:
- id: total_Wh
type: int
restore_value: true
- id: chime
type: bool
restore_value: true
script:
- id: ring
mode: restart
then:
if:
condition:
- switch.is_on: chime_active
then:
- switch.turn_on: relay
- delay: 300ms
- switch.turn_off: relay
sensor:
- !include common/sensor/wifi-signal.yaml
- !include common/sensor/uptime.yaml
- !include common/sensor/bme280.yaml
- platform: pulse_meter
pin: D6
unit_of_measurement: kW
name: ${name} Power Consumption
state_class: measurement
device_class: power
accuracy_decimals: 3
internal_filter: 200ms
filters:
- multiply: 0.06
on_raw_value:
then:
- lambda: |-
id(total_Wh) += 1;
- platform: template
name: ${name} Total Consumption
unit_of_measurement: kWh
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
- multiply: 0.001
lambda: |-
return id(total_Wh);
update_interval: ${update_interval}
switch:
- !include common/switch/restart.yaml
- platform: gpio
id: relay
name: Gong
icon: mdi:alarm-bell
pin:
number: D7
inverted: true
- platform: template
name: Deurbel actief
icon: mdi:doorbell
id: chime_active
turn_on_action:
- globals.set:
id: chime
value: 'true'
turn_off_action:
- globals.set:
id: chime
value: 'false'
lambda: |-
return id(chime);
binary_sensor:
- !include common/binary_sensor/status.yaml
- platform: gpio
id: button
name: Deurbel
pin:
number: D5
mode: INPUT_PULLUP
inverted: true
filters:
- delayed_on: 10ms
- delayed_off: 100ms
on_press:
- script.execute: ring
on_release:
- switch.turn_off: relay