reorganize examples

This commit is contained in:
GrKoR
2021-04-22 22:05:06 +03:00
parent e893e5a2e4
commit a5e58580ce
7 changed files with 98 additions and 6 deletions

10
examples/advanced/.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
# Gitignore settings for ESPHome
# This is an example and may include too much for your use-case.
# You can modify this file to suit your needs.
/.esphome/
**/.pioenvs/
**/.piolibdeps/
**/lib/
**/src/
**/platformio.ini
/secrets.yaml

View File

@@ -0,0 +1,103 @@
# DON'T COMPILE THIS FILE
# This file contains common settings for all air conditioners of your house
esphome:
name: $devicename
platform: ESP8266
board: esp12e
includes:
- aux_ac_custom_component.h
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
manual_ip:
static_ip: ${wifi_ip}
gateway: !secret wifi_gateway
subnet: !secret wifi_subnet
ap:
ssid: ${upper_devicename} Hotspot
password: !secret wifi_ap_pass
use_address: ${wifi_ota_ip}
captive_portal:
debug:
logger:
level: DEBUG
baud_rate: 0
api:
password: !secret api_pass
ota:
password: !secret ota_pass
web_server:
port: 80
auth:
username: !secret web_server_user
password: !secret web_server_password
# UART0 configuration for AUX air conditioner communication
uart:
id: ac_uart_bus
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 4800
data_bits: 8
parity: EVEN
stop_bits: 1
climate:
# register custom AC climate
- platform: custom
lambda: |-
extern AirCon acAirCon;
if (!acAirCon.get_initialized()) acAirCon.initAC(id(ac_uart_bus));
App.register_component(&acAirCon);
return {&acAirCon};
climates:
- name: ${upper_devicename}
sensor:
# just wifi signal strength for debug purpose only
- platform: wifi_signal
name: ${upper_devicename} WiFi Signal
update_interval: 30s
unit_of_measurement: "dBa"
accuracy_decimals: 0
- platform: custom
# temperature sensors of AC
# outdoor temperature currently shows weather on Mars; need more statistics and some smart guys for decoding =)
# ambient temperature is an air temperature from indor AC unit
lambda: |-
extern AirCon acAirCon;
if (!acAirCon.get_initialized()) acAirCon.initAC(id(ac_uart_bus));
App.register_component(&acAirCon);
return {acAirCon.sensor_outdoor_temperature, acAirCon.sensor_ambient_temperature};
sensors:
- name: ${upper_devicename} outdoor temperature
unit_of_measurement: "°C"
accuracy_decimals: 1
- name: ${upper_devicename} ambient temperature
unit_of_measurement: "°C"
accuracy_decimals: 1
text_sensor:
# firmvare version - version of custom component
- platform: custom
lambda: |-
auto aircon_firmware_version = new AirConFirmwareVersion();
App.register_component(aircon_firmware_version);
return {aircon_firmware_version};
text_sensors:
name: ${upper_devicename} firmware version
icon: "mdi:chip"

View File

@@ -0,0 +1,17 @@
# compile this file with ESPHome
# This file contains unique settings for specific air conditioner
#===================================================================================
# KITCHEN AIR CONDITIONER
#===================================================================================
substitutions:
devicename: kitchen_ac
upper_devicename: Kitchen AC
# use different wifi_ip and wifi_ota_ip in case of esp ip-address change
# if ip haven't changed wifi_ip and wifi_ota_ip should be the same
wifi_ip: !secret wifi_ip_kitchen
wifi_ota_ip: !secret wifi_ota_ip_kitchen
<<: !include ac_common.yaml

View File

@@ -0,0 +1,17 @@
# compile this file with ESPHome
# This file contains unique settings for specific air conditioner
#===================================================================================
# LIVINGROOM AIR CONDITIONER
#===================================================================================
substitutions:
devicename: livingroom_ac
upper_devicename: Livingroom AC
# use different wifi_ip and wifi_ota_ip in case of esp ip-address change
# if ip haven't changed wifi_ip and wifi_ota_ip should be the same
wifi_ip: !secret wifi_ip_livingroom
wifi_ota_ip: !secret wifi_ota_ip_livingroom
<<: !include ac_common.yaml