-
Notifications
You must be signed in to change notification settings - Fork 0
/
rain-sensor.yaml
75 lines (66 loc) · 1.35 KB
/
rain-sensor.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
esphome:
name: rain-sensor
on_boot:
priority: -10
then:
- script.execute: heartbeat
includes:
- RG9.h
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: DEBUG
hardware_uart: UART1
# Enable Home Assistant API
api:
output:
- id: onBoardLED
platform: gpio
pin: 2
uart:
id: uart_bus
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 9600
# debug:
# direction: BOTH
# after:
# delimiter: "\n"
sensor:
- platform: custom
lambda: |-
auto rg9Sensor = new RG9Component(id(uart_bus));
App.register_component(rg9Sensor);
return {rg9Sensor->rainIntensity, rg9Sensor->rainFallPerMin};
sensors:
- name: "Rain Intensity"
accuracy_decimals: 0
unit_of_measurement: '-'
- name: "Rain Fall"
accuracy_decimals: 0
unit_of_measurement: '-/min'
script:
- id: oneBeat
then:
- output.turn_on: onBoardLED
- delay: 250ms
- output.turn_off: onBoardLED
- id: heartbeat
then:
- script.execute: oneBeat
- delay: 750ms
- script.execute: oneBeat
- delay: 750ms
- script.execute: oneBeat
- delay: 750ms
- script.execute: oneBeat
- delay: 750ms
- while:
condition:
lambda: 'return true;'
then:
- script.execute: oneBeat
- delay: 10s