-
Notifications
You must be signed in to change notification settings - Fork 11
/
example_sht30_espnow.yaml
73 lines (65 loc) · 1.29 KB
/
example_sht30_espnow.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
esphome:
name: sht30-espnow
esp32:
board: seeed_xiao_esp32c3
variant: esp32c3
framework:
type: arduino
logger:
# import the components
external_components:
- source:
type: git
url: https://github.com/u-fire/ESPHomeComponents/
# no need for api or wifi block when using just ESP-Now
globals:
- id: sent
type: int
restore_value: no
initial_value: '0'
now_mqtt:
on_sent:
then:
- lambda: id(sent)++;
- if:
condition:
lambda: 'return id(sent) == 4;'
then:
- lambda: id(sent) = 0;
- deep_sleep.enter:
id: sleep_
sleep_duration: 5min
deep_sleep:
id: sleep_
i2c:
sda: 10
scl: 20
sensor:
- platform: sht3xd
id: sht
temperature:
name: "Temperature"
humidity:
name: "Humidity"
address: 0x44
update_interval: 10s
- platform: adc
id: adc_
name: "Battery voltage"
unit_of_measurement: "V"
pin: GPIO4
update_interval: 10s
attenuation: auto
filters:
- multiply: 2.0
- offset: 0.1
- platform: copy
source_id: adc_
device_class: BATTERY
name: "Battery"
unit_of_measurement: "%"
filters:
- calibrate_linear:
- 3.6 -> 5
- 4.2 -> 100
- lambda: return 30*round(x/30);