generated from esphome/esphome-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhanp1.yaml
186 lines (170 loc) · 4.85 KB
/
hanp1.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
substitutions:
name: "hanp1"
friendly_name: "HanP1, Electric meter for P1/HAN port"
esphome:
name: "${name}"
# Friendly names are used where appropriate in Home Assistant
friendly_name: "${friendly_name}"
# Automatically add the mac address to the name
# so you can use a single firmware for all devices
name_add_mac_suffix: true
# This will allow for (future) project identification,
# configuration and updates.
project:
name: HanP1.electrical-meter
version: "1.0"
includes:
- p1reader.h
esp8266:
board: esp01_1m
wifi:
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "HANP1"
captive_portal:
# Enable logging
logger:
level: DEBUG
baud_rate: 0 # disable logging over uart
# Enable Home Assistant API
api:
ota:
platform: esphome
uart:
id: uart_bus
tx_pin: TX
rx_pin: RX
baud_rate: 115200
status_led:
pin: 12
output:
- platform: gpio
pin: 13
id: 'green'
- platform: gpio
pin: 14
id: 'blue'
switch:
- platform: output
name: "Green"
output: 'green'
restore_mode: ALWAYS_ON
- platform: output
name: "Blue"
output: 'blue'
sensor:
- platform: custom
lambda: |-
auto meter_sensor = new P1Reader(id(uart_bus));
App.register_component(meter_sensor);
return {
meter_sensor->cumulativeActiveImport,
meter_sensor->cumulativeActiveExport,
meter_sensor->cumulativeReactiveImport,
meter_sensor->cumulativeReactiveExport,
meter_sensor->momentaryActiveImport,
meter_sensor->momentaryActiveExport,
meter_sensor->momentaryReactiveImport,
meter_sensor->momentaryReactiveExport,
meter_sensor->momentaryActiveImportL1,
meter_sensor->momentaryActiveExportL1,
meter_sensor->momentaryActiveImportL2,
meter_sensor->momentaryActiveExportL2,
meter_sensor->momentaryActiveImportL3,
meter_sensor->momentaryActiveExportL3,
meter_sensor->momentaryReactiveImportL1,
meter_sensor->momentaryReactiveExportL1,
meter_sensor->momentaryReactiveImportL2,
meter_sensor->momentaryReactiveExportL2,
meter_sensor->momentaryReactiveImportL3,
meter_sensor->momentaryReactiveExportL3,
meter_sensor->voltageL1,
meter_sensor->voltageL2,
meter_sensor->voltageL3,
meter_sensor->currentL1,
meter_sensor->currentL2,
meter_sensor->currentL3
};
sensors:
- name: "Cumulative Active Import"
unit_of_measurement: kWh
accuracy_decimals: 3
state_class: "total_increasing"
device_class: "energy"
- name: "Cumulative Active Export"
unit_of_measurement: kWh
accuracy_decimals: 3
state_class: "total_increasing"
device_class: "energy"
- name: "Cumulative Reactive Import"
unit_of_measurement: kvarh
accuracy_decimals: 3
- name: "Cumulative Reactive Export"
unit_of_measurement: kvarh
accuracy_decimals: 3
- name: "Momentary Active Import"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Active Export"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Reactive Import"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Momentary Reactive Export"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Momentary Active Import Phase 1"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Active Export Phase 1"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Active Import Phase 2"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Active Export Phase 2"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Active Import Phase 3"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Active Export Phase 3"
unit_of_measurement: kW
accuracy_decimals: 3
- name: "Momentary Reactive Import Phase 1"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Momentary Reactive Export Phase 1"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Momentary Reactive Import Phase 2"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Momentary Reactive Export Phase 2"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Momentary Reactive Import Phase 3"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Momentary Reactive Export Phase 3"
unit_of_measurement: kvar
accuracy_decimals: 3
- name: "Voltage Phase 1"
unit_of_measurement: V
accuracy_decimals: 3
- name: "Voltage Phase 2"
unit_of_measurement: V
accuracy_decimals: 3
- name: "Voltage Phase 3"
unit_of_measurement: V
accuracy_decimals: 3
- name: "Current Phase 1"
unit_of_measurement: A
accuracy_decimals: 3
- name: "Current Phase 2"
unit_of_measurement: A
accuracy_decimals: 3
- name: "Current Phase 3"
unit_of_measurement: A
accuracy_decimals: 3