-
Notifications
You must be signed in to change notification settings - Fork 0
/
pi-power.yaml
100 lines (84 loc) · 1.82 KB
/
pi-power.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
# Substitutions
substitutions:
# Board
platform: ESP8266
board: d1_mini
powerledgpio: GPIO2
rebootgpio: GPIO0
# Identity
domain: switch
domainshort: sw
endpoint: pi_power
devicename: ${domain}-${endpoint}
# Features
wifi_fast_connect: 'on'
# WiFi - Same for all devices
wifigateway: !secret wifigateway
subnet: !secret subnet
wifissid: !secret wifi_ssid
wifipwd: !secret wifi_pwd
appwd: !secret esphome_appassword
fast_connect: $wifi_fast_connect
# Enable Web server
web_server:
port: 80
# Enable Home Assistant API
api:
# Basic configuration
esphome:
name: $devicename
platform: $platform
board: $board
on_boot:
- light.turn_on: powerled
# Network configuration
wifi:
networks:
- ssid: $wifissid
password: $wifipwd
- ssid: $wifissidbackup
password: $wifipwdbackup
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap: #Settings for captive portal
ssid: esphome_${domainshort}_${endpoint}
password: $appwd
captive_portal: # AP in case WiFi connection fails
# Enable logging
logger:
# Enable OTA firmware update
ota:
# Safe Mode
switch:
- platform: safe_mode
name: ${devicename}_safe_mode
output:
# Pi power switch
- platform: gpio
id: output_1
pin: $rebootgpio
# Power LED light output
- platform: esp8266_pwm
id: powerledoutput
pin: $powerledgpio
inverted: True
button:
# Power momentary button
- platform: output
name: ${endpoint}_power_switch
output: output_1
duration: 500ms
id: output1_button
# Sync time with Home Assistant
time:
- platform: homeassistant
id: homeassistant_time
# IP address sensor
text_sensor:
- platform: wifi_info
ip_address:
name: ${devicename} IP
light:
# Power LED light
- platform: binary
output: powerledoutput
id: powerled