-
Notifications
You must be signed in to change notification settings - Fork 119
/
p1reader_hdlc.yaml
185 lines (177 loc) · 5.36 KB
/
p1reader_hdlc.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
esphome:
name: esp-p1readerhdlc
platform: ESP8266
board: nodemcu
includes:
- parsed_message.h
- p1reader_base.h
- p1reader_hdlc.h
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esp-p1readerhdlc"
password: !secret fallback_password
captive_portal:
# Enable logging
logger:
level: INFO # Logging costs performnce, switch to DEBUG when needed only
baud_rate: 0 # disable logging over uart (would use up a HW uart)
esp8266_store_log_strings_in_flash: false # Avoid flash wear and tear
# Enable Home Assistant API
api:
encryption:
key: !secret encryption_key
ota:
password: !secret ota_password
uart:
id: uart_bus
tx_pin: TX
rx_pin: RX
baud_rate: 115200
rx_buffer_size: 3072 # Buffer size controls polling frequency
sensor:
- platform: custom
lambda: |-
auto meter_sensor = new P1ReaderHDLC(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
state_class: "measurement"
device_class: "power"
- name: "Momentary Active Export"
unit_of_measurement: kW
accuracy_decimals: 3
state_class: "measurement"
device_class: "power"
- 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
state_class: "measurement"
device_class: "power"
- name: "Momentary Active Export Phase 1"
unit_of_measurement: kW
accuracy_decimals: 3
state_class: "measurement"
device_class: "power"
- name: "Momentary Active Import Phase 2"
unit_of_measurement: kW
accuracy_decimals: 3
state_class: "measurement"
device_class: "power"
- name: "Momentary Active Export Phase 2"
unit_of_measurement: kW
accuracy_decimals: 3
state_class: "measurement"
device_class: "power"
- name: "Momentary Active Import Phase 3"
unit_of_measurement: kW
accuracy_decimals: 3
state_class: "measurement"
device_class: "power"
- name: "Momentary Active Export Phase 3"
unit_of_measurement: kW
accuracy_decimals: 3
state_class: "measurement"
device_class: "power"
- 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
state_class: "measurement"
device_class: "voltage"
- name: "Voltage Phase 2"
unit_of_measurement: V
accuracy_decimals: 3
state_class: "measurement"
device_class: "voltage"
- name: "Voltage Phase 3"
unit_of_measurement: V
accuracy_decimals: 3
state_class: "measurement"
device_class: "voltage"
- name: "Current Phase 1"
unit_of_measurement: A
accuracy_decimals: 3
state_class: "measurement"
device_class: "current"
- name: "Current Phase 2"
unit_of_measurement: A
accuracy_decimals: 3
state_class: "measurement"
device_class: "current"
- name: "Current Phase 3"
unit_of_measurement: A
accuracy_decimals: 3
state_class: "measurement"
device_class: "current"