forked from mhendriks/esphome-p1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwaterlezer.yaml
121 lines (100 loc) · 2.52 KB
/
waterlezer.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
substitutions:
device_name: waterlezer
device_description: Water meter sensor
version: "v22.11.1"
esphome:
name: ${device_name}
comment: "${device_description}"
name_add_mac_suffix: false
project:
name: smartstuff.waterlezer
version: ${version}
esp8266:
board: esp12e
restore_from_flash: true
status_led:
pin:
number: 2
inverted: true
dashboard_import:
package_import_url: github://mhendriks/esphome-p1/waterlezer.yaml
wifi:
# ssid: !secret ssid
# password: !secret password
ap:
ssid: ${device_name}
web_server:
port: 80
captive_portal:
logger:
level: INFO
ota:
reboot_timeout: 10min
num_attempts: 5
api:
#via Home Assistant Ontwikkelhulpmiddelen > services zoeken op esphome.watermeter_set_water_reading en via deze methode de juiste beginstand invoeren
services:
- service: set_water_reading
variables:
meter_value: int
then:
- globals.set:
id: totalWaterUsage
value: !lambda "return ( meter_value );"
globals:
- id: totalWaterUsage
type: int
restore_value: true # aanpassen naar no indien de nieuwe waarde onder de oude ligt
initial_value: '0' # beginstand van je watermeter -> aanpassen via Home Assistant services
button:
- platform: restart
name: "Restart device"
sensor:
- platform: pulse_counter
pin:
number: 5
mode:
input: true
pullup: true #v3.5 aanzetten
id: watermeter_pulse
name: "Watermeter pulse"
count_mode:
rising_edge: DISABLE
falling_edge: INCREMENT
state_class: measurement
update_interval: 1s
internal_filter: 100us
accuracy_decimals: 0
unit_of_measurement: 'L/min'
- platform: template
name: "Watermeter total"
state_class: "total_increasing"
device_class: "water"
icon: mdi:water
update_interval: 1s
unit_of_measurement: L
accuracy_decimals: 0
lambda: |-
if (id(watermeter_pulse).state > 0) id(totalWaterUsage) += 1;
return id(totalWaterUsage);
- platform: uptime
name: "Uptime"
text_sensor:
- platform: wifi_info
ip_address:
name: IP-adres
icon: mdi:ip-network
ssid:
name: Netwerk
icon: mdi:access-point-network
mac_address:
name: Mac-adres
icon: mdi:folder-key-network-outline
- platform: template
name: "version"
icon: "mdi:label-outline"
update_interval: 6h
lambda: return {"${version}"};
- platform: version
name: "ESPHome Version"
hide_timestamp: true