2024-02-11 18:15:55 +01:00
|
|
|
esphome:
|
|
|
|
name: m5stackfire
|
2024-03-08 14:04:37 +01:00
|
|
|
includes:
|
|
|
|
- my_btmonitor.h
|
|
|
|
libraries:
|
|
|
|
- mbedtls
|
|
|
|
platformio_options:
|
|
|
|
board_upload.flash_size: 16MB
|
|
|
|
board_build.partitions: "../../../m5stackfire_partition.csv"
|
|
|
|
|
|
|
|
esp32:
|
2024-02-11 18:15:55 +01:00
|
|
|
board: m5stack-fire
|
2024-03-08 14:04:37 +01:00
|
|
|
framework:
|
|
|
|
type: arduino
|
2024-02-11 18:15:55 +01:00
|
|
|
|
|
|
|
substitutions:
|
|
|
|
friendly_name: "M5StackFire"
|
|
|
|
|
|
|
|
api:
|
|
|
|
encryption:
|
|
|
|
key: !secret api_encryption_key
|
|
|
|
services:
|
|
|
|
- service: mhz19_calibrate_zero
|
|
|
|
then:
|
|
|
|
- mhz19.calibrate_zero: my_mhz19
|
|
|
|
wifi:
|
|
|
|
ssid: WLAN
|
|
|
|
password: !secret wifi_password
|
|
|
|
|
|
|
|
ota:
|
|
|
|
password: !secret ota_password
|
|
|
|
|
|
|
|
logger:
|
|
|
|
|
|
|
|
# Power Management
|
|
|
|
external_components:
|
|
|
|
- source:
|
|
|
|
type: git
|
|
|
|
url: https://github.com/ssieb/custom_components
|
|
|
|
components: [ip5306]
|
|
|
|
|
|
|
|
ip5306:
|
|
|
|
battery_level:
|
|
|
|
name: ${friendly_name} Battery Percent
|
|
|
|
id: battery_percent
|
|
|
|
charger_connected:
|
|
|
|
name: ${friendly_name} Charger Connected
|
|
|
|
id: connected
|
|
|
|
charge_full:
|
|
|
|
name: ${friendly_name} Charge Full
|
|
|
|
id: full
|
|
|
|
|
|
|
|
# Buttons
|
|
|
|
binary_sensor:
|
|
|
|
- platform: gpio
|
2024-03-01 15:01:56 +01:00
|
|
|
id: m5stackfire_button_left
|
2024-02-11 18:15:55 +01:00
|
|
|
pin:
|
|
|
|
number: 39
|
|
|
|
inverted: true
|
|
|
|
- platform: gpio
|
2024-03-01 15:01:56 +01:00
|
|
|
id: m5stackfire_button_middle
|
2024-02-11 18:15:55 +01:00
|
|
|
pin:
|
|
|
|
number: 38
|
|
|
|
inverted: true
|
|
|
|
on_click:
|
|
|
|
then:
|
|
|
|
- switch.toggle: backlight
|
|
|
|
- platform: gpio
|
2024-03-01 15:01:56 +01:00
|
|
|
id: m5stackfire_button_right
|
2024-02-11 18:15:55 +01:00
|
|
|
pin:
|
|
|
|
number: 37
|
|
|
|
inverted: true
|
2024-03-01 15:01:56 +01:00
|
|
|
- platform: gpio
|
|
|
|
pin: 36
|
|
|
|
name: m5stackfire-motion
|
|
|
|
device_class: motion
|
2024-02-11 18:15:55 +01:00
|
|
|
# GPIO pin of the display backlight
|
|
|
|
switch:
|
|
|
|
- platform: gpio
|
|
|
|
pin: 32
|
|
|
|
name: "Backlight"
|
|
|
|
id: backlight
|
|
|
|
restore_mode: ALWAYS_ON
|
|
|
|
|
|
|
|
light:
|
|
|
|
#- platform: monochromatic # backlight
|
|
|
|
# output: gpio_32_backlight_pwm
|
|
|
|
# name: ${friendly_name} Backlight
|
|
|
|
# id: backlight
|
|
|
|
# restore_mode: ALWAYS_ON
|
|
|
|
- platform: esp32_rmt_led_strip
|
|
|
|
rgb_order: GRB
|
|
|
|
pin: GPIO15
|
|
|
|
num_leds: 10
|
|
|
|
rmt_channel: 1
|
|
|
|
chipset: SK6812
|
|
|
|
name: "${friendly_name} Side Light"
|
|
|
|
restore_mode: ALWAYS_OFF
|
|
|
|
id: side_light
|
|
|
|
default_transition_length: 0s
|
2024-03-01 15:01:56 +01:00
|
|
|
- platform: partition
|
|
|
|
name: "${friendly_name} Side Light Right"
|
|
|
|
segments:
|
|
|
|
- id: side_light
|
|
|
|
from: 0
|
|
|
|
to: 4
|
|
|
|
- platform: partition
|
|
|
|
name: "${friendly_name} Side Light Left"
|
|
|
|
segments:
|
|
|
|
- id: side_light
|
|
|
|
from: 5
|
|
|
|
to: 9
|
|
|
|
|
2024-02-11 18:15:55 +01:00
|
|
|
|
|
|
|
i2c:
|
|
|
|
sda: 21
|
|
|
|
scl: 22
|
|
|
|
scan: True
|
|
|
|
|
|
|
|
# Display
|
2024-03-08 14:04:37 +01:00
|
|
|
#spi:
|
|
|
|
# clk_pin: 18
|
|
|
|
# mosi_pin: 23
|
|
|
|
# miso_pin: 19
|
|
|
|
#
|
|
|
|
#font:
|
|
|
|
# - file: "gfonts://Roboto"
|
|
|
|
# id: roboto
|
|
|
|
# size: 18
|
|
|
|
#
|
|
|
|
#image:
|
|
|
|
# - file: m5stack_display.png
|
|
|
|
# id: img_background
|
|
|
|
# type: RGB24
|
|
|
|
#
|
|
|
|
#
|
2024-02-11 18:15:55 +01:00
|
|
|
#display:
|
|
|
|
# - platform: ili9xxx
|
|
|
|
# model: M5STACK
|
|
|
|
# cs_pin: 14
|
|
|
|
# dc_pin: 27
|
|
|
|
# reset_pin: 33
|
|
|
|
# id: my_display
|
|
|
|
# lambda: |-
|
2024-03-08 14:04:37 +01:00
|
|
|
# it.image(0, 0, id(img_background));
|
|
|
|
# it.printf(240, 67, id(roboto), Color(255, 255, 255), TextAlign::TOP_CENTER, "%.0f ppm", id(co2value).state );
|
|
|
|
# it.printf(240, 125, id(roboto), Color(255, 255, 255), TextAlign::TOP_CENTER, "%.1f °C", id(co2temp).state );
|
|
|
|
# it.printf(240, 184, id(roboto), Color(255, 255, 255), TextAlign::TOP_CENTER, "%.1f %%", id(m5stackfire_dht22_humidity).state );
|
2024-02-11 18:15:55 +01:00
|
|
|
#
|
2024-03-08 14:04:37 +01:00
|
|
|
|
2024-02-11 18:15:55 +01:00
|
|
|
uart:
|
|
|
|
id: uart_co2
|
|
|
|
tx_pin: GPIO17
|
|
|
|
rx_pin: GPIO16
|
|
|
|
baud_rate: 9600
|
|
|
|
|
|
|
|
sensor:
|
|
|
|
- platform: mhz19
|
|
|
|
co2:
|
|
|
|
name: "MH-Z19 CO2"
|
|
|
|
id: co2value
|
|
|
|
temperature:
|
|
|
|
name: "MH-Z19 Temperatur"
|
|
|
|
id: co2temp
|
|
|
|
update_interval: 5s
|
|
|
|
automatic_baseline_calibration: false
|
|
|
|
uart_id: uart_co2
|
2024-03-01 15:01:56 +01:00
|
|
|
id: my_mhz19
|
|
|
|
- platform: dht
|
|
|
|
pin: 26
|
|
|
|
temperature:
|
|
|
|
id: m5stackfire_dht22_temperature
|
|
|
|
name: "DHT22 Temperature"
|
|
|
|
humidity:
|
|
|
|
id: m5stackfire_dht22_humidity
|
|
|
|
name: "DHT22 humidity"
|
|
|
|
|
2024-03-08 14:04:37 +01:00
|
|
|
mqtt:
|
|
|
|
broker: homeassistant.fritz.box
|
|
|
|
username: !secret mqtt_ble_username
|
|
|
|
password: !secret mqtt_ble_password
|
|
|
|
discovery: false
|
|
|
|
|
|
|
|
esp32_ble_tracker:
|
|
|
|
scan_parameters:
|
|
|
|
interval: 1.2s
|
|
|
|
window: 500ms
|
|
|
|
active: false
|
|
|
|
on_ble_advertise:
|
|
|
|
- then:
|
|
|
|
- lambda: |-
|
|
|
|
const char * detected_device_name = ble_device_name(x.address());
|
|
|
|
if(detected_device_name != nullptr) {
|
|
|
|
auto build_json = [&](JsonObject obj) {
|
|
|
|
obj["id"] = detected_device_name;
|
|
|
|
obj["rssi"] = x.get_rssi();
|
|
|
|
if(x.get_tx_powers().size() > 0)
|
|
|
|
obj["tx_power"] = x.get_tx_powers()[0];
|
|
|
|
};
|
|
|
|
global_mqtt_client->publish_json(std::string("my_btmonitor/devices/") + detected_device_name + "/az_oben",
|
|
|
|
build_json);
|
|
|
|
}
|
|
|
|
|
2024-03-01 15:01:56 +01:00
|
|
|
|