Skip to content

Instantly share code, notes, and snippets.

@brandond
Created February 1, 2019 20:37
Show Gist options
  • Save brandond/44afc1e344ed8d6b89107ada11737687 to your computer and use it in GitHub Desktop.
Save brandond/44afc1e344ed8d6b89107ada11737687 to your computer and use it in GitHub Desktop.
esphomeyaml templates
esphomeyaml:
name: fixture{{ID}}
platform: ESP8266
board: esp01_1m
arduino_version: 2.4.2
esphomelib_version: dev
board_flash_mode: dout
build_path: esp8266
on_boot:
if:
condition:
binary_sensor.is_on: switch0
then:
light.turn_on: relay0
else:
light.turn_off: relay0
wifi:
ssid: 'x'
password: 'x'
fast_connect: True
mqtt:
broker: 'x'
logger:
level: DEBUG
debug:
ota:
sensor:
- platform: wifi_signal
name: "Fixture {{ID}} WiFi Signal"
filters:
- sliding_window_moving_average:
window_size: 4
send_every: 4
output:
- platform: gpio
id: relay_output
pin:
number: 4
mode: OUTPUT
light:
- platform: binary
name: "Fixture {{ID}} Light"
id: relay0
output: relay_output
binary_sensor:
- platform: gpio
id: switch0
pin:
number: 5
mode: INPUT
on_state:
then:
light.toggle: relay0
esphomeyaml:
name: plug{{ID}}
platform: ESP8266
board: esp01_1m
arduino_version: 2.4.2
esphomelib_version: dev
board_flash_mode: dout
build_path: esp8266
on_boot:
if:
condition:
switch.is_on: template0
then:
light.turn_on: led0_light
else:
light.turn_off: led0_light
wifi:
ssid: 'x'
password: 'x'
fast_connect: True
mqtt:
broker: 'x'
logger:
level: DEBUG
debug:
ota:
sensor:
- platform: wifi_signal
name: "Smart Plug {{ID}} WiFi Signal"
filters:
- sliding_window_moving_average:
window_size: 4
send_every: 4
switch:
- platform: gpio
id: switch0
restore_mode: RESTORE_DEFAULT_OFF
pin:
number: 14
mode: OUTPUT
- platform: template
id: template0
icon: "mdi:power-plug"
name: "Smart Plug {{ID}} Power"
restore_state: True
turn_off_action:
- light.turn_off: led0_light
- switch.turn_off: switch0
turn_on_action:
- light.turn_on: led0_light
- switch.turn_on: switch0
lambda: "return id(switch0).state;"
binary_sensor:
- platform: gpio
id: button0
pin:
number: 4
mode: INPUT
inverted: True
on_click:
then:
switch.toggle: template0
status_led:
pin:
number: 12
mode: OUTPUT
inverted: True
output:
- platform: esp8266_pwm
id: led0_output
pin:
number: 13
mode: OUTPUT
inverted: True
light:
- platform: monochromatic
id: led0_light
output: led0_output
default_transition_length: 0.5s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment