forked from afarago/dsmr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slimmelezer.yaml
238 lines (218 loc) · 6.99 KB
/
slimmelezer.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
---
substitutions:
device_name: "slimmelezer"
device_friendly_name: "SlimmeLezer"
device_description: "DIY P1 module to read your smart meter"
esphome:
name: "${device_name}"
comment: "${device_description}"
platform: ESP8266
esp8266_restore_from_flash: true
board: d1_mini
name_add_mac_suffix: false
project:
name: zuidwijk.slimmelezer
version: "2.0"
# on_boot:
# then:
# - if:
# condition:
# lambda: return id(has_key);
# then:
# - lambda: |-
# std::string key(id(stored_decryption_key), 32);
# id(dsmr_instance).set_decryption_key(key);
# else:
# - logger.log:
# level: info
# format: "Not using decryption key. If you need to set a key use Home Assistant service 'ESPHome: ${device_name}_set_dsmr_key'"
external_components:
- source: components
components: [dsmr]
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${device_name}
# improv_serial:
# captive_portal:
# Enable logging
logger:
baud_rate: 0
level: INFO
# logs:
# api: INFO
# api.service: INFO
# sensor: DEBUG
# text_sensor: DEBUG
# esphome: INFO
# ota: INFO
# wifi: INFO
# captive_portal: INFO
# web_server: INFO
# uart: INFO
# scheduler: INFO
# Enable Home Assistant API
api:
# services:
# service: set_dsmr_key
# variables:
# private_key: string
# then:
# - logger.log:
# format: Setting private key %s. Set to empty string to disable
# args: [private_key.c_str()]
# - globals.set:
# id: has_key
# value: !lambda "return private_key.length() == 32;"
# - lambda: |-
# if (private_key.length() == 32)
# private_key.copy(id(stored_decryption_key), 32);
# id(dsmr_instance).set_decryption_key(private_key);
ota:
password: !secret ota_password
safe_mode: yes
# dashboard_import:
# package_import_url: github://zuidwijk/dsmr/slimmelezer.yaml
web_server:
port: 80
uart:
baud_rate: 115200
rx_pin: D7
rx_buffer_size: 1500
# globals:
# - id: has_key
# type: bool
# restore_value: yes
# initial_value: "false"
# - id: stored_decryption_key
# type: char[32]
# restore_value: yes
dsmr:
id: dsmr_instance
# For Luxembourg users set here your decryption key
#decryption_key: !secret decryption_key // enable this when using decryption for Luxembourg; key like '00112233445566778899AABBCCDDEEFF'
crc_check: false
max_telegram_length: 3000
sensor:
- platform: dsmr
energy_delivered:
name: "${device_friendly_name} Energy Consumed"
energy_delivered_tariff1:
name: "${device_friendly_name} Energy Consumed Tariff 1"
energy_delivered_tariff2:
name: "${device_friendly_name} Energy Consumed Tariff 2"
energy_returned:
name: "${device_friendly_name} Energy Produced"
energy_returned_tariff1:
name: "${device_friendly_name} Energy Produced Tariff 1"
energy_returned_tariff2:
name: "${device_friendly_name} Energy Produced Tariff 2"
power_delivered:
name: "${device_friendly_name} Power Consumed"
id: power_consumed
on_value:
- script.execute: update_power_balance
power_returned:
name: "${device_friendly_name} Power Produced"
id: power_produced
on_value:
- script.execute: update_power_balance
# electricity_failures:
# name: "Electricity Failures"
# icon: mdi:alert
# electricity_long_failures:
# name: "Long Electricity Failures"
# icon: mdi:alert
voltage_l1:
name: "${device_friendly_name} Voltage Phase 1"
voltage_l2:
name: "${device_friendly_name} Voltage Phase 2"
voltage_l3:
name: "${device_friendly_name} Voltage Phase 3"
current_l1:
name: "${device_friendly_name} Current Phase 1"
current_l2:
name: "${device_friendly_name} Current Phase 2"
current_l3:
name: "${device_friendly_name} Current Phase 3"
electricity_threshold:
name: "${device_friendly_name} Electricity Threshold"
electricity_tariff:
name: "${device_friendly_name} Electricity Tariff"
# reactive_power_qi:
# name: "${device_friendly_name} Reactive Power QI"
# reactive_power_qii:
# name: "${device_friendly_name} Reactive Power QII"
# reactive_power_qiii:
# name: "${device_friendly_name} Reactive Power QIII"
# reactive_power_qiv:
# name: "${device_friendly_name} Reactive Power QIV"
# reactive_energy_qi:
# name: "${device_friendly_name} Reactive Energy QI"
# reactive_energy_qii:
# name: "${device_friendly_name} Reactive Energy QII"
# reactive_energy_qiii:
# name: "${device_friendly_name} Reactive Energy QIII"
# reactive_energy_qiv:
# name: "${device_friendly_name} Reactive Energy QIV"
# instantaneous_power_factor:
# name: "${device_friendly_name} Instantaneous Power Factor"
# instantaneous_power_factor_l1:
# name: "${device_friendly_name} Instantaneous Power Factor Phase 1"
# instantaneous_power_factor_l2:
# name: "${device_friendly_name} Instantaneous Power Factor Phase 2"
# instantaneous_power_factor_l3:
# name: "${device_friendly_name} Instantaneous Power Factor Phase 3"
frequency:
name: "${device_friendly_name} Frequency"
# absolute_active_energy:
# name: "${device_friendly_name} Absolute active energy"
- platform: uptime
name: "${device_friendly_name} Uptime"
- platform: wifi_signal
name: "${device_friendly_name} Wi-Fi RSSI Signal"
update_interval: 60s
- platform: template
name: "${device_friendly_name} Power Balance"
id: power_balance
unit_of_measurement: kW
state_class: measurement
device_class: power
accuracy_decimals: 3
text_sensor:
- platform: dsmr
identification:
name: "${device_friendly_name} Identification"
# p1_version:
# name: "${device_friendly_name} Version"
# p1_version_be:
# name: "${device_friendly_name} Version Belgium"
# message_short:
# name: "${device_friendly_name} Message Short"
# message_long: ### CRC problem - results in hardware dump
# name: "${device_friendly_name} Message Long"
# equipment_id:
# name: "${device_friendly_name} Equipment Id"
# equipment_name:
# name: "DSMR equipment Name"
breaker_status:
name: "${device_friendly_name} Breaker Status"
- platform: wifi_info
ip_address:
name: "${device_friendly_name} IP Address"
ssid:
name: "${device_friendly_name} Wi-Fi SSID"
bssid:
name: "${device_friendly_name} Wi-Fi BSSID"
# - platform: version
# name: "${device_friendly_name} ESPHome Version"
# hide_timestamp: true
script:
- id: update_power_balance
mode: single
then:
- lambda: |-
id(power_balance).publish_state(id(power_produced).state-id(power_consumed).state);