-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-config-single-tank.yaml
95 lines (81 loc) · 2.71 KB
/
example-config-single-tank.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
substitutions:
name: water-tank-example
friendly_name: Water_tank_example
updates: 50s # Set the update interval to something that will not flood your network.
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Example Fallback Hotspot"
password: "DXxlcD7pQkt7"
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
web_server:
port: 80
local: true
sensor:
- platform: ultrasonic
accuracy_decimals: 4
trigger_pin: GPIO4
echo_pin: GPIO5
name: "Example Water Tank Sensor"
id: example_water_tank_sensor
update_interval: ${updates}
- platform: template
name: "Full Water Height Example Tank"
id: full_water_height_example_tank
unit_of_measurement: "cm"
update_interval: ${updates}
lambda: |-
return 147.00; // Set the value accordingly
- platform: template
name: "Sensor Height From Water Level Example Tank"
id: sensor_height_from_water_level_example_tank
unit_of_measurement: "cm"
update_interval: ${updates}
lambda: |-
return 20.77; // Set the value accordingly
- platform: template
name: "Water Tank Max Capacity Example Tank"
id: water_tank_max_capacity_example_tank
unit_of_measurement: "l"
update_interval: ${updates}
lambda: |-
return 2500; // Set the value accordingly
- platform: template
name: "Water Tank Level Percentage Example Tank"
id: water_tank_level_percentage_example_tank
unit_of_measurement: "%"
update_interval: ${updates}
lambda: |-
float full_water_height = id(full_water_height_example_tank).state;
float sensor_height = id(sensor_height_from_water_level_example_tank).state;
float tank_sensor = id(example_water_tank_sensor).state;
float tank_level = full_water_height - tank_sensor + sensor_height;
return (((full_water_height + sensor_height) - (tank_sensor * 100)) / (full_water_height) * 100 );
- platform: template
name: "Water Tank Current Capacity Example Tank"
id: water_tank_current_capacity_example_tank
unit_of_measurement: "l"
update_interval: ${updates}
lambda: |-
float max_capacity = id(water_tank_max_capacity_example_tank).state;
float percentage = id(water_tank_level_percentage_example_tank).state;
return (max_capacity * percentage)/100;