forked from docteurzoidberg/my-esphome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lorareceiver.yaml
executable file
·135 lines (125 loc) · 3.52 KB
/
lorareceiver.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
substitutions:
devicename: "lorareceiver"
friendly_name: "Lora point-to-point bridge"
esphome:
name: $devicename
build_path: build/$devicename
platform: ESP32
board: heltec_wifi_lora_32_V2
includes:
- src/custom_lora_receiver/custom_lora_receiver.h
- src/custom_lora_receiver/structures.h
libraries:
- "LoRa"
- "https://github.com/docteurzoidberg/esplib-lorasensorpackets/archive/master.zip"
wifi: !include "common/wifimulti.yaml"
#mqtt: !include "common/mqtt.yaml"
captive_portal:
logger:
api:
ota:
i2c:
sda: 4
scl: 15
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
reset_pin: 16
address: 0x3C
rotation: 90
brightness: 20%
lambda: |-
it.image(0, 32, id(img_lora_logo));
font:
- file: "fonts/Roboto-Regular.ttf"
id: font_roboto_8
size: 8
image:
- file: "img/lora_64x64.png"
id: img_lora_logo
resize: 64x64
sensor:
- platform: custom
id: lorareceiver
lambda: |-
auto lora_receiver = new LoraReceiver();
App.register_component(lora_receiver);
return {
lora_receiver->last_packet_rssi,
lora_receiver->packet_counter,
lora_receiver->device_J7_batt_voltage,
lora_receiver->device_J7_batt_percent,
lora_receiver->device_J7_batt_islow,
lora_receiver->device_J7_pir_state,
lora_receiver->device_J7_alarm_isactive,
lora_receiver->device_PT_batt_voltage,
lora_receiver->device_PT_water_level,
lora_receiver->device_SL_batt_voltage,
lora_receiver->device_SL_soil_moisture
};
sensors:
- name: "LoRa Station last received packet rssi"
- name: "LoRa Station received packets counter"
accuracy_decimals: 0
- name: "J7 IDS battery voltage"
accuracy_decimals: 1
icon: mdi:battery
unit_of_measurement: v
- name: "J7 IDS battery percentage"
accuracy_decimals: 1
icon: mdi:percent
unit_of_measurement: '%'
- name: "J7 IDS battery is low"
accuracy_decimals: 0
icon: mdi:battery
- name: "J7 IDS PIR state"
accuracy_decimals: 0
icon: mdi:eye
- name: "J7 IDS Alarm is active"
accuracy_decimals: 0
icon: mdi:bell
- name: "Well battery voltage"
id: well_bat_voltage
accuracy_decimals: 2
icon: mdi:battery
unit_of_measurement: v
filters:
- multiply: 0.001
- name: "Well water level"
unit_of_measurement : cm
accuracy_decimals: 0
icon: mdi:water
- name: "Soil moisure percent"
unit_of_measurement : '%'
accuracy_decimals: 0
icon: mdi:water
- platform: template
name: "Well battery percentage"
icon: mdi:percent
unit_of_measurement: '%'
accuracy_decimals: 0
update_interval: 15s
lambda: |-
return id(well_bat_voltage).state;
filters:
calibrate_linear:
- 3.0 -> 0
- 4.2 -> 100
- platform: template
name: "Well battery is low"
accuracy_decimals: 0
update_interval: 15s
lambda: |-
return id(well_bat_voltage).state < 3.3;
icon: mdi:battery-alert-variant-outline
text_sensor:
- platform: custom
text_sensors:
- name: "LoRa Station last received packet data"
id: last_packet_received
lambda: |-
auto lora_packet_sensor = new LoraPacketSensor();
App.register_component(lora_packet_sensor);
return {
lora_packet_sensor->last_packet_received
};