-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathtemperaturestation.yaml
129 lines (110 loc) · 2.76 KB
/
temperaturestation.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
# New weather station with BME280 environment sensor
# and 4 outputs for relays
# repay outputs are on D5, D6, D7, D0
substitutions:
devicename: temperaturestation
esphome:
name: $devicename
platform: ESP8266
board: d1_mini
# Enable logging
logger:
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "TempStation Fallback Hotspot"
password: "12345678"
captive_portal:
mqtt:
broker: !secret mqtt_ip
username: !secret mqtt_user
password: !secret mqtt_password
client_id: $devicename
# I2C is required for most of the sensors, environment, light, UV
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
frequency: 100kHz
text_sensor:
- platform: template
name: Uptime Human Readable
id: uptime_human
icon: mdi:clock-start
state_topic: $devicename/uptime_text
switch:
- platform: gpio
name: "Relay 1"
pin:
number: 14
inverted: true
- platform: gpio
name: "Relay 2"
pin:
number: 12
inverted: true
- platform: gpio
name: "Relay 3"
pin:
number: 13
inverted: true
- platform: gpio
name: "Relay 4"
pin:
number: 16
inverted: true
sensor:
# Report Wifi signal strength
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 60s
state_topic: $devicename/rssi
# BME280 Environment Sensor
- platform: bme280_i2c
temperature:
name: "BME280 Temperature"
oversampling: 16x
state_topic: $devicename/temperature
pressure:
name: "BME280 Pressure"
state_topic: $devicename/pressure
humidity:
name: "BME280 Humidity"
state_topic: $devicename/humidity
address: 0x76
update_interval: 60s
# System uptime
- platform: uptime
name: Uptime Sensor
id: uptime_sensor
state_topic: $devicename/uptime
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str();
filters:
- lambda: return x / 60;
unit_of_measurement: "m"
# Web Server for discovery purposes
web_server:
port: 80