-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathexample_leaf_vpd.yaml
66 lines (60 loc) · 1.41 KB
/
example_leaf_vpd.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
substitutions:
friendly_name: Microfire Leaf VPD
device_name: leaf-vpd
esphome:
name: $device_name
platformio_options:
board_build.flash_mode: dio
esp32:
board: esp32dev
framework:
type: arduino
logger:
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: $device_name
password: !secret wifi_failover
#captive_portal:
# import the mod-ec component
external_components:
- source:
type: git
url: https://github.com/u-fire/ESPHomeComponents/
# https://esphome.io/components/i2c.html
i2c:
sda: 22
scl: 21
sensor:
- platform: mlx90614
id: mlx
ambient:
name: Ambient Temperature
object:
id: mlx_object
name: Leaf Temperature
- platform: sht3xd
temperature:
id: sht_air_temp
name: "Air Temperature"
humidity:
id: sht_air_rh
name: "Air Humidity"
- platform: template
name: "VPD"
unit_of_measurement: kPa
accuracy_decimals: 2
icon: "mdi:leaf"
state_class: measurement
lambda: |-
float _object_temp_c = id(mlx_object).state;
float _ambient_temp_c = id(sht_air_temp).state;
float _RH = id(sht_air_rh).state;
float l_vpd;
float a_vpd;
l_vpd = 0.61078 * exp((17.2694 * _object_temp_c) / (_object_temp_c + 237.3));
a_vpd = 0.61078 * exp((17.2694 * _ambient_temp_c) / (_ambient_temp_c + 237.3)) * (_RH / 100);
return (l_vpd - a_vpd);