forked from mjoshd/esphome_martin-jerry-mj-s01-switch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
martin_jerry_mj_s01.yaml
98 lines (77 loc) · 2 KB
/
martin_jerry_mj_s01.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
# ##################################
# Martin Jerry Light Switch MJ-S01
# ##################################
# D2 GPIO4: red led (inverted)
# D1 GPIO5: blue led (inverted)
# D6 GPIO12: relay
# D7 GPIO13: button (inverted, input_pullup)
# ##################################
substitutions:
# https://esphome.io/guides/configuration-types.html#substitutions
device_name: martin_jerry_mj_s01
friendly_name: Martin Jerry MJ-S01
ip_address: !secret martin_jerry_mj_s01_ip
icon: "mdi:ceiling-light"
esphome:
# https://esphome.io/components/esphome
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
# https://esphome.io/components/wifi
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: ${ip_address}
gateway: !secret wifi_gateway
subnet: !secret wifi_subnet
dns1: !secret wifi_dns1
# web_server:
# port: 80
# # https://esphome.io/components/web_server.html
logger:
# https://esphome.io/components/logger
api:
password: !secret esphome_api_password
# https://esphome.io/components/api
ota:
password: !secret esphome_ota_password
# https://esphome.io/components/ota
status_led:
# https://esphome.io/components/status_led
pin:
number: GPIO4 # Red LED
inverted: True
binary_sensor:
- platform: gpio
# https://esphome.io/components/switch/gpio
name: ${friendly_name} Button
id: button
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: True
internal: True
on_press:
- switch.toggle: relay
switch:
- platform: gpio
# https://esphome.io/components/switch/gpio
name: ${friendly_name} Blue LED
id: blue_led
pin:
number: GPIO5
inverted: True
internal: True
- platform: gpio
# https://esphome.io/components/switch/gpio
name: ${friendly_name}
icon: ${icon}
id: relay
pin:
number: GPIO12
# Tie Blue LED operation to relay
on_turn_on:
- switch.turn_off: blue_led
on_turn_off:
- switch.turn_on: blue_led