-
Notifications
You must be signed in to change notification settings - Fork 1
/
ferraris_meter_multi.yaml
182 lines (165 loc) · 5.42 KB
/
ferraris_meter_multi.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
# This is an example configuration for an ESPHome firmware to measure the
# current power and overall energy consumption using a Ferraris electricity
# meter
# In this variant, the configuration to observe multiple Ferraris electricity
# meters with a single ESP microcontroller is demonstrated.
# generic configuration (to be adapted)
esphome:
name: ferraris-meter
friendly_name: Stromzähler
project:
name: jensrossbach.ferraris_meter
version: 1.4.1
# example ESP8266 firmware (can be replaced by appropriate configuration)
esp8266:
board: esp01_1m
# include Ferraris component (mandatory)
external_components:
- source: github://jensrossbach/[email protected]
components: [ferraris]
# enable logging (optional)
logger:
level: INFO
# enable Home Assistant API (mandatory if used with Home Assistant, alternatively configure MQTT)
api:
encryption:
key: !secret ha_api_key
# enable over-the-air updates (recommended)
ota:
- platform: esphome
password: !secret ota_password
# enable Wi-Fi (mandatory)
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# enable fallback hotspot (captive portal) in case Wi-Fi connection fails
ap:
ssid: Ferraris Meter Fallback Hotspot
password: !secret fallback_hs_password
# needed for fallback hotspot (see above)
captive_portal:
# Ferraris component (mandatory)
ferraris:
- id: ferraris_meter_1
digital_input: GPIO4
rotations_per_kwh: 75
energy_start_value: last_energy_value_1
- id: ferraris_meter_1
digital_input: GPIO5
rotations_per_kwh: 100
energy_start_value: last_energy_value_2
# numeric sensors
sensor:
- platform: ferraris
ferraris_id: ferraris_meter_1
# sensor for current power consumption of first electricity meter
power_consumption:
name: Momentanverbrauch 1
# sensor for energy meter reading of first electricity meter
energy_meter:
name: Verbrauchszähler 1
- platform: ferraris
ferraris_id: ferraris_meter_2
# sensor for current power consumption of second electricity meter
power_consumption:
name: Momentanverbrauch 2
# sensor for energy meter reading of second electricity meter
energy_meter:
name: Verbrauchszähler 2
# sensor for Wi-Fi signal strength
- platform: wifi_signal
name: Wi-Fi Signal
update_interval: 60s
# binary sensors
binary_sensor:
- platform: ferraris
ferraris_id: ferraris_meter_1
# sensor for indicating detected rotation on first elecricity meter during calibration mode
rotation_indicator:
name: Umdrehungsindikator 1
- platform: ferraris
ferraris_id: ferraris_meter_2
# sensor for indicating detected rotation on second elecricity meter during calibration mode
rotation_indicator:
name: Umdrehungsindikator 2
# sensor for wireless connection status
- platform: status
name: Status
# text sensors
text_sensor:
- platform: wifi_info
# sensor providing the IP address of the ESP microcontroller
ip_address:
name: IP Adresse
# number components
number:
# import entity holding last energy meter reading of first elecricity meter from Home Assistant
- platform: homeassistant
id: last_energy_value_1
entity_id: input_number.stromzaehler_1_letzter_wert
# import entity holding last energy meter reading of second elecricity meter from Home Assistant
- platform: homeassistant
id: last_energy_value_2
entity_id: input_number.stromzaehler_2_letzter_wert
# number used to manually overwrite the energy meter of first electricity meter
- platform: template
id: target_energy_value_1
name: Manueller Zählerstand 1
icon: mdi:counter
unit_of_measurement: kWh
device_class: energy
entity_category: config
mode: box
optimistic: true
min_value: 0
max_value: 1000000
step: 0.01
# number used to manually overwrite the energy meter of second electricity meter
- platform: template
id: target_energy_value_2
name: Manueller Zählerstand 2
icon: mdi:counter
unit_of_measurement: kWh
device_class: energy
entity_category: config
mode: box
optimistic: true
min_value: 0
max_value: 1000000
step: 0.01
# switch components
switch:
- platform: ferraris
ferraris_id: ferraris_meter_1
# switch used to activate or deactivate the calibration mode for first electricity meter
calibration_mode:
name: Kalibrierungsmodus 1
- platform: ferraris
ferraris_id: ferraris_meter_2
# switch used to activate or deactivate the calibration mode for second electricity meter
calibration_mode:
name: Kalibrierungsmodus 2
# button components
button:
# button used to trigger the manual overwriting of the energy meter of first electricity meter
- platform: template
name: Verbrauchszähler 1 überschreiben
icon: mdi:download
entity_category: config
on_press:
- ferraris.set_energy_meter:
id: ferraris_meter_1
value: !lambda |-
float val = id(target_energy_value_1).state;
return (val >= 0) ? val : 0;
# button used to trigger the manual overwriting of the energy meter of second electricity meter
- platform: template
name: Verbrauchszähler 2 überschreiben
icon: mdi:download
entity_category: config
on_press:
- ferraris.set_energy_meter:
id: ferraris_meter_2
value: !lambda |-
float val = id(target_energy_value_2).state;
return (val >= 0) ? val : 0;