-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesp-01s-relay.yaml
91 lines (78 loc) · 1.95 KB
/
esp-01s-relay.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
esphome:
name: esp-01s-relay
friendly_name: ESP-01S-Relay
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
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: "Esp-01S-Relay Fallback Hotspot"
password: !secret ap_password
captive_portal:
web_server:
port: 80
switch:
- platform: gpio
pin: GPIO0
name: "Switch"
inverted: false
restore_mode: ALWAYS_OFF
sensor:
- platform: uptime
name: Uptime Sensor
id: uptime_sensor
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 ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 60s
- platform: uptime
name: "Uptime Sensor"
text_sensor:
- platform: wifi_info
ip_address:
name: "IP Address"
ssid:
name: "SSID"
bssid:
name: "BSSID"
mac_address:
name: "Mac Address"
- platform: template
name: Uptime Human Readable
id: uptime_human
icon: mdi:clock-start
button:
- platform: restart
name: "Restart"
- platform: safe_mode
name: "Restart (Safe Mode)"
- platform: factory_reset
name: "Factory Reset"