-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
watermeter.yaml
78 lines (72 loc) · 1.74 KB
/
watermeter.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
substitutions:
name: watermeter
friendly_name: Watermeter
static_ip: !secret watermeter_static_ip
wifi_ap_password: !secret ap_password
ota_password: !secret watermeter_ota_password
encryption_key: !secret watermeter_encryption_key
version: v1
packages:
device_base: !include packages/device_base.yaml
esphome:
platform: ESP8266
board: nodemcuv2
name: ${name}
friendly_name: ${friendly_name}
project:
name: golles.${friendly_name}
version: ${version}
api:
services:
service: set_water_usage
variables:
meter_value: float
then:
- globals.set:
id: totalWaterUsage
value: !lambda "return meter_value;"
globals:
- id: totalWaterUsage
type: float
restore_value: true
initial_value: "367.853" # 08-02-2024 13:00
sensor:
- platform: pulse_meter
pin: D6
# name: Verbruik
name: Pulse
unit_of_measurement: L/min
icon: mdi:water-pump
internal_filter_mode: PULSE
internal_filter: 300ms
timeout: 2min
filters:
- lambda: |-
return x * (60.0 / 1000.0);
total:
id: sensor_pulse_meter_total
name: Totaalverbruik
icon: mdi:cube-outline
device_class: water
state_class: total_increasing
unit_of_measurement: m³
accuracy_decimals: 3
disabled_by_default: true
filters:
- lambda: |-
if (x > 0) {
id(totalWaterUsage) += 0.001;
}
return x;
- multiply: 0.001
- platform: template
id: watermeter_total
name: Totaal
icon: mdi:water
update_interval: 5s
unit_of_measurement: m³
device_class: water
state_class: total_increasing
accuracy_decimals: 3
lambda: |-
return id(totalWaterUsage);