Files
homeassistant_config/esphome/sonoff-niche1.yaml
2024-05-31 09:39:52 +02:00

80 lines
1.6 KiB
YAML

substitutions:
device_name: "sonoff-niche1"
friendly_name: "Prise_niche1"
project_name: "prise.niche1"
project_version: "1.0"
adresse_ip: 10.0.2.131
packages:
## include wifi networks, manual_ip, ap
wifi: !include common/wifi.yaml
#include logger with syslog, api, ota, webserver, captive portal
device_base: !include common/device_base.yaml
esphome:
name: "${device_name}"
project:
name: "${project_name}"
version: "${project_version}"
esp8266:
board: esp01_1m
binary_sensor:
#include status
- <<: !include common/generic_binarysensor.yaml
- platform: gpio
pin:
number: 3
mode: INPUT_PULLUP
inverted: true
name: "${friendly_name} Power Button"
disabled_by_default: true
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at least 0.2s
then:
- switch.toggle: relay
- timing:
- ON for at least 4s
then:
- switch.turn_on: restart_switch
sensor:
#include uptime et wifisignal
- <<: !include common/generic_sensor.yaml
switch:
#include restart
- <<: !include common/generic_switch.yaml
- platform: gpio
name: "${friendly_name}"
pin: GPIO12
id: relay
restore_mode: RESTORE_DEFAULT_ON
# on_turn_on:
# - light.turn_on: blue_led
#
# on_turn_off:
# - light.turn_off: blue_led
light:
- platform: status_led
name: "${friendly_name} Status LED"
id: blue_led
disabled_by_default: true
pin:
inverted: true
number: GPIO13
time:
- platform: sntp
text_sensor:
#include wifi info : ipaddress ssid
- <<: !include common/generic_textsensor.yaml