|
|
|
#SONOFF T1 EU/UK (1 button)
|
|
|
|
#https://www.banggood.com/SONOFF-T1-EU-or-UK-AC-100-240V-1-or-2-or-3-Gang-TX-Series-WIFI-Wall-Switch-433Mhz-RF-Remote-Controlled-Wifi-Switch-Smart-Home-Switch-Works-With-Alexa-Google-Home-p-1470883.html?rmmds=myorder&cur_warehouse=UK&ID=6278514
|
|
|
|
|
|
|
|
esphome:
|
|
|
|
name: bedroom_switch
|
|
|
|
platform: ESP8266
|
|
|
|
board: esp01_1m
|
|
|
|
|
|
|
|
wifi:
|
|
|
|
ssid: !secret wifi-ssid
|
|
|
|
password: !secret wifi-password
|
|
|
|
|
|
|
|
logger:
|
|
|
|
api:
|
|
|
|
ota:
|
|
|
|
|
|
|
|
binary_sensor:
|
|
|
|
- platform: gpio
|
|
|
|
name: "Bedroom Sensor"
|
|
|
|
pin:
|
|
|
|
number: GPIO0
|
|
|
|
mode: INPUT_PULLUP
|
|
|
|
inverted: True
|
|
|
|
filters:
|
|
|
|
- delayed_on: 30ms
|
|
|
|
- delayed_off: 30ms
|
|
|
|
internal: True
|
|
|
|
on_multi_click:
|
|
|
|
# Single
|
|
|
|
- timing:
|
|
|
|
- ON for at most 1s
|
|
|
|
- OFF for at least 0.5s
|
|
|
|
then:
|
|
|
|
- text_sensor.template.publish:
|
|
|
|
id: bedroom_button
|
|
|
|
state: !lambda 'return "single";'
|
|
|
|
#- homeassistant.service:
|
|
|
|
# service: input_boolean.turn_on
|
|
|
|
# data:
|
|
|
|
# entity_id: input_boolean.bedroom_single
|
|
|
|
#- delay: 0.2s
|
|
|
|
#- homeassistant.service:
|
|
|
|
# service: input_boolean.turn_off
|
|
|
|
# data:
|
|
|
|
# entity_id: input_boolean.bedroom_single
|
|
|
|
# Double
|
|
|
|
- timing:
|
|
|
|
- ON for at most 1s
|
|
|
|
- OFF for at most 1s
|
|
|
|
- ON for at most 1s
|
|
|
|
- OFF for at least 0.2s
|
|
|
|
then:
|
|
|
|
- text_sensor.template.publish:
|
|
|
|
id: bedroom_button
|
|
|
|
state: !lambda 'return "double";'
|
|
|
|
#- homeassistant.service:
|
|
|
|
# service: input_boolean.turn_on
|
|
|
|
# data:
|
|
|
|
# entity_id: input_boolean.bedroom_double
|
|
|
|
#- delay: 0.2s
|
|
|
|
#- homeassistant.service:
|
|
|
|
# service: input_boolean.turn_off
|
|
|
|
# data:
|
|
|
|
# entity_id: input_boolean.bedroom_double
|
|
|
|
# Hold
|
|
|
|
- timing:
|
|
|
|
- ON for 1s to 3s
|
|
|
|
- OFF for at least 0.5s
|
|
|
|
then:
|
|
|
|
- text_sensor.template.publish:
|
|
|
|
id: bedroom_button
|
|
|
|
state: !lambda 'return "hold";'
|
|
|
|
#- homeassistant.service:
|
|
|
|
# service: input_boolean.turn_on
|
|
|
|
# data:
|
|
|
|
# entity_id: input_boolean.bedroom_hold
|
|
|
|
#- delay: 0.2s
|
|
|
|
#- homeassistant.service:
|
|
|
|
# service: input_boolean.turn_off
|
|
|
|
# data:
|
|
|
|
# entity_id: input_boolean.bedroom_hold
|
|
|
|
on_press:
|
|
|
|
then:
|
|
|
|
- output.turn_on: blue_led
|
|
|
|
on_release:
|
|
|
|
then:
|
|
|
|
- output.turn_off: blue_led
|
|
|
|
|
|
|
|
switch:
|
|
|
|
- platform: gpio
|
|
|
|
name: "Bedroom Relay"
|
|
|
|
pin: GPIO12
|
|
|
|
|
|
|
|
output:
|
|
|
|
# Register the blue LED as a dimmable output ....
|
|
|
|
- platform: esp8266_pwm
|
|
|
|
id: blue_led
|
|
|
|
pin: GPIO13
|
|
|
|
inverted: True
|
|
|
|
|
|
|
|
text_sensor:
|
|
|
|
- platform: template
|
|
|
|
name: "Bedroom Touchpad"
|
|
|
|
id: bedroom_button
|
|
|
|
icon: "mdi:toggle-switch"
|
|
|
|
on_value:
|
|
|
|
then:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
text_sensor.state:
|
|
|
|
id: bedroom_button
|
|
|
|
state: ""
|
|
|
|
else:
|
|
|
|
- delay: 20ms
|
|
|
|
- text_sensor.template.publish:
|
|
|
|
id: bedroom_button
|
|
|
|
state: !lambda 'return "";'
|
|
|
|
|
|
|
|
#light:
|
|
|
|
# # ... and then make a light out of it.
|
|
|
|
# - platform: monochromatic
|
|
|
|
# name: "Bedroom switch light"
|
|
|
|
# output: blue_led
|