mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Add Sonoff S20 example
This commit is contained in:
parent
2f05acfa5a
commit
ee2c53585f
2 changed files with 54 additions and 2 deletions
|
@ -56,8 +56,10 @@ def alphanumeric(value):
|
||||||
|
|
||||||
def valid_name(value):
|
def valid_name(value):
|
||||||
value = string_strict(value)
|
value = string_strict(value)
|
||||||
if not all(c in ALLOWED_NAME_CHARS for c in value):
|
for c in value:
|
||||||
raise vol.Invalid(u"Valid characters for name are {}".format(ALLOWED_NAME_CHARS))
|
if c not in ALLOWED_NAME_CHARS:
|
||||||
|
raise vol.Invalid(u"'{}' is an invalid character for names. Valid characters are: {}"
|
||||||
|
u"".format(c, ALLOWED_NAME_CHARS))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
|
50
examples/sonoff_s20.yaml
Normal file
50
examples/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 a new issue