20240410
This commit is contained in:
474
esphome/cfg_experimental/display-ttgo.yaml
Normal file
474
esphome/cfg_experimental/display-ttgo.yaml
Normal file
@@ -0,0 +1,474 @@
|
||||
# ESPHome code for the LilyGO TTGO Display
|
||||
# Copyright 2023 by Smart Home Junkie
|
||||
#
|
||||
# Visit my website at https://www.smarthomejunkie.net
|
||||
# Watch the tutorial for this display and code at https://youtu.be/LJCeelAzlS0
|
||||
|
||||
substitutions:
|
||||
esp_name: "ttgo-display"
|
||||
|
||||
esphome:
|
||||
name: ${esp_name}
|
||||
comment: ${esp_name}
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: !secret ttgo
|
||||
|
||||
# Define board type
|
||||
esp32:
|
||||
board: esp32dev
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
ota:
|
||||
password: !secret aqs1_ota_passwoord
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: ${esp_name} fallback
|
||||
password: !secret fallback_password
|
||||
|
||||
captive_portal:
|
||||
|
||||
spi:
|
||||
clk_pin: GPIO18
|
||||
mosi_pin: GPIO19
|
||||
|
||||
# Define the rotate variable. This indicates if the pages should be rotated or not
|
||||
globals:
|
||||
- id: rotate
|
||||
type: boolean
|
||||
initial_value: "true"
|
||||
|
||||
# Define time sensor
|
||||
time:
|
||||
- platform: homeassistant
|
||||
id: esptime
|
||||
|
||||
# Define binary sensors
|
||||
binary_sensor:
|
||||
- platform: gpio # Short Press button 0
|
||||
pin:
|
||||
number: GPIO0
|
||||
inverted: true
|
||||
mode:
|
||||
input: true
|
||||
pullup: true
|
||||
name: "Short Press Button 0"
|
||||
id: short_press_button_0
|
||||
on_click:
|
||||
min_length: 1ms
|
||||
max_length: 1000ms
|
||||
then:
|
||||
- display.page.show_previous: my_display
|
||||
- component.update: my_display
|
||||
- platform: gpio # Long Press button 0
|
||||
pin:
|
||||
number: GPIO0
|
||||
inverted: true
|
||||
id: button_2
|
||||
on_click:
|
||||
min_length: 1001ms
|
||||
max_length: 5000ms
|
||||
then:
|
||||
- switch.toggle: backlight
|
||||
- platform: gpio # Short Press button 1
|
||||
pin:
|
||||
number: GPIO35
|
||||
inverted: true
|
||||
name: "Short Press Button 1"
|
||||
id: short_press_button_1
|
||||
on_click:
|
||||
min_length: 1ms
|
||||
max_length: 1000ms
|
||||
then:
|
||||
- display.page.show_next: my_display
|
||||
- component.update: my_display
|
||||
- platform: gpio # Long Press button 1
|
||||
pin:
|
||||
number: GPIO35
|
||||
inverted: true
|
||||
name: "Long Press Button 1"
|
||||
id: long_press_button_1
|
||||
on_click:
|
||||
min_length: 1001ms
|
||||
max_length: 5000ms
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
return id(rotate);
|
||||
then:
|
||||
globals.set:
|
||||
id: rotate
|
||||
value: "false"
|
||||
else:
|
||||
globals.set:
|
||||
id: rotate
|
||||
value: "true"
|
||||
|
||||
# Allow dimmable control of the backlight (pin GPIO4) - Currently not working
|
||||
output:
|
||||
- platform: ledc
|
||||
pin: GPIO4
|
||||
id: gpio4
|
||||
|
||||
light:
|
||||
- platform: monochromatic
|
||||
output: gpio4
|
||||
name: "Backlight"
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
pin: GPIO4
|
||||
id: backlight
|
||||
internal: true
|
||||
|
||||
# Define all the numeric sensors used
|
||||
sensor:
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.subscriptions_short
|
||||
id: subscriptions
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.views
|
||||
id: views
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.ttgo_display_data
|
||||
attribute: netto_power
|
||||
id: nettopower
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.Temperatuur_Zolder_Werkkamer
|
||||
id: office_temperature
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.humidity_zolder_werkkamer
|
||||
id: office_humidity
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.office_multi_sensor_pressure
|
||||
id: office_pressure
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.office_light_sensor
|
||||
id: office_light_sensor
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.ttgo_display_data
|
||||
attribute: temperature
|
||||
id: outside_temperature
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.ttgo_display_data
|
||||
attribute: wind_speed
|
||||
id: wind_speed
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.bitcoin
|
||||
id: bitcoin
|
||||
|
||||
# Define all the string sensors used
|
||||
text_sensor:
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.ttgo_display_data
|
||||
attribute: weather_condition_0
|
||||
id: weather_condition
|
||||
filters:
|
||||
- to_upper:
|
||||
|
||||
# Define fonts. Use either Google fonts or stored fonts. Stored fonts are stored in esphome/fonts/
|
||||
font:
|
||||
- file:
|
||||
type: gfonts
|
||||
family: Lato
|
||||
weight: 400
|
||||
id: lato
|
||||
size: 20
|
||||
- file:
|
||||
type: gfonts
|
||||
family: Lato
|
||||
weight: 700
|
||||
id: latobold
|
||||
size: 24
|
||||
- file:
|
||||
type: gfonts
|
||||
family: Lato
|
||||
weight: 900
|
||||
id: latoblack
|
||||
size: 30
|
||||
- file:
|
||||
type: gfonts
|
||||
family: Lato
|
||||
weight: 900
|
||||
id: latoblackheading1
|
||||
size: 50
|
||||
- file: "fonts/bitcoin/Ubuntu-BoldItalic.ttf"
|
||||
id: bitcoin_font
|
||||
size: 30
|
||||
|
||||
# Define colors
|
||||
color:
|
||||
- id: RED
|
||||
red: 100%
|
||||
green: 0%
|
||||
blue: 0%
|
||||
- id: GREEN
|
||||
red: 0%
|
||||
green: 100%
|
||||
blue: 0%
|
||||
- id: BLUE
|
||||
red: 0%
|
||||
green: 0%
|
||||
blue: 100%
|
||||
- id: YELLOW
|
||||
red: 100%
|
||||
green: 100%
|
||||
blue: 0%
|
||||
- id: WHITE
|
||||
red: 100%
|
||||
green: 100%
|
||||
blue: 100%
|
||||
- id: ORANGE
|
||||
red: 100%
|
||||
green: 67%
|
||||
blue: 20%
|
||||
|
||||
# Define all the images used. Store the images in the images folder within the esphome folder (esphome/images/)
|
||||
image:
|
||||
- file: "images/youtube.png"
|
||||
id: youtube_image
|
||||
resize: 80x80
|
||||
type: RGB24
|
||||
- file: "images/logo.jpg"
|
||||
id: logo
|
||||
resize: 120x120
|
||||
type: RGB24
|
||||
- file: "images/electricity-icon.png"
|
||||
id: electricity_image
|
||||
resize: 80x80
|
||||
type: RGB24
|
||||
- file: "images/bitcoin_logo.png"
|
||||
id: bitcoin_logo
|
||||
resize: 80x80
|
||||
type: RGB24
|
||||
- file: "images/wind_icon.png"
|
||||
id: wind_icon
|
||||
resize: 30x30
|
||||
type: RGB24
|
||||
- file: "images/thermometer_icon.png"
|
||||
id: thermometer_icon
|
||||
resize: 30x30
|
||||
type: RGB24
|
||||
|
||||
# Define animations
|
||||
animation:
|
||||
- file: "images/weather.gif"
|
||||
id: weather_animation
|
||||
resize: 80x80
|
||||
type: RGB24
|
||||
|
||||
# Define the graphs for sensors that you want to show on the display
|
||||
graph:
|
||||
- id: office_temperature_graph
|
||||
sensor: office_temperature
|
||||
duration: 4h
|
||||
width: 220
|
||||
height: 90
|
||||
x_grid: 1h
|
||||
y_grid: 5
|
||||
min_range: 5
|
||||
max_range: 35
|
||||
min_value: 5
|
||||
max_value: 35
|
||||
color: GREEN
|
||||
- id: office_humidity_graph
|
||||
sensor: office_humidity
|
||||
duration: 4h
|
||||
width: 220
|
||||
height: 90
|
||||
x_grid: 1h
|
||||
y_grid: 25
|
||||
min_range: 1
|
||||
max_range: 100
|
||||
min_value: 1
|
||||
max_value: 100
|
||||
color: BLUE
|
||||
- id: office_pressure_graph
|
||||
sensor: office_pressure
|
||||
duration: 4h
|
||||
width: 220
|
||||
height: 90
|
||||
x_grid: 1h
|
||||
y_grid: 100.0
|
||||
color: YELLOW
|
||||
- id: office_light_sensor_graph
|
||||
duration: 4h
|
||||
width: 220
|
||||
height: 90
|
||||
x_grid: 1h
|
||||
traces:
|
||||
- sensor: office_light_sensor
|
||||
color: ORANGE
|
||||
line_type: SOLID
|
||||
line_thickness: 5
|
||||
|
||||
# Define qr code locations
|
||||
qr_code:
|
||||
- id: smarthomejunkie_website
|
||||
value: smarthomejunkie.net
|
||||
|
||||
# Set up the display. This is the main part of the code
|
||||
display:
|
||||
- platform: st7789v
|
||||
model: TTGO_TDISPLAY_135x240
|
||||
backlight_pin: GPIO4
|
||||
cs_pin: GPIO5
|
||||
dc_pin: GPIO16
|
||||
reset_pin: GPIO23
|
||||
rotation: 90°
|
||||
update_interval: 1s
|
||||
id: my_display
|
||||
pages: # Define the pages
|
||||
# - id: showintro
|
||||
# lambda: |-
|
||||
# it.image(0, 10, id(logo));
|
||||
# it.printf(135, 10, id(latoblack), WHITE, "SMART");
|
||||
# it.printf(140, 50, id(latoblack), WHITE, "HOME");
|
||||
# it.printf(130, 90, id(latoblack), WHITE, "JUNKIE");
|
||||
- id: showtime
|
||||
lambda: |-
|
||||
it.strftime(45, 20, id(latoblack), "%d-%m-%Y", id(esptime).now());
|
||||
it.strftime(25, 55, id(latoblackheading1), "%H:%M:%S", id(esptime).now());
|
||||
# - id: showsubscribers
|
||||
# lambda: |-
|
||||
# it.printf(0,0,id(latoblack), WHITE, "SUBSCRIBERS");
|
||||
# it.image(0, 40, id(youtube_image));
|
||||
# if (id(subscriptions).has_state()) {
|
||||
# it.printf(95, 60, id(latoblack), WHITE, "%.1fK", id(subscriptions).state);
|
||||
# } else {
|
||||
# it.printf(95, 65, id(lato), WHITE, "LOADING...");
|
||||
# }
|
||||
# - id: showviews
|
||||
# lambda: |-
|
||||
# it.printf(0,0,id(latoblack), WHITE, "VIEWS");
|
||||
# it.image(0, 40, id(youtube_image));
|
||||
# if (id(views).has_state()) {
|
||||
# it.printf(95, 60, id(latoblack), WHITE, "%.0f", id(views).state);
|
||||
# } else {
|
||||
# it.printf(95, 65, id(lato), WHITE, "LOADING...");
|
||||
# }
|
||||
- id: shownettopower
|
||||
lambda: |-
|
||||
it.printf(0,0,id(latoblack), WHITE, "NETTO POWER");
|
||||
it.image(0, 40, id(electricity_image));
|
||||
if (id(nettopower).has_state()) {
|
||||
if (id(nettopower).state > -1000) {
|
||||
it.printf(95, 60, id(latoblack), WHITE, "%.0f Watt", id(nettopower).state);
|
||||
} else {
|
||||
it.printf(95, 60, id(latobold), WHITE, "%.0f Watt", id(nettopower).state);
|
||||
}
|
||||
} else {
|
||||
it.printf(95, 65, id(lato), WHITE, "LOADING...");
|
||||
}
|
||||
# - id: showbitcoin
|
||||
# lambda: |-
|
||||
# it.printf(0,0,id(bitcoin_font), WHITE, "bitcoin");
|
||||
# it.image(0, 40, id(bitcoin_logo));
|
||||
# if (id(bitcoin).has_state()) {
|
||||
# it.printf(95, 60, id(bitcoin_font), WHITE, "%.0f", id(bitcoin).state);
|
||||
# } else {
|
||||
# it.printf(95, 65, id(lato), WHITE, "LOADING...");
|
||||
# }
|
||||
- id: show_office_temperature_graph
|
||||
lambda: |-
|
||||
if (id(office_temperature).has_state()) {
|
||||
it.printf(0,0,id(latoblack), WHITE, "TEMP: %.1f °C", id(office_temperature).state);
|
||||
it.graph(10, 40, id(office_temperature_graph));
|
||||
} else {
|
||||
it.printf(0,0,id(latoblack), WHITE, "TEMPERATURE");
|
||||
it.printf(80, 65, id(lato), WHITE, "LOADING...");
|
||||
}
|
||||
- id: show_office_humidity_graph
|
||||
lambda: |-
|
||||
if (id(office_humidity).has_state()) {
|
||||
it.printf(0,0,id(latoblack), WHITE, "HUM: %.0f %%", id(office_humidity).state);
|
||||
it.graph(10, 40, id(office_humidity_graph));
|
||||
} else {
|
||||
it.printf(0,0,id(latoblack), WHITE, "HUMIDITY");
|
||||
it.printf(80, 65, id(lato), WHITE, "LOADING...");
|
||||
}
|
||||
# - id: show_office_pressure_graph
|
||||
# lambda: |-
|
||||
# if (id(office_pressure).has_state()) {
|
||||
# it.printf(0,0,id(latoblack), WHITE, "PRS: %.0f hPA", id(office_pressure).state);
|
||||
# it.graph(10, 40, id(office_pressure_graph));
|
||||
# } else {
|
||||
# it.printf(0,0,id(latoblack), WHITE, "PRESSURE");
|
||||
# it.printf(80, 65, id(lato), WHITE, "LOADING...");
|
||||
# }
|
||||
# - id: show_office_light_sensor_graph
|
||||
# lambda: |-
|
||||
# if (id(office_light_sensor).has_state()) {
|
||||
# it.printf(0,0,id(latoblack), WHITE, "LUX: %.0f lx", id(office_light_sensor).state);
|
||||
# it.graph(10, 40, id(office_light_sensor_graph));
|
||||
# } else {
|
||||
# it.printf(0,0,id(latoblack), WHITE, "LUX");
|
||||
# it.printf(80, 65, id(lato), WHITE, "LOADING...");
|
||||
# }
|
||||
- id: show_weather
|
||||
lambda: |-
|
||||
id(weather_animation).next_frame();
|
||||
it.image(0, 0, id(weather_animation), COLOR_ON, COLOR_OFF);
|
||||
if (id(weather_condition).state == "CLOUDY" ||
|
||||
id(weather_condition).state == "RAINY" ||
|
||||
id(weather_condition).state == "FOG" ||
|
||||
id(weather_condition).state == "HAIL" ||
|
||||
id(weather_condition).state == "SNOWY" ||
|
||||
id(weather_condition).state == "SUNNY" ||
|
||||
id(weather_condition).state == "WINDY" ) {
|
||||
it.printf(110,0,id(latoblack), WHITE,"%s",id(weather_condition).state.c_str());
|
||||
}
|
||||
if (id(weather_condition).state == "LIGTNING" ||
|
||||
id(weather_condition).state == "POURING" ) {
|
||||
it.printf(110,0,id(latobold), WHITE,"%s",id(weather_condition).state.c_str());
|
||||
}
|
||||
if (id(weather_condition).state == "PARTLYCLOUDY") {
|
||||
it.printf(110,0,id(latoblack), WHITE,"PARTLY");
|
||||
it.printf(110,35,id(latoblack), WHITE,"CLOUDY");
|
||||
}
|
||||
if (id(weather_condition).state == "SNOWY-RAIN") {
|
||||
it.printf(110,0,id(latoblack), WHITE,"SNOWY");
|
||||
it.printf(110,35,id(latoblack), WHITE,"RAIN");
|
||||
}
|
||||
if (id(weather_condition).state == "LIGHTNING-RAINY") {
|
||||
it.printf(110,0,id(latobold), WHITE,"LIGHTNING");
|
||||
it.printf(110,35,id(latobold), WHITE,"RAINY");
|
||||
}
|
||||
if (id(weather_condition).state == "WINDY-VARIANT") {
|
||||
it.printf(110,0,id(latoblack), WHITE,"WINDY");
|
||||
}
|
||||
if (id(weather_condition).state == "CLEAR-NIGHT") {
|
||||
it.printf(110,0,id(latoblack), WHITE,"CLEAR");
|
||||
it.printf(110,35,id(latoblack), WHITE,"NIGHT");
|
||||
}
|
||||
if (id(weather_condition).state == "EXCEPTIONAL") {
|
||||
it.printf(110,0,id(latobold), WHITE,"EXCEPTIONAL");
|
||||
}
|
||||
it.image(0, 100, id(thermometer_icon));
|
||||
it.printf(35,100,id(latobold), WHITE,"%.1f °C", id(outside_temperature).state);
|
||||
it.image(110, 100, id(wind_icon));
|
||||
it.printf(145,100,id(latobold), WHITE,"%.2f m/s", id(wind_speed).state);
|
||||
# - id: showqrcode
|
||||
# lambda: |-
|
||||
# it.qr_code(60, 5, id(smarthomejunkie_website), WHITE, 5);
|
||||
|
||||
# Define the cycle interval of the pages.
|
||||
interval:
|
||||
- interval: 5s
|
||||
then:
|
||||
if:
|
||||
condition:
|
||||
lambda: 'return id(rotate);'
|
||||
then:
|
||||
- display.page.show_next: my_display
|
||||
- component.update: my_display
|
||||
113
esphome/cfg_experimental/dsmr-meter.yaml
Normal file
113
esphome/cfg_experimental/dsmr-meter.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
|
||||
substitutions:
|
||||
device_name: "dsmr"
|
||||
friendly_name: "dsmr"
|
||||
comment: "esp8266"
|
||||
location: "zolder"
|
||||
api_password: !secret esp_P1_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret esp_P1_ip
|
||||
pin_data: GPIO12
|
||||
pin_status: GPIO2
|
||||
|
||||
|
||||
packages:
|
||||
board: !include boards/esp12f.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
#status: !include templates/status.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
#uart config for DSMR v2 (9600-7N1)
|
||||
uart:
|
||||
rx_pin: ${pin_data}
|
||||
baud_rate: 9600
|
||||
data_bits: 7
|
||||
parity: NONE
|
||||
stop_bits: 1
|
||||
id: dmsr_uart
|
||||
|
||||
#uart config for dsmr (115200-8N1)
|
||||
# uart:
|
||||
# rx_pin: ${pin_data}
|
||||
# baud_rate: 115200
|
||||
# data_bits: 8
|
||||
# parity: NONE
|
||||
# stop_bits: 1
|
||||
# id: dmsr_uart
|
||||
|
||||
dsmr:
|
||||
crc_check: false
|
||||
uart_id: dmsr_uart
|
||||
|
||||
#https://www.esphome.io/components/sensor/dsmr.html?highlight=dsmr#component-hub
|
||||
sensor:
|
||||
- platform: dsmr
|
||||
energy_delivered_tariff1:
|
||||
name: energy_delivered_tariff1
|
||||
energy_delivered_tariff2:
|
||||
name: energy_delivered_tariff2
|
||||
energy_returned_tariff1:
|
||||
name: energy_returned_tariff1
|
||||
energy_returned_tariff2:
|
||||
name: energy_returned_tariff2
|
||||
power_delivered:
|
||||
name: power_delivered
|
||||
power_returned:
|
||||
name: power_returned
|
||||
electricity_failures:
|
||||
name: electricity_failures
|
||||
electricity_long_failures:
|
||||
name: Long Electricity Failures.
|
||||
electricity_sags_l1:
|
||||
name: Number of voltage sags in phase L1.
|
||||
electricity_sags_l2:
|
||||
name: Number of voltage sags in phase L2.
|
||||
electricity_sags_l3:
|
||||
name: Number of voltage sags in phase L3.
|
||||
electricity_swells_l1:
|
||||
name: Number of voltage swells in phase L1.
|
||||
electricity_swells_l2:
|
||||
name: Number of voltage swells in phase L2.
|
||||
electricity_swells_l3:
|
||||
name: Number of voltage swells in phase L3.
|
||||
voltage_l1:
|
||||
name: Voltage Phase 1.
|
||||
voltage_l2:
|
||||
name: Voltage Phase 2.
|
||||
voltage_l3:
|
||||
name: Voltage Phase 3.
|
||||
current_l1:
|
||||
name: Current Phase 1.
|
||||
current_l2:
|
||||
name: Current Phase 2.
|
||||
current_l3:
|
||||
name: Current Phase 3.
|
||||
power_delivered_l1:
|
||||
name: Power Consumed Phase 1.
|
||||
power_delivered_l2:
|
||||
name: Power Consumed Phase 2.
|
||||
power_delivered_l3:
|
||||
name: Power Consumed Phase 3.
|
||||
power_returned_l1:
|
||||
name: Power Produced Phase 1.
|
||||
power_returned_l2:
|
||||
name: Power Produced Phase 2.
|
||||
power_returned_l3:
|
||||
name: Power Produced Phase 3.
|
||||
gas_delivered:
|
||||
name: Gas Consumed.
|
||||
|
||||
text_sensor:
|
||||
- platform: dsmr
|
||||
identification:
|
||||
name: "dsmr_identification"
|
||||
p1_version:
|
||||
name: "dsmr_p1_version"
|
||||
electricity_tariff:
|
||||
name: "electricity_tariff"
|
||||
|
||||
29
esphome/cfg_experimental/ld2420-test.yaml
Normal file
29
esphome/cfg_experimental/ld2420-test.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
substitutions:
|
||||
device_name: "ld2420test"
|
||||
friendly_name: "ld2420test"
|
||||
comment: "esp32, occup"
|
||||
location: "Zolder"
|
||||
api_password: !secret ld2420_test_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret ld2420_test_ip
|
||||
pin_ld_tx: GPIO19
|
||||
pin_ld_rx: GPIO18
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wroom_arduino.yaml
|
||||
# i2c: !include interfaces/i2c_a.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
# status: !include templates/status.yaml
|
||||
logger: !include templates/nologger.yaml
|
||||
#bt_proxy: !include common/bluetooth.yaml
|
||||
#sensors
|
||||
mmwave: !include sensors/ld2420.yaml
|
||||
|
||||
|
||||
|
||||
|
||||
213
esphome/cfg_experimental/m5-atom-echo.yaml
Normal file
213
esphome/cfg_experimental/m5-atom-echo.yaml
Normal file
@@ -0,0 +1,213 @@
|
||||
substitutions:
|
||||
device_name: "m5-atom-echo"
|
||||
friendly_name: "M5 atom echo"
|
||||
comment: "esp32, mic, dac, RGB, Btn"
|
||||
api_password: !secret esp32-atom-echo_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret esp32-atom-echo_ip
|
||||
pin_lrclk: GPIO33
|
||||
pin_bclk: GPIO19
|
||||
pin_i2sdin: GPIO23
|
||||
pin_i2sdout: GPIO22
|
||||
pin_button: GPIO39
|
||||
pin_LEDS: GPIO27
|
||||
|
||||
packages:
|
||||
connection: !include common/wifi.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
friendly_name: ${friendly_name}
|
||||
project:
|
||||
name: m5stack.atom-echo-voice-assistant
|
||||
version: "1.0"
|
||||
min_version: 2023.10.0
|
||||
on_boot:
|
||||
- priority: -100
|
||||
then:
|
||||
- wait_until: api.connected
|
||||
- delay: 1s
|
||||
- if:
|
||||
condition:
|
||||
switch.is_on: use_wake_word
|
||||
then:
|
||||
- voice_assistant.start_continuous:
|
||||
|
||||
esp32:
|
||||
board: m5stack-atom
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
improv_serial:
|
||||
|
||||
i2s_audio:
|
||||
i2s_lrclk_pin: GPIO33
|
||||
i2s_bclk_pin: GPIO19
|
||||
|
||||
microphone:
|
||||
- platform: i2s_audio
|
||||
id: echo_microphone
|
||||
i2s_din_pin: GPIO23
|
||||
adc_type: external
|
||||
pdm: true
|
||||
|
||||
speaker:
|
||||
- platform: i2s_audio
|
||||
id: echo_speaker
|
||||
i2s_dout_pin: GPIO22
|
||||
dac_type: external
|
||||
mode: mono
|
||||
|
||||
voice_assistant:
|
||||
id: va
|
||||
microphone: echo_microphone
|
||||
speaker: echo_speaker
|
||||
noise_suppression_level: 2
|
||||
auto_gain: 31dBFS
|
||||
volume_multiplier: 2.0
|
||||
vad_threshold: 3
|
||||
on_listening:
|
||||
- light.turn_on:
|
||||
id: led
|
||||
blue: 100%
|
||||
red: 0%
|
||||
green: 0%
|
||||
brightness: 100%
|
||||
effect: pulse
|
||||
on_tts_start:
|
||||
- light.turn_on:
|
||||
id: led
|
||||
blue: 0%
|
||||
red: 0%
|
||||
green: 100%
|
||||
brightness: 100%
|
||||
effect: pulse
|
||||
on_end:
|
||||
- delay: 100ms
|
||||
- wait_until:
|
||||
not:
|
||||
speaker.is_playing:
|
||||
- script.execute: reset_led
|
||||
on_error:
|
||||
- light.turn_on:
|
||||
id: led
|
||||
blue: 0%
|
||||
red: 100%
|
||||
green: 0%
|
||||
brightness: 100%
|
||||
effect: none
|
||||
- delay: 1s
|
||||
- script.execute: reset_led
|
||||
- script.wait: reset_led
|
||||
- lambda: |-
|
||||
if (code == "wake-provider-missing" || code == "wake-engine-missing") {
|
||||
id(use_wake_word).turn_off();
|
||||
}
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO39
|
||||
inverted: true
|
||||
name: Button
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
id: echo_button
|
||||
on_click:
|
||||
- if:
|
||||
condition:
|
||||
switch.is_off: use_wake_word
|
||||
then:
|
||||
- if:
|
||||
condition: voice_assistant.is_running
|
||||
then:
|
||||
- voice_assistant.stop:
|
||||
- script.execute: reset_led
|
||||
else:
|
||||
- voice_assistant.start:
|
||||
else:
|
||||
- voice_assistant.stop
|
||||
- delay: 1s
|
||||
- script.execute: reset_led
|
||||
- script.wait: reset_led
|
||||
- voice_assistant.start_continuous:
|
||||
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
id: led
|
||||
name: None
|
||||
disabled_by_default: true
|
||||
entity_category: config
|
||||
pin: GPIO27
|
||||
default_transition_length: 0s
|
||||
chipset: SK6812
|
||||
num_leds: 1
|
||||
rgb_order: grb
|
||||
rmt_channel: 0
|
||||
effects:
|
||||
- pulse:
|
||||
transition_length: 250ms
|
||||
update_interval: 250ms
|
||||
|
||||
script:
|
||||
- id: reset_led
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
- switch.is_on: use_wake_word
|
||||
- switch.is_on: use_listen_light
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: led
|
||||
blue: 100%
|
||||
red: 100%
|
||||
green: 0%
|
||||
brightness: 100%
|
||||
effect: none
|
||||
else:
|
||||
- light.turn_off: led
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: Use wake word
|
||||
id: use_wake_word
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
entity_category: config
|
||||
on_turn_on:
|
||||
- lambda: id(va).set_use_wake_word(true);
|
||||
- if:
|
||||
condition:
|
||||
not:
|
||||
- voice_assistant.is_running
|
||||
then:
|
||||
- voice_assistant.start_continuous
|
||||
- script.execute: reset_led
|
||||
on_turn_off:
|
||||
- voice_assistant.stop
|
||||
- lambda: id(va).set_use_wake_word(false);
|
||||
- script.execute: reset_led
|
||||
- platform: template
|
||||
name: Use Listen Light
|
||||
id: use_listen_light
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
entity_category: config
|
||||
on_turn_on:
|
||||
- script.execute: reset_led
|
||||
on_turn_off:
|
||||
- script.execute: reset_led
|
||||
|
||||
external_components:
|
||||
- source: github://pr#5230
|
||||
components:
|
||||
- esp_adf
|
||||
refresh: 0s
|
||||
|
||||
esp_adf:
|
||||
38
esphome/cfg_experimental/mailboxsensor.yaml
Executable file
38
esphome/cfg_experimental/mailboxsensor.yaml
Executable file
@@ -0,0 +1,38 @@
|
||||
substitutions:
|
||||
device_name: "mailboxsensor"
|
||||
friendly_name: "mailbox sensor"
|
||||
comment: "esp32, distance"
|
||||
api_password: !secret mailboxsensor_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret mailboxsensor_ip
|
||||
pin_echo: GPIO25
|
||||
pin_trig: GPIO26
|
||||
pin_vbatt: GPIO35
|
||||
update_interval: 60s
|
||||
run_duration: 20s
|
||||
sleep_duration: 1800s
|
||||
pin_wake: GPIO14
|
||||
pin_status: GPIO5
|
||||
mqtt_broker_ip: !secret mqtt_broker_ip
|
||||
mqtt_broker_user: !secret mqtt_broker_user
|
||||
mqtt_broke_pass: !secret mqtt_broker_pass
|
||||
mqtt_ota_topic: "esphomeOTA/mailbox"
|
||||
|
||||
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wroom_arduino.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
device_base: !include common/common.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
#bt_proxy: !include common/bluetooth.yaml
|
||||
distance: !include sensors/distance_hc-004.yaml
|
||||
battery: !include sensors/battery.yaml
|
||||
deepsleep: !include common/deepsleep.yaml
|
||||
status: !include templates/status.yaml
|
||||
|
||||
|
||||
47
esphome/cfg_experimental/t-eth-lite-poe.yaml
Normal file
47
esphome/cfg_experimental/t-eth-lite-poe.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
substitutions:
|
||||
device_name: "t-eth-lite-poe"
|
||||
friendly_name: "t-eth-lite-poe"
|
||||
comment: "esp32-S3"
|
||||
location: "zolder"
|
||||
api_password: !secret T-eth-poe-lite_api
|
||||
ip: !secret T-eth-poe-lite_ip
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32-S3.yaml
|
||||
device_base: !include common/common.yaml
|
||||
# status: !include templates/status.yaml
|
||||
ota: !include common/ota.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
|
||||
external_components:
|
||||
- source: github://fightforlife/esphome-components
|
||||
components: [ ethernet ]
|
||||
refresh: 0s
|
||||
|
||||
spi:
|
||||
clk_pin: 10
|
||||
mosi_pin: 12
|
||||
miso_pin: 11
|
||||
|
||||
ethernet:
|
||||
type: W5500
|
||||
cs_pin: 9
|
||||
clk_pin: 10
|
||||
mosi_pin: 12
|
||||
miso_pin: 11
|
||||
interrupt_pin: 13
|
||||
clock_speed: 25
|
||||
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
100
esphome/cfg_experimental/wekker.bak
Executable file
100
esphome/cfg_experimental/wekker.bak
Executable file
@@ -0,0 +1,100 @@
|
||||
substitutions:
|
||||
device_name: "wekker"
|
||||
friendly_name: "wekker"
|
||||
comment: "esp32, lcd wt32-sc01"
|
||||
location: "slaaplamer"
|
||||
api_password: !secret wekker_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret wekker_ip
|
||||
# pin_bl: GPIO23
|
||||
# pin_clk: GPIO14
|
||||
# pin_mosi: GPIO13
|
||||
# pin_miso: GPIO12
|
||||
# pin_cs: GPIO15
|
||||
# pin_dc: GPIO21
|
||||
# pin_lcdrst: GPIO22
|
||||
# pin_sda: GPIO18
|
||||
# pin_scl: GPIO19
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
esp32:
|
||||
board: esp-wrover-kit
|
||||
framework:
|
||||
type: arduino
|
||||
|
||||
# packages:
|
||||
# device_base: !include includes/common_settings.yaml
|
||||
|
||||
#esp32_ble_tracker:
|
||||
|
||||
#bluetooth_proxy:
|
||||
# active: true
|
||||
|
||||
# time:
|
||||
# - platform: homeassistant
|
||||
# id: homeassistant_time
|
||||
|
||||
# output:
|
||||
# - platform: gpio
|
||||
# pin: GPIO23
|
||||
# id: tst_Backlight
|
||||
|
||||
# light:
|
||||
# - platform: binary
|
||||
# name: "${friendly_name} Back Light"
|
||||
# output: tst_Backlight
|
||||
# id: ${id_prefix}_backlight
|
||||
# restore_mode: ALWAYS_ON
|
||||
|
||||
# spi:
|
||||
# clk_pin: GPIO14
|
||||
# mosi_pin: GPIO13
|
||||
# miso_pin: GPIO12
|
||||
|
||||
# display:
|
||||
# - platform: ili9xxx
|
||||
# id: ${id_prefix}_display
|
||||
# model: ST7796
|
||||
# cs_pin: GPIO15
|
||||
# dc_pin: GPIO21
|
||||
# reset_pin: GPIO22
|
||||
# rotation: 270
|
||||
# pages:
|
||||
# - id: page1
|
||||
# lambda: |-
|
||||
# it.printf(64,0, id(my_font), TextAlign::TOP_CENTER, "WT32-SC01");
|
||||
# it.strftime(64, 40, id(my_font), TextAlign::BASELINE_CENTER, "%I:%M:%S %p", id(homeassistant_time).now());
|
||||
# it.printf(64, 60, id(my_font), TextAlign::BOTTOM_CENTER, "Time");
|
||||
# - id: page2
|
||||
# lambda: |-
|
||||
# it.printf(64,0, id(my_font), TextAlign::TOP_CENTER, "WT32-SC01");
|
||||
# it.printf(64, 40, id(my_font), TextAlign::BASELINE_CENTER, "Hello Loryan!");
|
||||
# it.printf(64, 60, id(my_font), TextAlign::BOTTOM_CENTER, "Hi from down here");
|
||||
|
||||
# font:
|
||||
# - file:
|
||||
# type: gfonts
|
||||
# family: "Open Sans"
|
||||
# id: my_font
|
||||
# size: 20
|
||||
|
||||
# color:
|
||||
# - id: my_red
|
||||
# red: 100%
|
||||
# green: 3%
|
||||
# blue: 5%
|
||||
# - id: my_white
|
||||
# red: 100%
|
||||
# green: 100%
|
||||
# blue: 100%
|
||||
|
||||
# interval:
|
||||
# - interval: 5s
|
||||
# then:
|
||||
# - display.page.show_next: wt32_sc01_display
|
||||
# - component.update: wt32_sc01_display
|
||||
199
esphome/cfg_experimental/wekker.yaml
Normal file
199
esphome/cfg_experimental/wekker.yaml
Normal file
@@ -0,0 +1,199 @@
|
||||
substitutions:
|
||||
device_name: "wekker"
|
||||
friendly_name: "wekker"
|
||||
comment: "esp32, lcd wt32-sc01"
|
||||
location: "slaaplamer"
|
||||
api_password: !secret wekker_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
ip: !secret wekker_ip
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
id_prefix: wekker
|
||||
pin_lcd_bl: GPIO23
|
||||
pin_clk: GPIO14
|
||||
pin_mosi: GPIO13
|
||||
pin_miso: GPIO12
|
||||
pin_cs: GPIO15
|
||||
pin_dc: GPIO21
|
||||
pin_lcdrst: GPIO22
|
||||
pin_sda: GPIO18
|
||||
pin_scl: GPIO19
|
||||
pin_rotsw: GPIO33
|
||||
pin_rotA: GPIO32
|
||||
pin_rotB: GPIO27
|
||||
|
||||
#datasheet: https://files.seeedstudio.com/products/102991455/WT32-SC01-datasheet.pdf
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wrover.yaml
|
||||
i2c: !include interfaces/i2c_a.yaml
|
||||
spi: !include interfaces/spi.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
device_base: !include common/common.yaml
|
||||
time: !include templates/time.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
backlight: !include templates/backlight.yaml
|
||||
color: !include templates/color.yaml
|
||||
touch: !include templates/touchscreen_ft63x6.yaml
|
||||
|
||||
sensor:
|
||||
- platform: rotary_encoder
|
||||
name: "Rotary Encoder"
|
||||
id: rotary
|
||||
pin_a: ${pin_rotA}
|
||||
pin_b: ${pin_rotB}
|
||||
on_anticlockwise:
|
||||
- if:
|
||||
condition:
|
||||
display.is_displaying_page: menu
|
||||
then:
|
||||
- display_menu.down: menu_disp
|
||||
else:
|
||||
- number.increment:
|
||||
id: num_bright
|
||||
cycle: false
|
||||
on_clockwise:
|
||||
- if:
|
||||
condition:
|
||||
display.is_displaying_page: menu
|
||||
then:
|
||||
- display_menu.up: menu_disp
|
||||
else:
|
||||
- number.decrement:
|
||||
id: num_bright
|
||||
cycle: false
|
||||
|
||||
image:
|
||||
- file: "include/4dir.jpg"
|
||||
id: multidir
|
||||
resize: 150x150
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
id: num_bright
|
||||
optimistic: true
|
||||
min_value: 0.05
|
||||
max_value: 1
|
||||
step: 0.05
|
||||
on_value:
|
||||
then:
|
||||
# lambda: |-
|
||||
# ESP_LOGI("number", "new brightness value: %f", x);
|
||||
- light.control:
|
||||
id: backlight
|
||||
brightness: !lambda "return x;"
|
||||
transition_length: 0.1s
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: ${pin_rotsw}
|
||||
inverted: true
|
||||
name: "rotary select"
|
||||
id: rotary_button
|
||||
filters:
|
||||
- delayed_on: 10ms
|
||||
- delayed_off: 30ms
|
||||
on_press:
|
||||
- if:
|
||||
condition:
|
||||
display.is_displaying_page: menu
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
display_menu.is_active: menu_disp
|
||||
then:
|
||||
- display_menu.enter: menu_disp
|
||||
else:
|
||||
- display_menu.show: menu_disp
|
||||
on_double_click:
|
||||
then:
|
||||
- display.page.show: flipclock
|
||||
- platform: touchscreen
|
||||
name: menu
|
||||
x_min: 380
|
||||
x_max: 480
|
||||
y_min: 280
|
||||
y_max: 320
|
||||
page_id: flipclock
|
||||
on_click:
|
||||
then:
|
||||
- display.page.show: menu
|
||||
- display_menu.show:
|
||||
|
||||
|
||||
font:
|
||||
- file: 'fonts/Solari.ttf'
|
||||
id: flipper
|
||||
size: 160
|
||||
glyphs: ['-',' ', '°', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C',':']
|
||||
- file:
|
||||
type: gfonts
|
||||
family: Roboto
|
||||
size: 40
|
||||
id: menu_font
|
||||
# - file:
|
||||
# type: gfonts
|
||||
# family: Roboto
|
||||
# size: 30
|
||||
# id: dir_font
|
||||
# glyphs: ['U','p', 'D', 'o', 'w', 'n', 'L', 'e', 'f', 't', 'R', 'i', 'g', 'h']
|
||||
|
||||
|
||||
display:
|
||||
- platform: ili9xxx
|
||||
id: ${id_prefix}_display
|
||||
model: ST7796
|
||||
cs_pin: ${pin_cs}
|
||||
dc_pin: ${pin_dc}
|
||||
reset_pin: ${pin_lcdrst}
|
||||
rotation: 270
|
||||
pages:
|
||||
- id: flipclock
|
||||
lambda: |-
|
||||
it.strftime(0, 80, id(flipper), TextAlign::TOP_LEFT, "%H:%M", id(homeassistant_time).now());
|
||||
// it.filled_rectangle(360, 250, 470, 310, id(green));
|
||||
// it.printf(365,255, id(menu_font), id(black), TextAlign::TOP_LEFT, "Menu");
|
||||
// it.image(210,370, id(multidir));
|
||||
- id: menu
|
||||
lambda: |-
|
||||
const auto display_width = it.get_width();
|
||||
const auto display_height = it.get_height();
|
||||
//it.filled_rectangle(360, 250, 470, 310, id(green));
|
||||
//it.printf(365,255, id(menu_font), id(black), TextAlign::TOP_LEFT, "Exit");
|
||||
|
||||
|
||||
// Arguments: it.menu(x, y, menu, width, height);
|
||||
it.menu(0, 60, id(menu_disp), display_width/2, 150);
|
||||
|
||||
|
||||
#https://www.esphome.io/components/display_menu/graphical_display_menu.html?highlight=graphical_display_menu
|
||||
graphical_display_menu:
|
||||
id: menu_disp
|
||||
font: menu_font
|
||||
display: ${id_prefix}_display
|
||||
on_redraw:
|
||||
then:
|
||||
component.update: ${id_prefix}_display
|
||||
on_leave:
|
||||
then:
|
||||
- display.page.show: flipclock
|
||||
- lambda: 'ESP_LOGI("display_menu", "switch leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
|
||||
active: false
|
||||
mode: rotary
|
||||
items:
|
||||
- type: number
|
||||
text: Brightness
|
||||
number: num_bright
|
||||
- type: Label
|
||||
text: Alarm
|
||||
- type: back
|
||||
text: Back
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user