Refactoring

This commit is contained in:
Nikolay Vasilchuk
2022-09-09 21:04:09 +03:00
parent e59addb02b
commit 6e66e9c20f
14 changed files with 59 additions and 51 deletions

View File

@@ -4,17 +4,6 @@
############# User configuration #############
substitutions:
# Ge1mer board
board: esp12e
pin_relay_answer: GPIO14 # 330 Ohm, NO relay
pin_relay_phone: GPIO16 # Intercom, NC relay
pin_relay_mute: GPIO12 # 50 Ohm, NO relay
pin_led_red: GPIO5
pin_led_green: GPIO4
pin_led_blue: GPIO15
pin_call_detect: GPIO13
pin_btn_accept: GPIO0
# Build configuration
board_name: "Domofon"
mdns_name: "domofon"
@@ -24,9 +13,9 @@ substitutions:
phone_relay_inverted: 'true' # Set to 'false' if you have NO phone relay
# Wifi credentials
wifi_ssid: "-----"
wifi_password: ""
ap_ssid: "Domofon"
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
ap_ssid: "domofon"
ap_password: "1234567890"
# MQTT credentials
@@ -47,15 +36,8 @@ substitutions:
########### End user configuration ###########
packages:
base: !include domofon_packages/base.yaml
api: !include domofon_packages/api.yaml
#mqtt: !include domofon_packages/mqtt.yaml
#web_server: !include domofon_packages/web_server.yaml
#captive_portal: !include domofon_packages/captive_portal.yaml
number: !include domofon_packages/number.yaml
script: !include domofon_packages/script.yaml
output: !include domofon_packages/output.yaml
switch: !include domofon_packages/switch.yaml
button: !include domofon_packages/button.yaml
light: !include domofon_packages/light.yaml
binary_sensor: !include domofon_packages/binary_sensor.yaml
base: github://Anonym-tsk/smart-domofon/ge1mer/esphome/packages/base.yaml@master
api: github://Anonym-tsk/smart-domofon/ge1mer/esphome/packages/api.yaml@master
#mqtt: github://Anonym-tsk/smart-domofon/ge1mer/esphome/packages/mqtt.yaml@master
#web_server: github://Anonym-tsk/smart-domofon/ge1mer/esphome/packages/web_server.yaml@master
#captive_portal: github://Anonym-tsk/smart-domofon/ge1mer/esphome/packages/captive_portal.yaml@master

View File

@@ -1,23 +0,0 @@
# 8 times click - run captive portal
timing:
- ON for 5ms to 1s
- OFF for 5ms to 1s
- ON for 5ms to 1s
- OFF for 5ms to 1s
- ON for 5ms to 1s
- OFF for 5ms to 1s
- ON for 5ms to 1s
- OFF for 5ms to 1s
- ON for 5ms to 1s
- OFF for 5ms to 1s
- ON for 5ms to 1s
- OFF for 5ms to 1s
- ON for 5ms to 1s
- OFF for 5ms to 1s
- ON for 5ms to 1s
then:
lambda: |-
ESP_LOGW("DMF", "Erase settings and restart...");
captive_portal::global_captive_portal->override_sta_mqtt("-----", "", "10.0.0.1", "1883", "", "");
delay(500);
ESP.restart();

View File

@@ -3,7 +3,7 @@ esphome:
build_path: $build_path
platform: ESP8266
board: $board
comment: "https://github.com/Anonym-tsk/smart-domofon/tree/master/ge1mer"
comment: "espdomofon.ru"
esp8266_restore_from_flash: true
project:
name: "espdomofon.ru"
@@ -97,3 +97,24 @@ text_sensor:
name: "${board_name} Uptime"
icon: mdi:clock-start
entity_category: "diagnostic"
substitutions:
# Ge1mer board
board: esp12e
pin_relay_answer: GPIO14 # 330 Ohm, NO relay
pin_relay_phone: GPIO16 # Intercom, NC relay
pin_relay_mute: GPIO12 # 50 Ohm, NO relay
pin_led_red: GPIO5
pin_led_green: GPIO4
pin_led_blue: GPIO15
pin_call_detect: GPIO13
pin_btn_accept: GPIO0
packages:
number: !include number.yaml
script: !include script.yaml
output: !include output.yaml
switch: !include switch.yaml
button: !include button.yaml
light: !include light.yaml
binary_sensor: !include binary_sensor.yaml

View File

@@ -84,4 +84,32 @@ binary_sensor:
id(mode_auto_reject) = false;
}
}
# - <<: !include includes/binary_sensor.captive.yaml
# # 8 clicks - forget wifi settings
# - timing:
# - ON for 5ms to 1s
# - OFF for 5ms to 1s
# - ON for 5ms to 1s
# - OFF for 5ms to 1s
# - ON for 5ms to 1s
# - OFF for 5ms to 1s
# - ON for 5ms to 1s
# - OFF for 5ms to 1s
# - ON for 5ms to 1s
# - OFF for 5ms to 1s
# - ON for 5ms to 1s
# - OFF for 5ms to 1s
# - ON for 5ms to 1s
# - OFF for 5ms to 1s
# - ON for 5ms to 1s
# then:
# lambda: |-
# ESP_LOGW("DMF", "Erase settings and restart...");
# id(mode_auto_open) = false;
# id(mode_auto_open_once) = false;
# id(mode_auto_reject) = false;
# id(mode_mute) = false;
# id(mode_mute_once) = false;
# wifi::global_wifi_component->save_wifi_sta("-----", "");
# delay(500);
# ESP.restart();