mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-26 17:27:47 +01:00
Fix Sonoff S20/4CH example configurations (#40)
This commit is contained in:
parent
775828e62c
commit
2aeae722a2
@ -308,7 +308,7 @@ them in one area, and simply pass that ID later on. For example, above you can s
|
||||
output being created with the ID ``blue_led`` for the blue LED. Later on it is then transformed
|
||||
into a :doc:`monochromatic light </esphomeyaml/components/light/monochromatic>`.
|
||||
If you additionally want the buttons to control the relays, look at `the complete Sonoff 4CH
|
||||
with automation example <https://github.com/OttoWinter/esphomeyaml/blob/master/examples/sonoff_4ch.yaml>`__.
|
||||
with automation example <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/devices/sonoff_4ch.yaml>`__.
|
||||
|
||||
Upload the firmware again (through OTA or Serial) and you should immediately see
|
||||
something like this in Home Assistant because of esphomeyaml's automatic MQTT discovery. (You'll
|
||||
|
91
esphomeyaml/devices/sonoff_4ch.yaml
Normal file
91
esphomeyaml/devices/sonoff_4ch.yaml
Normal file
@ -0,0 +1,91 @@
|
||||
esphomeyaml:
|
||||
name: <NAME_OF_NODE>
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
board_flash_mode: dout
|
||||
|
||||
wifi:
|
||||
ssid: <YOUR_SSID>
|
||||
password: <YOUR_PASSWORD>
|
||||
|
||||
mqtt:
|
||||
broker: <YOUR_MQTT_BROKER>
|
||||
username: <YOUR_USERNAME>
|
||||
password: <YOUR_PASSWORD>
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO0
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
name: "Sonoff 4CH Button 1"
|
||||
on_press:
|
||||
then:
|
||||
switch.toggle:
|
||||
id: relay_1
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO9
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
name: "Sonoff 4CH Button 2"
|
||||
on_press:
|
||||
then:
|
||||
switch.toggle:
|
||||
id: relay_2
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO10
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
name: "Sonoff 4CH Button 3"
|
||||
on_press:
|
||||
then:
|
||||
switch.toggle:
|
||||
id: relay_3
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO14
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
name: "Sonoff 4CH Button 4"
|
||||
on_press:
|
||||
then:
|
||||
switch.toggle:
|
||||
id: relay_4
|
||||
- platform: status
|
||||
name: "Sonoff 4CH Status"
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
name: "Sonoff 4CH Relay 1"
|
||||
pin: GPIO12
|
||||
id: relay_1
|
||||
- platform: gpio
|
||||
name: "Sonoff 4CH Relay 2"
|
||||
pin: GPIO5
|
||||
id: relay_2
|
||||
- platform: gpio
|
||||
name: "Sonoff 4CH Relay 3"
|
||||
pin: GPIO4
|
||||
id: relay_3
|
||||
- platform: gpio
|
||||
name: "Sonoff 4CH Relay 4"
|
||||
pin: GPIO15
|
||||
id: relay_4
|
||||
|
||||
output:
|
||||
- platform: esp8266_pwm
|
||||
id: blue_led
|
||||
pin: GPIO13
|
||||
inverted: True
|
||||
|
||||
light:
|
||||
- platform: monochromatic
|
||||
name: "Sonoff 4CH Blue LED"
|
||||
output: blue_led
|
@ -296,7 +296,7 @@ in Home Assistant, replace the last part with this:
|
||||
output: s20_relay
|
||||
|
||||
To make pressing the button on the front toggle the relay, have a look at the `the complete Sonoff S20
|
||||
with automation example <https://github.com/OttoWinter/esphomeyaml/blob/master/examples/sonoff_s20.yaml>`__.
|
||||
with automation example <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/devices/sonoff_s20.yaml>`__.
|
||||
|
||||
Upload the firmware again (through OTA or Serial) and you should immediately see
|
||||
something like this in Home Assistant because of esphomeyaml's automatic MQTT discovery. (You'll
|
||||
|
50
esphomeyaml/devices/sonoff_s20.yaml
Normal file
50
esphomeyaml/devices/sonoff_s20.yaml
Normal file
@ -0,0 +1,50 @@
|
||||
esphomeyaml:
|
||||
name: <NAME_OF_NODE>
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
board_flash_mode: dout
|
||||
|
||||
wifi:
|
||||
ssid: <YOUR_SSID>
|
||||
password: <YOUR_PASSWORD>
|
||||
|
||||
mqtt:
|
||||
broker: <YOUR_MQTT_BROKER>
|
||||
username: <YOUR_USERNAME>
|
||||
password: <YOUR_PASSWORD>
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO0
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
name: "Sonoff S20 Button"
|
||||
on_press:
|
||||
then:
|
||||
- switch.toggle:
|
||||
id: relay
|
||||
- platform: status
|
||||
name: "Sonoff S20 Status"
|
||||
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
name: "Sonoff S20 Relay"
|
||||
pin: GPIO12
|
||||
id: relay
|
||||
|
||||
output:
|
||||
- platform: esp8266_pwm
|
||||
id: s20_green_led
|
||||
pin: GPIO13
|
||||
inverted: True
|
||||
|
||||
light:
|
||||
- platform: monochromatic
|
||||
name: "Sonoff S20 Green LED"
|
||||
output: s20_green_led
|
Loading…
Reference in New Issue
Block a user