-
Notifications
You must be signed in to change notification settings - Fork 0
/
garden-sockets.yaml
123 lines (105 loc) · 2.48 KB
/
garden-sockets.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
esphome:
name: garden-sockets
esp8266:
# No idea what kind of board is it so using a generic one
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
# This can be anything - you are asked about it when you add the device to HA
key: !secret api_encryption_key
ota:
password: !secret ota_pass
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Garden-Sockets Fallback Hotspot"
password: !secret fallback_wifi_pass
use_address: 192.168.4.254
captive_portal:
output:
- platform: gpio
id: relay_1
pin: GPIO15 # relay 1
- platform: gpio
id: relay_2
pin: GPIO4 # relay 2
- platform: gpio
id: led_1
pin:
number: GPIO2 # led 1
inverted: true
- platform: gpio
id: led_2
pin:
number: GPIO0 # led 2
inverted: true
# Exposing HA entities
light:
# Exposing garden light entity
- platform: binary
name: "Garden lights"
id: garden_lights
output: relay_2
icon: mdi:outdoor-lamp
on_turn_on:
- output.turn_on: led_2
on_turn_off:
- output.turn_off: led_2
switch:
# Exposing switch entity
- platform: output
output: relay_1
name: "Garden socket"
id: garden_socket
icon: mdi:power-socket-uk
on_turn_on:
- output.turn_on: led_1
on_turn_off:
- output.turn_off: led_1
# Button control
# Not adding button "name" properties to avoid exposing them to HA
binary_sensor:
- platform: gpio
id: button_1
pin:
number: GPIO16 # button 1
mode:
input: true
pullup: false # GPIO16 doesn't have a pullup resistor
inverted: false
on_press:
- switch.toggle: garden_socket
- platform: gpio
id: button_2
pin:
number: GPIO13 # button 2
mode:
input: true
pullup: true
inverted: false
on_press:
- light.toggle: garden_lights
# Energy monitoring
# https://esphome.io/components/sensor/hlw8012.html
sensor:
- platform: hlw8012
model: BL0937
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO5
cf1_pin: GPIO14
current:
name: "Garden sockets current"
voltage:
name: "Garden sockets voltage"
power:
name: "Garden sockets power"
update_interval: 15s
# When flashing from Tasmota > 8: SetOption78 1
# New Tasmota takes so much space that the upload of the new bin fails via OTA. Try gzipping it!!!