82 lines
1.6 KiB
YAML
82 lines
1.6 KiB
YAML
substitutions:
|
|
device_name: "sonoff-niche2"
|
|
friendly_name: "Prise_niche2"
|
|
project_name: "prise.niche2"
|
|
project_version: "1.0"
|
|
adresse_ip: 10.0.2.132
|
|
|
|
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
|
|
|