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

@@ -0,0 +1,120 @@
esphome:
name: $mdns_name
build_path: $build_path
platform: ESP8266
board: $board
comment: "espdomofon.ru"
esp8266_restore_from_flash: true
project:
name: "espdomofon.ru"
version: "1.6.2"
platformio_options:
build_flags: -DBEARSSL_SSL_BASIC -DMMU_IRAM_SIZE=0xC000 -DMMU_ICACHE_SIZE=0x4000 -DMMU_IRAM_HEAP
on_boot:
priority: -100
then:
- script.execute: state_ready
- light.turn_on:
id: rgb_led
effect: "Domofon"
dashboard_import:
package_import_url: github://Anonym-tsk/smart-domofon/ge1mer/domofon.yaml@master
wifi:
ssid: $wifi_ssid
password: $wifi_password
fast_connect: on
ap:
ssid: $ap_ssid
password: $ap_password
logger:
baud_rate: 0
logs:
light: INFO
ota:
password: $ota_password
globals:
- id: mode_auto_open
type: bool
restore_value: yes
initial_value: 'false'
- id: mode_auto_open_once
type: bool
restore_value: yes
initial_value: 'false'
- id: mode_auto_reject
type: bool
restore_value: yes
initial_value: 'false'
- id: mode_mute
type: bool
restore_value: yes
initial_value: 'false'
- id: mode_mute_once
type: bool
restore_value: yes
initial_value: 'false'
sensor:
- platform: template
name: "${board_name} Heap Size"
lambda: "return ESP.getFreeHeap();"
update_interval: 20s
unit_of_measurement: bytes
accuracy_decimals: 0
entity_category: "diagnostic"
- platform: uptime
internal: true
id: uptime_sensor
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
text_sensor:
- platform: template
id: uptime_human
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