diff --git a/board/esp32s3_usbotg.yaml b/board/esp32s3_usbotg.yaml index b4317ee..f51db34 100644 --- a/board/esp32s3_usbotg.yaml +++ b/board/esp32s3_usbotg.yaml @@ -32,55 +32,18 @@ esp32: compiler_optimization: PERF enable_idf_experimental_features: true -wifi: - enable_btm: true - enable_rrm: true - psram: mode: quad speed: 80MHz +wifi: + enable_btm: true + enable_rrm: true + spi: clk_pin: ${pin.int.spi.clk} mosi_pin: ${pin.int.spi.mosi} -esp32_camera: - i2c_id: i2c_internal - # PINS - external_clock: - pin: ${pin.cam.m_clk} - frequency: 12MHz - data_pins: - - ${pin.cam.y2} - - ${pin.cam.y3} - - ${pin.cam.y4} - - ${pin.cam.y5} - - ${pin.cam.y6} - - ${pin.cam.y7} - - ${pin.cam.y8} - - ${pin.cam.y9} - vsync_pin: ${pin.cam.vs} - href_pin: ${pin.cam.hs} - pixel_clock_pin: ${pin.cam.p_clk} - # Metadata - id: espcam - name: "Camera OV2640" - # Image settings - resolution: 640x480 - jpeg_quality: 12 - max_framerate: 1 fps - frame_buffer_count: 2 # defaults to 1 - vertical_flip: true - horizontal_mirror: true - # Exposure - aec_mode: auto - aec2: true # defaults to false - # White balance - wb_mode: auto - -status_led: - pin: ${pin.light.led} - light: - platform: esp32_rmt_led_strip id: rgb_led @@ -116,3 +79,40 @@ light: blue: 0% name: "LED" entity_category: config + +status_led: + pin: ${pin.light.led} + +esp32_camera: + i2c_id: i2c_internal + # PINS + external_clock: + pin: ${pin.cam.m_clk} + frequency: 12MHz + data_pins: + - ${pin.cam.y2} + - ${pin.cam.y3} + - ${pin.cam.y4} + - ${pin.cam.y5} + - ${pin.cam.y6} + - ${pin.cam.y7} + - ${pin.cam.y8} + - ${pin.cam.y9} + vsync_pin: ${pin.cam.vs} + href_pin: ${pin.cam.hs} + pixel_clock_pin: ${pin.cam.p_clk} + # Metadata + id: espcam + name: "Camera OV2640" + # Image settings + resolution: 640x480 + jpeg_quality: 12 + max_framerate: 1 fps + frame_buffer_count: 2 # defaults to 1 + vertical_flip: true + horizontal_mirror: true + # Exposure + aec_mode: auto + aec2: true # defaults to false + # White balance + wb_mode: auto diff --git a/board/everything_presence_lite.yaml b/board/everything_presence_lite.yaml index 5488b74..78ae6ed 100644 --- a/board/everything_presence_lite.yaml +++ b/board/everything_presence_lite.yaml @@ -3,42 +3,11 @@ # https://docs.everythingsmart.io/s/products/doc/everything-presence-lite-epl-ZVnBzYzuX2 # Specific bluetooth settings, paste in root device yaml -esp32_ble: - max_connections: 2 -esp32_ble_tracker: - scan_parameters: - interval: 500ms - window: 10ms -bluetooth_proxy: - active: false - connection_slots: 1 - substitutions: illuminance_update_interval: "5s" device: model: "Everything Presence Lite" -esp32: - framework: - advanced: - assertion_level: DISABLE - compiler_optimization : PERF - minimum_chip_revision: 3.1 - -api: - reboot_timeout: 90min - encryption: - key: !secret homeassistant_api - -wifi: - ssid: !secret wifi_ssid - password: !secret wifi_password - reboot_timeout: 30min - fast_connect: true - passive_scan: true - enable_btm: true - enable_rrm: true - esphome: on_boot: - priority: -100 @@ -56,6 +25,22 @@ esphome: id(firmware_co2).publish_state("Disabled"); } +esp32: + framework: + advanced: + assertion_level: DISABLE + compiler_optimization : PERF + minimum_chip_revision: 3.1 + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + reboot_timeout: 30min + fast_connect: true + passive_scan: true + enable_btm: true + enable_rrm: true + binary_sensor: - id: !extend zone2_occupancy disabled_by_default: false @@ -64,14 +49,6 @@ binary_sensor: - id: !extend zone4_occupancy disabled_by_default: false -number: - - id: !extend zone_2_off_delay - disabled_by_default: false - - id: !extend zone_3_off_delay - disabled_by_default: false - - id: !extend zone_4_off_delay - disabled_by_default: false - sensor: - id: !extend target1_speed disabled_by_default: true @@ -101,8 +78,33 @@ sensor: - id: !extend zone4_target_count disabled_by_default: false +number: + - id: !extend zone_2_off_delay + disabled_by_default: false + - id: !extend zone_3_off_delay + disabled_by_default: false + - id: !extend zone_4_off_delay + disabled_by_default: false + select: - id: !extend tracking_behaviour initial_option: Above + Distance and Angle - id: !extend update_speed_select initial_option: Slow (0.4s) + +api: + reboot_timeout: 90min + encryption: + key: !secret homeassistant_api + +bluetooth_proxy: + active: false + connection_slots: 1 + +esp32_ble: + max_connections: 2 + +esp32_ble_tracker: + scan_parameters: + interval: 500ms + window: 10ms diff --git a/board/everything_presence_pro.yaml b/board/everything_presence_pro.yaml index 7f1c81b..2828212 100644 --- a/board/everything_presence_pro.yaml +++ b/board/everything_presence_pro.yaml @@ -3,89 +3,11 @@ # https://docs.everythingsmart.io/s/products/doc/everything-presence-pro-nh3fIXmow9 # Specific bluetooth settings, paste in root device yaml -esp32_ble: - max_connections: 2 -esp32_ble_tracker: - scan_parameters: - interval: 500ms - window: 10ms -bluetooth_proxy: - active: false - connection_slots: 1 - substitutions: illuminance_update_interval: "5s" device: model: "Everything Presence Pro" -esp32: - framework: - advanced: - assertion_level: DISABLE - compiler_optimization : PERF - minimum_chip_revision: 3.1 - -api: - reboot_timeout: 90min - encryption: - key: !secret homeassistant_api - on_client_connected: - # Wait until client has subscribed - - wait_until: - condition: - api.connected: - state_subscription_only: true - timeout: 3s - - if: - condition: - lambda: 'return id(status_led_select).current_option() == "Enabled" && id(led_mode_select).current_option() != "Manual Control";' - then: - # Stop any effects first - - light.turn_on: - id: led_rgb - effect: none - # Smooth celebration sequence with flowing colors - - light.turn_on: - id: led_rgb - brightness: 60% - red: 0% - green: 100% - blue: 100% - white: 0% - transition_length: 400ms - - delay: 400ms - - light.turn_on: - id: led_rgb - brightness: 65% - red: 0% - green: 70% - blue: 100% - white: 0% - transition_length: 350ms - - delay: 350ms - - light.turn_on: - id: led_rgb - brightness: 70% - red: 50% - green: 0% - blue: 100% - white: 0% - transition_length: 350ms - - delay: 350ms - - light.turn_on: - id: led_rgb - brightness: 65% - red: 100% - green: 100% - blue: 100% - white: 0% - transition_length: 400ms - - delay: 500ms - # Always restore to current mode, even if Manual Control - - script.execute: control_leds - on_client_disconnected: - - script.execute: control_leds - esphome: on_boot: - priority: -100 @@ -124,6 +46,13 @@ esphome: id(firmware_network).publish_state("WiFi"); } +esp32: + framework: + advanced: + assertion_level: DISABLE + compiler_optimization : PERF + minimum_chip_revision: 3.1 + wifi: ssid: !secret wifi_ssid password: !secret wifi_password @@ -145,16 +74,6 @@ binary_sensor: - id: !extend ld2450_zone4_occupancy disabled_by_default: false -number: - - id: !extend ld2450_zone2_off_delay - disabled_by_default: false - - - id: !extend ld2450_zone3_off_delay - disabled_by_default: false - - - id: !extend ld2450_zone4_off_delay - disabled_by_default: false - sensor: - id: !extend ld2450_target1_speed disabled_by_default: true @@ -184,6 +103,16 @@ sensor: - id: !extend ld2450_zone4_target_count disabled_by_default: false +number: + - id: !extend ld2450_zone2_off_delay + disabled_by_default: false + + - id: !extend ld2450_zone3_off_delay + disabled_by_default: false + + - id: !extend ld2450_zone4_off_delay + disabled_by_default: false + select: # Hide 24V relay mode (NO/NC) - id: !extend relay_contact_mode @@ -203,4 +132,77 @@ select: switch: # Hide 24V relay control - id: !extend system_alarm_relay - disabled_by_default: true \ No newline at end of file + disabled_by_default: true + +api: + reboot_timeout: 90min + encryption: + key: !secret homeassistant_api + on_client_connected: + # Wait until client has subscribed + - wait_until: + condition: + api.connected: + state_subscription_only: true + timeout: 3s + - if: + condition: + lambda: 'return id(status_led_select).current_option() == "Enabled" && id(led_mode_select).current_option() != "Manual Control";' + then: + # Stop any effects first + - light.turn_on: + id: led_rgb + effect: none + # Smooth celebration sequence with flowing colors + - light.turn_on: + id: led_rgb + brightness: 60% + red: 0% + green: 100% + blue: 100% + white: 0% + transition_length: 400ms + - delay: 400ms + - light.turn_on: + id: led_rgb + brightness: 65% + red: 0% + green: 70% + blue: 100% + white: 0% + transition_length: 350ms + - delay: 350ms + - light.turn_on: + id: led_rgb + brightness: 70% + red: 50% + green: 0% + blue: 100% + white: 0% + transition_length: 350ms + - delay: 350ms + - light.turn_on: + id: led_rgb + brightness: 65% + red: 100% + green: 100% + blue: 100% + white: 0% + transition_length: 400ms + - delay: 500ms + # Always restore to current mode, even if Manual Control + - script.execute: control_leds + on_client_disconnected: + - script.execute: control_leds + +bluetooth_proxy: + active: false + connection_slots: 1 + +esp32_ble: + max_connections: 2 + +esp32_ble_tracker: + scan_parameters: + interval: 500ms + window: 10ms diff --git a/board/geekmagic_hellocubic_v2.yaml b/board/geekmagic_hellocubic_v2.yaml index ca60589..0a3478d 100644 --- a/board/geekmagic_hellocubic_v2.yaml +++ b/board/geekmagic_hellocubic_v2.yaml @@ -33,6 +33,11 @@ esp32: psram: +spi: + clk_pin: ${pin.spi.clk} + mosi_pin: ${pin.spi.mosi} + interface: hardware + i2c: # Internal - id: i2c_internal @@ -42,11 +47,6 @@ i2c: # timeout: 5ms scan: true -spi: - clk_pin: ${pin.spi.clk} - mosi_pin: ${pin.spi.mosi} - interface: hardware - output: - platform: ledc id: backlight_output @@ -65,6 +65,38 @@ light: name: "Backlight" entity_category: config +display: +# - platform: ili9xxx +# id: display_lcd +# model: st7789v +# data_rate: 40MHz +# dc_pin: ${pin.spi.disp.dc} +# reset_pin: ${pin.spi.disp.reset} +# spi_mode: MODE3 +# dimensions: +# width: 240 +# height: 240 +# offset_height: 0 +# offset_width: 0 +# invert_colors: true +# auto_clear_enabled: false +# update_interval: never + - platform: mipi_spi + model: st7789v + id: display_lcd + data_rate: 40MHz + dc_pin: ${pin.spi.disp.dc} + reset_pin: ${pin.spi.disp.reset} + spi_mode: MODE3 + dimensions: + width: 240 + height: 240 + offset_height: 0 + offset_width: 0 + invert_colors: true + auto_clear_enabled: false + update_interval: 10s + sensor: - platform: mpu6050 address: 0x68 @@ -131,35 +163,3 @@ sensor: - sliding_window_moving_average: window_size: 60 send_every: 30 - -display: -# - platform: ili9xxx -# id: display_lcd -# model: st7789v -# data_rate: 40MHz -# dc_pin: ${pin.spi.disp.dc} -# reset_pin: ${pin.spi.disp.reset} -# spi_mode: MODE3 -# dimensions: -# width: 240 -# height: 240 -# offset_height: 0 -# offset_width: 0 -# invert_colors: true -# auto_clear_enabled: false -# update_interval: never - - platform: mipi_spi - model: st7789v - id: display_lcd - data_rate: 40MHz - dc_pin: ${pin.spi.disp.dc} - reset_pin: ${pin.spi.disp.reset} - spi_mode: MODE3 - dimensions: - width: 240 - height: 240 - offset_height: 0 - offset_width: 0 - invert_colors: true - auto_clear_enabled: false - update_interval: 10s diff --git a/board/geekmagic_smalltv_pro.yaml b/board/geekmagic_smalltv_pro.yaml index 5c9ee91..0d14101 100644 --- a/board/geekmagic_smalltv_pro.yaml +++ b/board/geekmagic_smalltv_pro.yaml @@ -61,32 +61,6 @@ light: name: "Backlight" entity_category: config -# Button -esp32_touch: - -binary_sensor: - - platform: esp32_touch - id: touch_pad - pin: ${pin.btn.touch1} - threshold: 1250 - filters: - # Small filter, to debounce the spurious events. - - delayed_on: 20ms - - delayed_off: 50ms - on_press: - - logger.log: "Touch" -# on_click: -# - min_length: 50ms -# max_length: 500ms -# then: -# - logger.log: "Short Touch" -# - min_length: 500ms -# max_length: 2000ms -# then: -# - logger.log: "Long Touch" - name: "Touchpad" - entity_category: diagnostic - display: # - platform: ili9xxx # id: display_lcd @@ -118,3 +92,29 @@ display: invert_colors: true auto_clear_enabled: false update_interval: 10s + +binary_sensor: + - platform: esp32_touch + id: touch_pad + pin: ${pin.btn.touch1} + threshold: 1250 + filters: + # Small filter, to debounce the spurious events. + - delayed_on: 20ms + - delayed_off: 50ms + on_press: + - logger.log: "Touch" +# on_click: +# - min_length: 50ms +# max_length: 500ms +# then: +# - logger.log: "Short Touch" +# - min_length: 500ms +# max_length: 2000ms +# then: +# - logger.log: "Long Touch" + name: "Touchpad" + entity_category: diagnostic + +# Button +esp32_touch: diff --git a/board/geekmagic_smalltv_s3.yaml b/board/geekmagic_smalltv_s3.yaml index cff141f..dddd31f 100644 --- a/board/geekmagic_smalltv_s3.yaml +++ b/board/geekmagic_smalltv_s3.yaml @@ -72,10 +72,36 @@ light: name: "Backlight" entity_category: config -# Button -esp32_touch: - #setup_mode: True - measurement_duration: 0.25ms +display: +# - platform: ili9xxx +# id: display_lcd +# model: st7789v #gc9a01a + #data_rate: 40MHz + #cs_pin: ${pin.spi.disp.cs} +# dc_pin: ${pin.spi.disp.dc} +# reset_pin: ${pin.spi.disp.reset} +# spi_mode: MODE3 +# dimensions: +# width: 240 +# height: 240 +# invert_colors: true +# auto_clear_enabled: false +# update_interval: never + - platform: mipi_spi + model: st7789v #gc9a01a + id: display_lcd + #data_rate: 40MHz + #cs_pin: ${pin.spi.disp.cs} + dc_pin: ${pin.spi.disp.dc} + reset_pin: ${pin.spi.disp.reset} + spi_mode: MODE3 + dimensions: + width: 240 + height: 240 + data_rate: 40Mhz + invert_colors: true + auto_clear_enabled: false + update_interval: 10s binary_sensor: - platform: esp32_touch @@ -114,33 +140,7 @@ binary_sensor: name: "Touchpad" entity_category: diagnostic -display: -# - platform: ili9xxx -# id: display_lcd -# model: st7789v #gc9a01a - #data_rate: 40MHz - #cs_pin: ${pin.spi.disp.cs} -# dc_pin: ${pin.spi.disp.dc} -# reset_pin: ${pin.spi.disp.reset} -# spi_mode: MODE3 -# dimensions: -# width: 240 -# height: 240 -# invert_colors: true -# auto_clear_enabled: false -# update_interval: never - - platform: mipi_spi - model: st7789v #gc9a01a - id: display_lcd - #data_rate: 40MHz - #cs_pin: ${pin.spi.disp.cs} - dc_pin: ${pin.spi.disp.dc} - reset_pin: ${pin.spi.disp.reset} - spi_mode: MODE3 - dimensions: - width: 240 - height: 240 - data_rate: 40Mhz - invert_colors: true - auto_clear_enabled: false - update_interval: 10s +# Button +esp32_touch: + #setup_mode: True + measurement_duration: 0.25ms diff --git a/board/jc3248w535c.yaml b/board/jc3248w535c.yaml index 79e46e4..79744ac 100644 --- a/board/jc3248w535c.yaml +++ b/board/jc3248w535c.yaml @@ -38,14 +38,14 @@ esp32: CONFIG_SPIRAM_USE_MALLOC: y type: ${device.framework.type} -wifi: - enable_btm: true - enable_rrm: true - psram: mode: octal speed: 80MHz +wifi: + enable_btm: true + enable_rrm: true + # https://community.home-assistant.io/t/jc3248w535-guition-3-5-config/791363 spi: - type: quad @@ -111,4 +111,4 @@ touchscreen: # on_update: # - logger.log: # format: Touch %d at (%d, %d) -# args: [ 'touch->id', 'touch->x', 'touch->y' ] \ No newline at end of file +# args: [ 'touch->id', 'touch->x', 'touch->y' ] diff --git a/board/m5stack_air_quality.yaml b/board/m5stack_air_quality.yaml index 6d4f9b1..6e2e7a4 100644 --- a/board/m5stack_air_quality.yaml +++ b/board/m5stack_air_quality.yaml @@ -7,6 +7,13 @@ labels: [esp32s3, BM8563, RTC, SCD40, CO2, temperature, humidity, SEN55, particu # M5Stack PM2.5 Air Quality # +# Pins for this model +packages: + pins: !include pins/m5stack_air_quality.yaml + i2c_int: !include extension/internal_i2c.yaml + epaper: !include module/epaper.yaml + status_led: !include ../features/system_status_led.yaml + substitutions: time_timezone: "Europe/Oslo" display: @@ -20,13 +27,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_air_quality.yaml - i2c_int: !include extension/internal_i2c.yaml - epaper: !include module/epaper.yaml - status_led: !include ../features/system_status_led.yaml - esphome: project: name: "M5Stack.Air Quality" @@ -74,10 +74,6 @@ wifi: enable_btm: true enable_rrm: true -spi: - clk_pin: ${pin.int.spi.clk} - mosi_pin: ${pin.int.spi.mosi} - time: - platform: bm8563 i2c_id: ${module.internal.i2c_bus} @@ -89,6 +85,10 @@ time: - then: - bm8563.write_time: +spi: + clk_pin: ${pin.int.spi.clk} + mosi_pin: ${pin.int.spi.mosi} + output: - platform: gpio id: sen55_enable @@ -139,6 +139,32 @@ light: name: "LED" entity_category: config +display: + # 200 x 200 resolution + - platform: waveshare_epaper + id: display_eink + model: 1.54inv2 + cs_pin: ${pin.int.spi.disp.cs} + dc_pin: + number: ${pin.int.spi.disp.dc} + ignore_strapping_warning: true + reset_pin: ${pin.int.spi.disp.reset} + busy_pin: + number: ${pin.int.spi.disp.busy} + inverted: false + full_update_every: 5 +# reset_duration: 2ms + update_interval: never + pages: + - id: page_black + lambda: |- + // Fill background. + it.fill(id(epaper_text_color)); + - id: page_white + lambda: |- + // Fill background. + it.fill(id(epaper_bg_color)); + binary_sensor: - platform: gpio id: button_a @@ -216,82 +242,6 @@ binary_sensor: on_release: - logger.log: Power Hold Off -button: - - platform: template - name: "CO2 Force Manual Calibration" - entity_category: "config" - on_press: - - then: - - scd4x.perform_forced_calibration: - value: !lambda 'return id(co2_cal).state;' - - - platform: template - name: "SEN55 Force Manual Clean" - entity_category: "config" - on_press: - - then: - - sen5x.start_fan_autoclean: sen55_sensor - -number: - - platform: template - name: "CO2 Calibration Value" - optimistic: true - min_value: 400 - max_value: 1000 - step: 5 - id: co2_cal - icon: "mdi:molecule-co2" - entity_category: "config" - -script: - # Script for buzzer beep - - id: buzzer_on - then: - - output.turn_on: buzzer - - output.ledc.set_frequency: - id: buzzer - frequency: "500Hz" - - output.set_level: - id: buzzer - level: "1%" - - id: buzzer_beep - then: - - output.turn_on: buzzer - - output.ledc.set_frequency: - id: buzzer - frequency: "500Hz" - - output.set_level: - id: buzzer - level: "1%" - - delay: 50ms - - output.turn_off: buzzer - -display: - # 200 x 200 resolution - - platform: waveshare_epaper - id: display_eink - model: 1.54inv2 - cs_pin: ${pin.int.spi.disp.cs} - dc_pin: - number: ${pin.int.spi.disp.dc} - ignore_strapping_warning: true - reset_pin: ${pin.int.spi.disp.reset} - busy_pin: - number: ${pin.int.spi.disp.busy} - inverted: false - full_update_every: 5 -# reset_duration: 2ms - update_interval: never - pages: - - id: page_black - lambda: |- - // Fill background. - it.fill(id(epaper_text_color)); - - id: page_white - lambda: |- - // Fill background. - it.fill(id(epaper_bg_color)); - sensor: - platform: scd4x id: aq_scd40_sensor @@ -445,4 +395,54 @@ sensor: # } # entity_category: diagnostic # device_class: battery -# unit_of_measurement: "%" \ No newline at end of file +# unit_of_measurement: "%" + +button: + - platform: template + name: "CO2 Force Manual Calibration" + entity_category: "config" + on_press: + - then: + - scd4x.perform_forced_calibration: + value: !lambda 'return id(co2_cal).state;' + + - platform: template + name: "SEN55 Force Manual Clean" + entity_category: "config" + on_press: + - then: + - sen5x.start_fan_autoclean: sen55_sensor + +number: + - platform: template + name: "CO2 Calibration Value" + optimistic: true + min_value: 400 + max_value: 1000 + step: 5 + id: co2_cal + icon: "mdi:molecule-co2" + entity_category: "config" + +script: + # Script for buzzer beep + - id: buzzer_on + then: + - output.turn_on: buzzer + - output.ledc.set_frequency: + id: buzzer + frequency: "500Hz" + - output.set_level: + id: buzzer + level: "1%" + - id: buzzer_beep + then: + - output.turn_on: buzzer + - output.ledc.set_frequency: + id: buzzer + frequency: "500Hz" + - output.set_level: + id: buzzer + level: "1%" + - delay: 50ms + - output.turn_off: buzzer diff --git a/board/m5stack_atom_lite.yaml b/board/m5stack_atom_lite.yaml index 792d772..3cc547d 100644 --- a/board/m5stack_atom_lite.yaml +++ b/board/m5stack_atom_lite.yaml @@ -5,6 +5,11 @@ labels: [esp32, SK6812, RGB] # M5Stack Atom Lite # +# Pins for this model +packages: + pins: !include pins/m5stack_atom_lite.yaml + status_led: !include ../features/system_status_led.yaml + substitutions: device: model: "M5Stack Atom Lite" @@ -12,11 +17,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_atom_lite.yaml - status_led: !include ../features/system_status_led.yaml - esphome: project: name: "M5Stack.Atom Lite" @@ -36,12 +36,6 @@ wifi: enable_btm: true enable_rrm: true -# IR -#remote_transmitter: -# pin: $ir_pin -# carrier_duty_percent: 50% -# rmt_symbols: ${device.rmt_symbols_block} - light: - platform: esp32_rmt_led_strip id: rgb_led @@ -97,3 +91,8 @@ binary_sensor: - light.turn_off: id: rgb_led +# IR +#remote_transmitter: +# pin: $ir_pin +# carrier_duty_percent: 50% +# rmt_symbols: ${device.rmt_symbols_block} diff --git a/board/m5stack_atom_matrix.yaml b/board/m5stack_atom_matrix.yaml index a77af13..a8f1adc 100644 --- a/board/m5stack_atom_matrix.yaml +++ b/board/m5stack_atom_matrix.yaml @@ -5,6 +5,10 @@ labels: [esp32, WS2812, RGB, RMT_LED, display] # M5Stack Atom Matrix v1.1 # +# Pins for this model +packages: + pins: !include pins/m5stack_atom_lite.yaml + substitutions: device: model: "M5Stack Atom Matrix" @@ -12,10 +16,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_atom_lite.yaml - esphome: project: name: "M5Stack.Atom Matrix" diff --git a/board/m5stack_atom_s3.yaml b/board/m5stack_atom_s3.yaml index d963b43..e8ae65f 100644 --- a/board/m5stack_atom_s3.yaml +++ b/board/m5stack_atom_s3.yaml @@ -5,6 +5,10 @@ labels: [esp32s3, psram, ST7789V, display, MPU6886] # M5Stack AtomS3 # +# Pins for this model +packages: + pins: !include pins/m5stack_atom_s3.yaml + substitutions: device: model: "M5Stack Atom S3" @@ -12,10 +16,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_atom_s3.yaml - esphome: project: name: "M5Stack.Atom S3" @@ -43,12 +43,6 @@ spi: clk_pin: ${pin.int.spi.clk} mosi_pin: ${pin.int.spi.mosi} -# IR -#remote_transmitter: -# pin: ${pin.light.ir} -# carrier_duty_percent: 50% -# rmt_symbols: ${device.rmt_symbols_block} - output: - platform: ledc id: backlight_output @@ -71,23 +65,6 @@ light: name: "Backlight" entity_category: config -# Button -binary_sensor: - - platform: gpio - id: btn_display - pin: - number: ${pin.btn} - inverted: true - mode: - input: true - pullup: true - filters: - - delayed_off: 10ms - on_press: - - logger.log: Button Pressed - name: Button - entity_category: diagnostic - display: - platform: mipi_spi model: st7789v @@ -107,6 +84,23 @@ display: pad_width: 2 pad_height: 1 +# Button +binary_sensor: + - platform: gpio + id: btn_display + pin: + number: ${pin.btn} + inverted: true + mode: + input: true + pullup: true + filters: + - delayed_off: 10ms + on_press: + - logger.log: Button Pressed + name: Button + entity_category: diagnostic + #sensor: # MPU6886 IMU # - platform: mpu6886 @@ -167,4 +161,10 @@ display: # filters: # - sliding_window_moving_average: # window_size: 6 -# send_every: 3 \ No newline at end of file +# send_every: 3 + +# IR +#remote_transmitter: +# pin: ${pin.light.ir} +# carrier_duty_percent: 50% +# rmt_symbols: ${device.rmt_symbols_block} diff --git a/board/m5stack_atom_s3_lite.yaml b/board/m5stack_atom_s3_lite.yaml index 946fffb..6e41d6a 100644 --- a/board/m5stack_atom_s3_lite.yaml +++ b/board/m5stack_atom_s3_lite.yaml @@ -5,6 +5,11 @@ labels: [esp32s3, WS2812, RGB] # M5Stack AtomS3 Lite # +# Pins for this model +packages: + pins: !include pins/m5stack_atom_s3_lite.yaml + status_led: !include ../features/system_status_led.yaml + substitutions: device: model: "M5Stack Atom S3 Lite" @@ -12,11 +17,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_atom_s3_lite.yaml - status_led: !include ../features/system_status_led.yaml - esphome: project: name: "M5Stack.Atom S3 Lite" @@ -35,12 +35,6 @@ wifi: enable_btm: true enable_rrm: true -# IR -#remote_transmitter: -# pin: ${pin.light.ir} -# carrier_duty_percent: 50% -# rmt_symbols: ${device.rmt_symbols_block} - light: # RGB WS2812C-2020 - platform: esp32_rmt_led_strip @@ -107,3 +101,8 @@ binary_sensor: - light.turn_off: id: rgb_led +# IR +#remote_transmitter: +# pin: ${pin.light.ir} +# carrier_duty_percent: 50% +# rmt_symbols: ${device.rmt_symbols_block} diff --git a/board/m5stack_atom_s3r.yaml b/board/m5stack_atom_s3r.yaml index da2b01a..2ac0502 100644 --- a/board/m5stack_atom_s3r.yaml +++ b/board/m5stack_atom_s3r.yaml @@ -58,27 +58,10 @@ spi: clk_pin: ${pin.int.spi.clk} mosi_pin: ${pin.int.spi.mosi} -# IR -#remote_transmitter: -# pin: ${pin.light.ir} -# carrier_duty_percent: 50% -# rmt_symbols: ${device.rmt_symbols_block} - external_components: - source: github://m5stack/esphome-yaml/components components: [ lp5562 ] -lp5562: - i2c_id: ${module.internal.i2c_bus} - id: led_lp5562 - use_internal_clk: true -# high_pwm_freq: true -# logarithmic_dimming: true -# red_current: 15.5 -# green_current: 16.5 -# blue_current: 22.5 - white_current: 17.5 - output: - platform: lp5562 lp5562_id: led_lp5562 @@ -122,23 +105,6 @@ light: # name: "Backlight RGBW" # entity_category: config -# Button -binary_sensor: - - platform: gpio - id: btn_display - pin: - number: ${pin.btn} - inverted: true - mode: - input: true - pullup: true - filters: - - delayed_off: 10ms - on_press: - - logger.log: Button Pressed - name: Button - entity_category: diagnostic - display: - platform: mipi_spi model: st7789v @@ -157,3 +123,37 @@ display: offset_height: 1 pad_width: 2 pad_height: 1 + +# Button +binary_sensor: + - platform: gpio + id: btn_display + pin: + number: ${pin.btn} + inverted: true + mode: + input: true + pullup: true + filters: + - delayed_off: 10ms + on_press: + - logger.log: Button Pressed + name: Button + entity_category: diagnostic + +# IR +#remote_transmitter: +# pin: ${pin.light.ir} +# carrier_duty_percent: 50% +# rmt_symbols: ${device.rmt_symbols_block} + +lp5562: + i2c_id: ${module.internal.i2c_bus} + id: led_lp5562 + use_internal_clk: true +# high_pwm_freq: true +# logarithmic_dimming: true +# red_current: 15.5 +# green_current: 16.5 +# blue_current: 22.5 + white_current: 17.5 diff --git a/board/m5stack_atom_s3r_m12.yaml b/board/m5stack_atom_s3r_m12.yaml index 4834a8a..9cf6f01 100644 --- a/board/m5stack_atom_s3r_m12.yaml +++ b/board/m5stack_atom_s3r_m12.yaml @@ -102,4 +102,4 @@ esp32_camera: aec_mode: auto aec2: true # defaults to false # White balance - wb_mode: auto \ No newline at end of file + wb_mode: auto diff --git a/board/m5stack_atom_s3r_voice.yaml b/board/m5stack_atom_s3r_voice.yaml index 9c15394..e716f05 100644 --- a/board/m5stack_atom_s3r_voice.yaml +++ b/board/m5stack_atom_s3r_voice.yaml @@ -52,6 +52,14 @@ wifi: enable_btm: true enable_rrm: true +i2s_audio: + id: i2s_audio_bus + i2s_lrclk_pin: + number: ${pin.audio.i2s_lrclk} + ignore_strapping_warning: true + i2s_bclk_pin: ${pin.audio.i2s_bclk} + i2s_mclk_pin: ${pin.audio.i2s_mclk} + # Button binary_sensor: - platform: gpio @@ -69,13 +77,26 @@ binary_sensor: name: Button entity_category: diagnostic -i2s_audio: - id: i2s_audio_bus - i2s_lrclk_pin: - number: ${pin.audio.i2s_lrclk} - ignore_strapping_warning: true - i2s_bclk_pin: ${pin.audio.i2s_bclk} - i2s_mclk_pin: ${pin.audio.i2s_mclk} +switch: + - platform: gpio + id: speaker_enable + name: Speaker Enable + pin: ${pin.audio.pwr} + restore_mode: RESTORE_DEFAULT_ON + entity_category: config + disabled_by_default: true + + - platform: template + id: mic_mute + name: Microphone Mute + icon: "mdi:microphone-off" + optimistic: true + restore_mode: RESTORE_DEFAULT_OFF + entity_category: config + on_turn_off: + - microphone.unmute: + on_turn_on: + - microphone.mute: audio_dac: - platform: es8311 @@ -103,24 +124,3 @@ speaker: sample_rate: 48000 bits_per_sample: 16bit channel: left - -switch: - - platform: gpio - id: speaker_enable - name: Speaker Enable - pin: ${pin.audio.pwr} - restore_mode: RESTORE_DEFAULT_ON - entity_category: config - disabled_by_default: true - - - platform: template - id: mic_mute - name: Microphone Mute - icon: "mdi:microphone-off" - optimistic: true - restore_mode: RESTORE_DEFAULT_OFF - entity_category: config - on_turn_off: - - microphone.unmute: - on_turn_on: - - microphone.mute: diff --git a/board/m5stack_atom_s3u.yaml b/board/m5stack_atom_s3u.yaml index fc657af..6d2612e 100644 --- a/board/m5stack_atom_s3u.yaml +++ b/board/m5stack_atom_s3u.yaml @@ -5,6 +5,11 @@ labels: [esp32s3, WS2812, RGB, microphone] # M5Stack AtomS3U # +# Pins for this model +packages: + pins: !include pins/m5stack_atom_s3u.yaml + status_led: !include ../features/system_status_led.yaml + substitutions: device: model: "M5Stack Atom S3U" @@ -12,11 +17,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_atom_s3u.yaml - status_led: !include ../features/system_status_led.yaml - esphome: project: name: "M5Stack.Atom S3U" @@ -34,20 +34,6 @@ esp32: #i2s_audio: # id: i2s_audio_bus # i2s_lrclk_pin: ${pin.audio.i2s_lrclk} -#microphone: -# - platform: i2s_audio -# i2s_audio_id: i2s_audio_bus -# id: mic_pdm -# i2s_din_pin: ${pin.audio.mic} -# adc_type: external -# pdm: true - -# IR -#remote_transmitter: -# pin: ${pin.light.ir} -# carrier_duty_percent: 50% -# non_blocking: true -# rmt_symbols: ${device.rmt_symbols_block} light: #G35=RGB WS2812C-2020 @@ -114,3 +100,18 @@ binary_sensor: - logger.log: Button Held - light.turn_off: id: rgb_led + +# IR +#remote_transmitter: +# pin: ${pin.light.ir} +# carrier_duty_percent: 50% +# non_blocking: true +# rmt_symbols: ${device.rmt_symbols_block} + +#microphone: +# - platform: i2s_audio +# i2s_audio_id: i2s_audio_bus +# id: mic_pdm +# i2s_din_pin: ${pin.audio.mic} +# adc_type: external +# pdm: true diff --git a/board/m5stack_core_s3se.yaml b/board/m5stack_core_s3se.yaml index 1e74073..7bcdd3d 100644 --- a/board/m5stack_core_s3se.yaml +++ b/board/m5stack_core_s3se.yaml @@ -7,6 +7,10 @@ labels: [esp32s3, psram, ILI9342, display, BM8563, microphone, speaker] # https://community.home-assistant.io/t/m5stack-m5cores3-se-with-microwakeword/761965/5 # https://github.com/luka6000/wake-word-voice-assistants/blob/main/m5stack-coreS3-se/m5stack-coreS3-se-spk.yaml +# Pins for this model +packages: + pins: !include pins/m5stack_core_s3se.yaml + substitutions: time_timezone: "Europe/Oslo" mbus_i2c_shared: "false" @@ -19,10 +23,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_core_s3se.yaml - esphome: project: name: "M5Stack.Core S3 SE" @@ -58,6 +58,24 @@ wifi: logger: deassert_rts_dtr: true +time: + - platform: bm8563 + i2c_id: ${module.internal.i2c_bus} + id: time_rtc + address: 0x51 + update_interval: 15min + - id: !extend time_homeassistant + on_time_sync: + - then: + - bm8563.write_time: + +spi: + clk_pin: ${pin.int.spi.clk} + mosi_pin: ${pin.int.spi.mosi} + miso_pin: + number: ${pin.int.spi.miso} + allow_other_uses: true + #i2c: # Int # - id: i2c_internal @@ -76,40 +94,6 @@ logger: # frequency: 200kHz # scan: true -spi: - clk_pin: ${pin.int.spi.clk} - mosi_pin: ${pin.int.spi.mosi} - miso_pin: - number: ${pin.int.spi.miso} - allow_other_uses: true - -time: - - platform: bm8563 - i2c_id: ${module.internal.i2c_bus} - id: time_rtc - address: 0x51 - update_interval: 15min - - id: !extend time_homeassistant - on_time_sync: - - then: - - bm8563.write_time: - -external_components: - - source: github://m5stack/esphome-yaml/components - components: [axp2101, aw88298, aw9523b] - -# PMU -axp2101: - id: axp2101_pmu - i2c_id: ${module.internal.i2c_bus} - -# IO Expander -aw9523b: - i2c_id: ${module.internal.i2c_bus} - id: aw9523b_hub - p0_drive_mode: PUSH_PULL - interrupt_pin: ${pin.int.i2c.int} - #i2s_audio: # id: i2s_audio_bus # i2s_lrclk_pin: ${pin.audio.i2s_lrclk} @@ -117,33 +101,65 @@ aw9523b: # i2s_mclk_pin: # number: ${pin.audio.i2s_mclk} # ignore_strapping_warning: true -#audio_adc: -# - platform: es7210 -# i2c_id: ${module.internal.i2c_bus} -# id: adc_es7210 -# bits_per_sample: 16bit -# sample_rate: 16000 -# mic_gain: 36 -#audio_dac: -# - platform: aw88298 -# i2c_id: ${module.internal.i2c_bus} -# id: dac_aw88298 -# sample_rate: 48000 -#microphone: -# - platform: i2s_audio -# i2s_audio_id: i2s_audio_bus -# id: i2s_mic -# i2s_din_pin: ${pin.audio.mic} -# bits_per_sample: 16bit -# sample_rate: 16000 -# adc_type: external -#speaker: -# - platform: i2s_audio -# i2s_audio_id: i2s_shared -# id: speaker_i2s -# dac_type: external -# i2s_dout_pin: ${pin.audio.i2s_dout} -# audio_dac: dac_aw88298 + +external_components: + - source: github://m5stack/esphome-yaml/components + components: [axp2101, aw88298, aw9523b] + +output: + - platform: axp2101 + type: range + channel: DLDO1 + id: backlight_output + min_voltage: 2600 + max_voltage: 3300 + + - platform: axp2101 + channel: ALDO1 + voltage: 1800 + + - platform: axp2101 + channel: ALDO2 + voltage: 3300 + + - platform: axp2101 + channel: BLDO1 + voltage: 2800 + + - platform: axp2101 + channel: BLDO2 + voltage: 1500 + +# - platform: axp2101 +# channel: DCDC1 +# voltage: 3300 + +# - platform: axp2101 +# channel: DCDC3 +# voltage: 3300 + +# https://devices.esphome.io/devices/M5Stack-Fire#wifi-issues-due-to-gpio15 +# - platform: gpio +# id: wifi_fix_output +# pin: ${mbus23} + +light: + # White + - platform: monochromatic + id: backlight_light + output: backlight_output + default_transition_length: 250ms + restore_mode: RESTORE_AND_ON + initial_state: + state: on + brightness: 25% + name: "Backlight" + entity_category: config + # on_state: + # - lambda: |- + # uint8_t light; + # if (id(axp2101).read_byte(0x99, &light)) + # id(backlight).turn_on().set_brightness( (( light << 5 ) - 641 ) /255 ); display: - platform: mipi_spi @@ -248,51 +264,6 @@ binary_sensor: - logger.log: "AW88298 interrupt triggered" internal: true -output: - - platform: axp2101 - type: range - channel: DLDO1 - id: backlight_output - min_voltage: 2600 - max_voltage: 3300 - - - platform: axp2101 - channel: ALDO1 - voltage: 1800 - - - platform: axp2101 - channel: ALDO2 - voltage: 3300 - - - platform: axp2101 - channel: BLDO1 - voltage: 2800 - - - platform: axp2101 - channel: BLDO2 - voltage: 1500 - -# - platform: axp2101 -# channel: DCDC1 -# voltage: 3300 - -# - platform: axp2101 -# channel: DCDC3 -# voltage: 3300 - -light: - # White - - platform: monochromatic - id: backlight_light - output: backlight_output - default_transition_length: 250ms - restore_mode: RESTORE_AND_ON - initial_state: - state: on - brightness: 25% - name: "Backlight" - entity_category: config - switch: - platform: gpio id: sw_bus_out_en @@ -323,4 +294,47 @@ switch: number: 15 # BOOST_EN = 1 restore_mode: RESTORE_DEFAULT_ON - entity_category: config \ No newline at end of file + entity_category: config + +#audio_dac: +# - platform: aw88298 +# i2c_id: ${module.internal.i2c_bus} +# id: dac_aw88298 +# sample_rate: 48000 + +#audio_adc: +# - platform: es7210 +# i2c_id: ${module.internal.i2c_bus} +# id: adc_es7210 +# bits_per_sample: 16bit +# sample_rate: 16000 +# mic_gain: 36 + +#microphone: +# - platform: i2s_audio +# i2s_audio_id: i2s_audio_bus +# id: i2s_mic +# i2s_din_pin: ${pin.audio.mic} +# bits_per_sample: 16bit +# sample_rate: 16000 +# adc_type: external + +#speaker: +# - platform: i2s_audio +# i2s_audio_id: i2s_shared +# id: speaker_i2s +# dac_type: external +# i2s_dout_pin: ${pin.audio.i2s_dout} +# audio_dac: dac_aw88298 + +# IO Expander +aw9523b: + i2c_id: ${module.internal.i2c_bus} + id: aw9523b_hub + p0_drive_mode: PUSH_PULL + interrupt_pin: ${pin.int.i2c.int} + +# PMU +axp2101: + id: axp2101_pmu + i2c_id: ${module.internal.i2c_bus} diff --git a/board/m5stack_coreink.yaml b/board/m5stack_coreink.yaml index 64dc81e..8e52f27 100644 --- a/board/m5stack_coreink.yaml +++ b/board/m5stack_coreink.yaml @@ -6,6 +6,11 @@ labels: [esp32, ePaper, display] # M5Stack CoreInk # +# Pins for this model +packages: + pins: !include pins/m5stack_coreink.yaml + epaper: !include module/epaper.yaml + substitutions: time_timezone: "Europe/Oslo" home_page: page_content @@ -18,11 +23,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_coreink.yaml - epaper: !include module/epaper.yaml - esphome: project: name: "M5Stack.CoreInk" @@ -73,10 +73,6 @@ wifi: enable_btm: true enable_rrm: true -spi: - clk_pin: ${pin.int.spi.clk} - mosi_pin: ${pin.int.spi.mosi} - # i2c RTC only with one additional i2c bus #time: # - platform: bm8563 @@ -88,11 +84,9 @@ spi: # then: # bm8563.write_time: -light: - # Enable status LED - - platform: status_led - id: status_light - pin: ${pin.light.led} +spi: + clk_pin: ${pin.int.spi.clk} + mosi_pin: ${pin.int.spi.mosi} # Buzzer output: @@ -107,6 +101,75 @@ output: # number: ${pin.int.pwr_mos} # allow_other_uses: true +light: + # Enable status LED + - platform: status_led + id: status_light + pin: ${pin.light.led} + +display: + # 200 x 200 resolution + - platform: waveshare_epaper + id: display_eink + model: 1.54inv2 + cs_pin: ${pin.int.spi.disp.cs} + dc_pin: ${pin.int.spi.disp.dc} + reset_pin: ${pin.int.spi.disp.reset} + busy_pin: + number: ${pin.int.spi.disp.busy} + inverted: false + full_update_every: 1 +# reset_duration: 2ms + update_interval: never + pages: + - id: page_black + lambda: |- + // Fill background. + it.fill(id(epaper_text_color)); + - id: page_white + lambda: |- + // Fill background. + it.fill(id(epaper_bg_color)); + +# text_sensor: +# - platform: template +# id: wakeup_cause +# lambda: return to_string( esp_sleep_get_wakeup_cause() ); +# filters: +# - lambda: |- +# if (x == "0") { +# return x + "_ESP_SLEEP_WAKEUP_UNDEFINED"; +# } else if (x == "1") { +# return x + "_ESP_SLEEP_WAKEUP_ALL"; +# } else if (x == "2") { +# return x + "_ESP_SLEEP_WAKEUP_EXT0"; +# } else if (x == "3") { +# return x + "_ESP_SLEEP_WAKEUP_EXT1"; +# } else if (x == "4") { +# return x + "_ESP_SLEEP_WAKEUP_TIMER"; +# } else if (x == "5") { +# return x + "_ESP_SLEEP_WAKEUP_TOUCHPAD"; +# } else if (x == "6") { +# return x + "_ESP_SLEEP_WAKEUP_ULP"; +# } else if (x == "7") { +# return x + "_ESP_SLEEP_WAKEUP_GPIO"; +# } else if (x == "8") { +# return x + "_ESP_SLEEP_WAKEUP_UART"; +# } else if (x == "9") { +# return x + "_ESP_SLEEP_WAKEUP_WIFI"; +# } else if (x == "10") { +# return x + "_ESP_SLEEP_WAKEUP_COCPU"; +# } else if (x == "11") { +# return x + "_ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG"; +# } else if (x == "12") { +# return x + "_ESP_SLEEP_WAKEUP_BT"; +# } else { +# return x + "_UNKNOWN"; +# } +# name: "Wakeup Cause" +# entity_category: diagnostic +# disabled_by_default: true + binary_sensor: # Power Button # - platform: gpio @@ -212,29 +275,6 @@ binary_sensor: name: Power Hold entity_category: diagnostic -# Script for buzzer beep -script: - - id: buzzer_on - then: - - output.turn_on: buzzer - - output.ledc.set_frequency: - id: buzzer - frequency: "500Hz" - - output.set_level: - id: buzzer - level: "1%" - - id: buzzer_beep - then: - - output.turn_on: buzzer - - output.ledc.set_frequency: - id: buzzer - frequency: "500Hz" - - output.set_level: - id: buzzer - level: "1%" - - delay: 30ms - - output.turn_off: buzzer - sensor: # Deep Sleep wakeup cause # - platform: template @@ -292,25 +332,6 @@ sensor: device_class: battery unit_of_measurement: "%" -#deep_sleep: -# id: deep_sleep_battery -# run_duration: 120s -# sleep_duration: 180s -# wakeup_pin_mode: KEEP_AWAKE -# esp32_ext1_wakeup: -# mode: ANY_HIGH -# pins: -# - number: ${pin.int.rtc_wakeup} -# - number: ${pin.int.pwr_mos} -# allow_other_uses: true -# inverted: true -# - number: ${pin.btn.stick.up} -# allow_other_uses: true -# - number: ${pin.btn.stick.press} -# allow_other_uses: true -# - number: ${pin.btn.stick.down} -# allow_other_uses: true - #switch: # Power Hold # - platform: template @@ -344,69 +365,44 @@ sensor: # entity_category: config # optimistic: true -display: - # 200 x 200 resolution - - platform: waveshare_epaper - id: display_eink - model: 1.54inv2 - cs_pin: ${pin.int.spi.disp.cs} - dc_pin: - number: ${pin.int.spi.disp.dc} - ignore_strapping_warning: true - reset_pin: - number: ${pin.int.spi.disp.reset} - ignore_strapping_warning: true - busy_pin: - number: ${pin.int.spi.disp.busy} - inverted: false - full_update_every: 1 -# reset_duration: 2ms - update_interval: never - pages: - - id: page_black - lambda: |- - // Fill background. - it.fill(id(epaper_text_color)); - - id: page_white - lambda: |- - // Fill background. - it.fill(id(epaper_bg_color)); +# Script for buzzer beep +script: + - id: buzzer_on + then: + - output.turn_on: buzzer + - output.ledc.set_frequency: + id: buzzer + frequency: "500Hz" + - output.set_level: + id: buzzer + level: "1%" + - id: buzzer_beep + then: + - output.turn_on: buzzer + - output.ledc.set_frequency: + id: buzzer + frequency: "500Hz" + - output.set_level: + id: buzzer + level: "1%" + - delay: 30ms + - output.turn_off: buzzer -# text_sensor: -# - platform: template -# id: wakeup_cause -# lambda: return to_string( esp_sleep_get_wakeup_cause() ); -# filters: -# - lambda: |- -# if (x == "0") { -# return x + "_ESP_SLEEP_WAKEUP_UNDEFINED"; -# } else if (x == "1") { -# return x + "_ESP_SLEEP_WAKEUP_ALL"; -# } else if (x == "2") { -# return x + "_ESP_SLEEP_WAKEUP_EXT0"; -# } else if (x == "3") { -# return x + "_ESP_SLEEP_WAKEUP_EXT1"; -# } else if (x == "4") { -# return x + "_ESP_SLEEP_WAKEUP_TIMER"; -# } else if (x == "5") { -# return x + "_ESP_SLEEP_WAKEUP_TOUCHPAD"; -# } else if (x == "6") { -# return x + "_ESP_SLEEP_WAKEUP_ULP"; -# } else if (x == "7") { -# return x + "_ESP_SLEEP_WAKEUP_GPIO"; -# } else if (x == "8") { -# return x + "_ESP_SLEEP_WAKEUP_UART"; -# } else if (x == "9") { -# return x + "_ESP_SLEEP_WAKEUP_WIFI"; -# } else if (x == "10") { -# return x + "_ESP_SLEEP_WAKEUP_COCPU"; -# } else if (x == "11") { -# return x + "_ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG"; -# } else if (x == "12") { -# return x + "_ESP_SLEEP_WAKEUP_BT"; -# } else { -# return x + "_UNKNOWN"; -# } -# name: "Wakeup Cause" -# entity_category: diagnostic -# disabled_by_default: true \ No newline at end of file +#deep_sleep: +# id: deep_sleep_battery +# run_duration: 120s +# sleep_duration: 180s +# wakeup_pin_mode: KEEP_AWAKE +# esp32_ext1_wakeup: +# mode: ANY_HIGH +# pins: +# - number: ${pin.int.rtc_wakeup} +# - number: ${pin.int.pwr_mos} +# allow_other_uses: true +# inverted: true +# - number: ${pin.btn.stick.up} +# allow_other_uses: true +# - number: ${pin.btn.stick.press} +# allow_other_uses: true +# - number: ${pin.btn.stick.down} +# allow_other_uses: true diff --git a/board/m5stack_dial.yaml b/board/m5stack_dial.yaml index 8d4f96e..d52b7ea 100644 --- a/board/m5stack_dial.yaml +++ b/board/m5stack_dial.yaml @@ -7,6 +7,11 @@ labels: [esp32s3, BM8563, RTC, ILI9342, display, i2c] # M5Stack Dial v1.1 # +# Pins for this model +packages: + pins: !include pins/m5stack_dial.yaml + i2c_int: !include extension/internal_i2c.yaml + substitutions: time_timezone: "Europe/Oslo" display: @@ -20,11 +25,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_dial.yaml - i2c_int: !include extension/internal_i2c.yaml - esphome: project: name: "M5Stack.Dial v1.1" @@ -57,13 +57,6 @@ wifi: enable_btm: true enable_rrm: true -spi: - clk_pin: ${pin.int.spi.clk} - mosi_pin: ${pin.int.spi.mosi} - miso_pin: - number: ${pin.int.spi.miso} - allow_other_uses: true - time: - platform: bm8563 i2c_id: ${module.internal.i2c_bus} @@ -75,6 +68,13 @@ time: - then: - bm8563.write_time: +spi: + clk_pin: ${pin.int.spi.clk} + mosi_pin: ${pin.int.spi.mosi} + miso_pin: + number: ${pin.int.spi.miso} + allow_other_uses: true + output: # backlight output - platform: ledc @@ -99,6 +99,43 @@ light: name: "Backlight" entity_category: config +display: + # 240 x 240 resolution + - platform: mipi_spi + id: display_lcd + model: GC9A01A + cs_pin: ${pin.int.spi.disp.cs} + dc_pin: ${pin.int.spi.disp.dc} + reset_pin: ${pin.int.spi.disp.reset} + busy_pin: + number: ${pin.int.spi.disp.busy} + inverted: false + data_rate: 40MHz + invert_colors: true + update_interval: 10s + auto_clear_enabled: false + +touchscreen: + - platform: ft5x06 + i2c_id: ${module.internal.i2c_bus} + id: touchscreen_ft5x06 + on_touch: + - then: + - lambda: |- + ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d", + touch.x, + touch.y, + touch.x_raw, + touch.y_raw + ); + - if: + condition: + - light.is_off: backlight_light + then: + - light.turn_on: + id: backlight_light + brightness: 40% + binary_sensor: - platform: gpio id: button_front @@ -144,54 +181,6 @@ sensor: max_value: 32767 publish_initial_value: true -display: - # 240 x 240 resolution - - platform: mipi_spi - id: display_lcd - model: GC9A01A - cs_pin: ${pin.int.spi.disp.cs} - dc_pin: ${pin.int.spi.disp.dc} - reset_pin: ${pin.int.spi.disp.reset} - busy_pin: - number: ${pin.int.spi.disp.busy} - inverted: false - data_rate: 40MHz - invert_colors: true - update_interval: 10s - auto_clear_enabled: false - -touchscreen: - - platform: ft5x06 - i2c_id: ${module.internal.i2c_bus} - id: touchscreen_ft5x06 - on_touch: - - then: - - lambda: |- - ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d", - touch.x, - touch.y, - touch.x_raw, - touch.y_raw - ); - - if: - condition: - - light.is_off: backlight_light - then: - - light.turn_on: - id: backlight_light - brightness: 40% - -rc522_i2c: - - id: nfc_reader - i2c_id: ${module.internal.i2c_bus} - update_interval: 500ms - on_tag: - - lambda: |- - ESP_LOGD("rfid", "Card detected: %s", x.c_str()); - on_tag_removed: - - lambda: |- - ESP_LOGD("rfid", "Card removed: %s", x.c_str()); - script: # Script for buzzer beep - id: buzzer_on @@ -214,3 +203,14 @@ script: level: "1%" - delay: 50ms - output.turn_off: buzzer + +rc522_i2c: + - id: nfc_reader + i2c_id: ${module.internal.i2c_bus} + update_interval: 500ms + on_tag: + - lambda: |- + ESP_LOGD("rfid", "Card detected: %s", x.c_str()); + on_tag_removed: + - lambda: |- + ESP_LOGD("rfid", "Card removed: %s", x.c_str()); diff --git a/board/m5stack_fire.yaml b/board/m5stack_fire.yaml index 4e39f8e..98bc7bb 100644 --- a/board/m5stack_fire.yaml +++ b/board/m5stack_fire.yaml @@ -5,6 +5,10 @@ labels: [esp32, psram, ILI9342, display, MPU6886, speaker] # M5Stack Fire # +# Pins for this model +packages: + pins: !include pins/m5stack_fire.yaml + substitutions: device: model: "M5Stack Fire" @@ -15,10 +19,6 @@ substitutions: internal: i2c_bus: i2c_internal -# Pins for this model -packages: - pins: !include pins/m5stack_fire.yaml - esphome: project: name: "M5Stack.Fire" @@ -46,52 +46,20 @@ wifi: enable_btm: true enable_rrm: true -#external_components: -# - source: -# type: git -# url: https://github.com/ssieb/custom_components -# components: [ip5306] - -#ip5306: -# battery_level: -# id: ip5306_battery_level -# name: Battery Level -# charger_connected: -# id: ip5306_charger_connected -# charge_full: -# id: ip5306_charge_full - spi: clk_pin: ${pin.int.spi.clk} mosi_pin: ${pin.int.spi.mosi} miso_pin: ${pin.int.spi.miso} +# Speaker (only got buzzer to work) +#i2s_audio: +# i2s_lrclk_pin: ${pin.int.audio.i2s_lrclk} -# IR -#remote_transmitter: -# pin: ${ir_pin} -# carrier_duty_percent: 50% -# rmt_symbols: ${device.rmt_symbols_block} - -# 320x240 ILI9342C LCD -display: - - platform: mipi_spi - id: display_lcd - model: ili9342 - cs_pin: ${pin.int.spi.disp.cs} - dc_pin: ${pin.int.spi.disp.dc} - reset_pin: ${pin.int.spi.disp.reset} - data_rate: 20Mhz - dimensions: - height: 240 - width: 320 - transform: - swap_xy: false - mirror_x: false - mirror_y: false - invert_colors: true - update_interval: 10s - auto_clear_enabled: false +#external_components: +# - source: +# type: git +# url: https://github.com/ssieb/custom_components +# components: [ip5306] output: # backlight output @@ -115,16 +83,25 @@ light: name: "Backlight" entity_category: config -# Speaker (only got buzzer to work) -#i2s_audio: -# i2s_lrclk_pin: ${pin.int.audio.i2s_lrclk} - -#media_player: -# - platform: i2s_audio -# id: media_player_out -# dac_type: internal -# mode: stereo -# name: "Internal Media Player" +# 320x240 ILI9342C LCD +display: + - platform: mipi_spi + id: display_lcd + model: ili9342 + cs_pin: ${pin.int.spi.disp.cs} + dc_pin: ${pin.int.spi.disp.dc} + reset_pin: ${pin.int.spi.disp.reset} + data_rate: 20Mhz + dimensions: + height: 240 + width: 320 + transform: + swap_xy: false + mirror_x: false + mirror_y: false + invert_colors: true + update_interval: 10s + auto_clear_enabled: false # Buttons binary_sensor: @@ -230,4 +207,26 @@ script: id: buzzer level: "1%" - delay: 30ms - - output.turn_off: buzzer \ No newline at end of file + - output.turn_off: buzzer + +# IR +#remote_transmitter: +# pin: ${ir_pin} +# carrier_duty_percent: 50% +# rmt_symbols: ${device.rmt_symbols_block} + +#media_player: +# - platform: i2s_audio +# id: media_player_out +# dac_type: internal +# mode: stereo +# name: "Internal Media Player" + +#ip5306: +# battery_level: +# id: ip5306_battery_level +# name: Battery Level +# charger_connected: +# id: ip5306_charger_connected +# charge_full: +# id: ip5306_charge_full diff --git a/board/m5stack_nano_c6.yaml b/board/m5stack_nano_c6.yaml index 8698963..7aa168f 100644 --- a/board/m5stack_nano_c6.yaml +++ b/board/m5stack_nano_c6.yaml @@ -5,6 +5,11 @@ labels: [esp32c6, WS2812, RGB] # M5Stack NanoC6 # +# Pins for this model +packages: + pins: !include pins/m5stack_nano_c6.yaml + status_led: !include ../features/system_status_led.yaml + substitutions: device: model: "M5Stack NanoC6" @@ -12,11 +17,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_nano_c6.yaml - status_led: !include ../features/system_status_led.yaml - esphome: project: name: "M5Stack.Nano C6" @@ -37,19 +37,6 @@ esp32: # version: 5.4.0 # platform_version: espressif32 @ 6.10.0 -# Enable status LED -status_led: - id: status_light - pin: ${pin.light.led} - -switch: - - platform: gpio - id: rgb_switch - pin: ${pin.int.rgb_pwr} - restore_mode: RESTORE_DEFAULT_ON - name: "RGB on/off" - entity_category: config - # Configuration of onboard RGB LED light: - platform: esp32_rmt_led_strip @@ -112,3 +99,16 @@ binary_sensor: - logger.log: Button Held - light.turn_off: id: rgb_led + +switch: + - platform: gpio + id: rgb_switch + pin: ${pin.int.rgb_pwr} + restore_mode: RESTORE_DEFAULT_ON + name: "RGB on/off" + entity_category: config + +# Enable status LED +status_led: + id: status_light + pin: ${pin.light.led} diff --git a/board/m5stack_stickc_plus2.yaml b/board/m5stack_stickc_plus2.yaml index 9826488..8fe793a 100644 --- a/board/m5stack_stickc_plus2.yaml +++ b/board/m5stack_stickc_plus2.yaml @@ -7,6 +7,10 @@ labels: [esp32, psram, ST7789V, microphone] # # HAT and Mic shared pins +# Pins for this model +packages: + pins: !include pins/m5stack_stickc_plus2.yaml + substitutions: hat_shared: "false" grove_shared: "false" @@ -16,10 +20,6 @@ substitutions: framework: type: esp-idf -# Pins for this model -packages: - pins: !include pins/m5stack_stickc_plus2.yaml - esphome: project: name: "M5Stack.StickC Plus2" @@ -63,12 +63,6 @@ wifi: enable_btm: true enable_rrm: true -spi: - clk_pin: ${pin.int.spi.clk} - mosi_pin: - number: ${pin.int.spi.mosi} - ignore_strapping_warning: true - # Limit of 2 I2C buses on this board #time: # - platform: bm8563 @@ -80,22 +74,57 @@ spi: # then: # bm8563.write_time: -light: - # Enable status LED - - platform: status_led - id: status_light - pin: ${pin.light.led} - # TFT Backlight - - platform: monochromatic - output: backlight_output - id: backlight_light - default_transition_length: 100ms - restore_mode: RESTORE_AND_ON - initial_state: - state: on - brightness: 25% - name: "Backlight" - entity_category: config +spi: + clk_pin: ${pin.int.spi.clk} + mosi_pin: ${pin.int.spi.mosi} + +# text_sensor: +# - platform: template +# id: wakeup_cause +# lambda: return esp_sleep_get_wakeup_cause(); +# filters: +# - lambda: |- +# if (x == 0) { +# return "ESP_SLEEP_WAKEUP_UNDEFINED"; +# } else if (x == 1) { +# return "ESP_SLEEP_WAKEUP_ALL"; +# } else if (x == 2) { +# return "ESP_SLEEP_WAKEUP_EXT0"; +# } else if (x == 3) { +# return "ESP_SLEEP_WAKEUP_EXT1"; +# } else if (x == 4) { +# return "ESP_SLEEP_WAKEUP_TIMER"; +# } else if (x == 5) { +# return "ESP_SLEEP_WAKEUP_TOUCHPAD"; +# } else if (x == 6) { +# return "ESP_SLEEP_WAKEUP_ULP"; +# } else if (x == 7) { +# return "ESP_SLEEP_WAKEUP_GPIO"; +# } else if (x == 8) { +# return "ESP_SLEEP_WAKEUP_UART"; +# } else if (x == 9) { +# return "ESP_SLEEP_WAKEUP_WIFI"; +# } else if (x == 10) { +# return "ESP_SLEEP_WAKEUP_COCPU"; +# } else if (x == 11) { +# return "ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG"; +# } else if (x == 12) { +# return "ESP_SLEEP_WAKEUP_BT"; +# } else { +# return "UNKNOWN"; +# } +# name: "Wakeup Cause" +# entity_category: diagnostic + +# Audio not tested +#i2s_audio: +# id: i2s_bus +# i2s_lrclk_pin: +# number: ${pin.audio.i2s_lrclk} +# allow_other_uses: ${hat_shared} +# i2s_bclk_pin: +# number: ${pin.audio.i2s_bclk} +# allow_other_uses: ${hat_shared} output: # Buzzer @@ -118,6 +147,23 @@ output: # number: ${pwr_mos_pin} # allow_other_uses: true +light: + # Enable status LED + - platform: status_led + id: status_light + pin: ${pin.light.led} + # TFT Backlight + - platform: monochromatic + output: backlight_output + id: backlight_light + default_transition_length: 100ms + restore_mode: RESTORE_AND_ON + initial_state: + state: on + brightness: 25% + name: "Backlight" + entity_category: config + # 1.14 inch, 135*240 Colorful TFT LCD, ST7789v2 display: - platform: mipi_spi @@ -171,44 +217,6 @@ binary_sensor: name: Front Button entity_category: diagnostic -# - platform: gpio -# id: pwr_hold -# name: Power Hold -# entity_category: diagnostic -# pin: -# number: ${pin.int.pwr_mos} -# allow_other_uses: true -# inverted: true -# on_press: -# then: -# - logger.log: Power Hold -# on_release: -# then: -# - logger.log: Power Hold Off - -# Script for buzzer beep -script: - - id: buzzer_on - then: - - output.turn_on: buzzer - - output.ledc.set_frequency: - id: buzzer - frequency: "500Hz" - - output.set_level: - id: buzzer - level: "1%" - - id: buzzer_beep - then: - - output.turn_on: buzzer - - output.ledc.set_frequency: - id: buzzer - frequency: "500Hz" - - output.set_level: - id: buzzer - level: "1%" - - delay: 30ms - - output.turn_off: buzzer - sensor: # Battery voltage - platform: adc @@ -261,25 +269,6 @@ sensor: device_class: battery unit_of_measurement: "%" -#deep_sleep: -# id: deep_sleep_battery -# run_duration: 120s -# sleep_duration: 180s -# wakeup_pin_mode: KEEP_AWAKE -# wakeup_pin: -# number: $power_mos_pin -# allow_other_uses: true -# esp32_ext1_wakeup: -# mode: ANY_HIGH -# pins: -# - number: $rtc_wakeup_pin -# - number: ${pin.int.pwr_mos} -# allow_other_uses: true -# - number: ${pin.btn.side} -# allow_other_uses: true -# - number: ${pin.btn.front} -# allow_other_uses: true - switch: # Power Hold - platform: template @@ -303,53 +292,43 @@ switch: entity_category: config optimistic: true -# text_sensor: -# - platform: template -# id: wakeup_cause -# lambda: return esp_sleep_get_wakeup_cause(); -# filters: -# - lambda: |- -# if (x == 0) { -# return "ESP_SLEEP_WAKEUP_UNDEFINED"; -# } else if (x == 1) { -# return "ESP_SLEEP_WAKEUP_ALL"; -# } else if (x == 2) { -# return "ESP_SLEEP_WAKEUP_EXT0"; -# } else if (x == 3) { -# return "ESP_SLEEP_WAKEUP_EXT1"; -# } else if (x == 4) { -# return "ESP_SLEEP_WAKEUP_TIMER"; -# } else if (x == 5) { -# return "ESP_SLEEP_WAKEUP_TOUCHPAD"; -# } else if (x == 6) { -# return "ESP_SLEEP_WAKEUP_ULP"; -# } else if (x == 7) { -# return "ESP_SLEEP_WAKEUP_GPIO"; -# } else if (x == 8) { -# return "ESP_SLEEP_WAKEUP_UART"; -# } else if (x == 9) { -# return "ESP_SLEEP_WAKEUP_WIFI"; -# } else if (x == 10) { -# return "ESP_SLEEP_WAKEUP_COCPU"; -# } else if (x == 11) { -# return "ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG"; -# } else if (x == 12) { -# return "ESP_SLEEP_WAKEUP_BT"; -# } else { -# return "UNKNOWN"; -# } -# name: "Wakeup Cause" -# entity_category: diagnostic +# - platform: gpio +# id: pwr_hold +# name: Power Hold +# entity_category: diagnostic +# pin: +# number: ${pin.int.pwr_mos} +# allow_other_uses: true +# inverted: true +# on_press: +# then: +# - logger.log: Power Hold +# on_release: +# then: +# - logger.log: Power Hold Off -# Audio not tested -#i2s_audio: -# id: i2s_bus -# i2s_lrclk_pin: -# number: ${pin.audio.i2s_lrclk} -# allow_other_uses: ${hat_shared} -# i2s_bclk_pin: -# number: ${pin.audio.i2s_bclk} -# allow_other_uses: ${hat_shared} +# Script for buzzer beep +script: + - id: buzzer_on + then: + - output.turn_on: buzzer + - output.ledc.set_frequency: + id: buzzer + frequency: "500Hz" + - output.set_level: + id: buzzer + level: "1%" + - id: buzzer_beep + then: + - output.turn_on: buzzer + - output.ledc.set_frequency: + id: buzzer + frequency: "500Hz" + - output.set_level: + id: buzzer + level: "1%" + - delay: 30ms + - output.turn_off: buzzer #microphone: # - platform: i2s_audio @@ -357,4 +336,23 @@ switch: # i2s_audio_id: i2s_bus # adc_type: external # pdm: true -# id: mic \ No newline at end of file +# id: mic + +#deep_sleep: +# id: deep_sleep_battery +# run_duration: 120s +# sleep_duration: 180s +# wakeup_pin_mode: KEEP_AWAKE +# wakeup_pin: +# number: $power_mos_pin +# allow_other_uses: true +# esp32_ext1_wakeup: +# mode: ANY_HIGH +# pins: +# - number: $rtc_wakeup_pin +# - number: ${pin.int.pwr_mos} +# allow_other_uses: true +# - number: ${pin.btn.side} +# allow_other_uses: true +# - number: ${pin.btn.front} +# allow_other_uses: true diff --git a/board/m5stack_unit_cams3.yaml b/board/m5stack_unit_cams3.yaml index 11164e9..4029ba7 100644 --- a/board/m5stack_unit_cams3.yaml +++ b/board/m5stack_unit_cams3.yaml @@ -4,6 +4,11 @@ labels: [camera, i2c] # https://docs.m5stack.com/en/homeassistant/camera/unit_cams3_5mp # UNIT CamS3-5MP +# Pins for this model +packages: + pins: !include pins/m5stack_unit_cams3.yaml + i2c: !include extension/internal_i2c.yaml + substitutions: device: model: "M5Stack Unit CamS3" @@ -15,11 +20,6 @@ substitutions: internal: frequency: 200kHz -# Pins for this model -packages: - pins: !include pins/m5stack_unit_cams3.yaml - i2c: !include extension/internal_i2c.yaml - esphome: project: name: "M5Stack.Unit CamS3" diff --git a/board/module/chip_as3u_mic_pdm.yaml b/board/module/chip_as3u_mic_pdm.yaml index 6be131b..583f4bc 100644 --- a/board/module/chip_as3u_mic_pdm.yaml +++ b/board/module/chip_as3u_mic_pdm.yaml @@ -7,17 +7,6 @@ i2s_audio: i2s_lrclk_pin: ${pin.audio.i2s_lrclk} i2s_bclk_pin: ${pin.audio.i2s_bclk} -# Internal PDM microphone -microphone: - - platform: i2s_audio - i2s_audio_id: i2s_audio_bus - id: i2s_mic_pdm - bits_per_sample: 8bit - sample_rate: 8000 - i2s_din_pin: ${pin.audio.mic} - adc_type: external - pdm: true - sensor: - platform: sound_level id: sound_level_sensor @@ -41,3 +30,14 @@ switch: - microphone.unmute: on_turn_on: - microphone.mute: + +# Internal PDM microphone +microphone: + - platform: i2s_audio + i2s_audio_id: i2s_audio_bus + id: i2s_mic_pdm + bits_per_sample: 8bit + sample_rate: 8000 + i2s_din_pin: ${pin.audio.mic} + adc_type: external + pdm: true diff --git a/board/module/chip_cs3se_mic.yaml b/board/module/chip_cs3se_mic.yaml index 240f013..4063bfb 100644 --- a/board/module/chip_cs3se_mic.yaml +++ b/board/module/chip_cs3se_mic.yaml @@ -10,23 +10,6 @@ i2s_audio: number: ${pin.audio.i2s_mclk} ignore_strapping_warning: true -audio_adc: - - platform: es7210 - i2c_id: ${module.internal.i2c_bus} - id: adc_es7210 - bits_per_sample: 16bit - sample_rate: 16000 - mic_gain: 36 - -microphone: - - platform: i2s_audio - i2s_audio_id: i2s_audio_bus - id: i2s_mic - i2s_din_pin: ${pin.audio.mic} - bits_per_sample: 16bit - sample_rate: 16000 - adc_type: external - sensor: - platform: sound_level id: sound_level_sensor @@ -50,3 +33,20 @@ switch: - microphone.unmute: on_turn_on: - microphone.mute: + +audio_adc: + - platform: es7210 + i2c_id: ${module.internal.i2c_bus} + id: adc_es7210 + bits_per_sample: 16bit + sample_rate: 16000 + mic_gain: 36 + +microphone: + - platform: i2s_audio + i2s_audio_id: i2s_audio_bus + id: i2s_mic + i2s_din_pin: ${pin.audio.mic} + bits_per_sample: 16bit + sample_rate: 16000 + adc_type: external diff --git a/board/module/chip_imu_bmi270.yaml b/board/module/chip_imu_bmi270.yaml index 30c1e84..d2f7e82 100644 --- a/board/module/chip_imu_bmi270.yaml +++ b/board/module/chip_imu_bmi270.yaml @@ -9,16 +9,6 @@ substitutions: internal: i2c_bus: i2c_internal -# Six-axis BMI270 IMU -motion: - - platform: bmi270 - i2c_id: ${module.internal.i2c_bus} - id: motion_bmi270 - accelerometer_range: 4g - gyroscope_range: 2000dps - gyroscope_odr: 200Hz - update_interval: 100ms - sensor: - platform: motion type: acceleration_x @@ -92,3 +82,13 @@ sensor: window_size: 3 send_every: 1 disabled_by_default: True + +# Six-axis BMI270 IMU +motion: + - platform: bmi270 + i2c_id: ${module.internal.i2c_bus} + id: motion_bmi270 + accelerometer_range: 4g + gyroscope_range: 2000dps + gyroscope_odr: 200Hz + update_interval: 100ms diff --git a/board/module/chip_imu_mpu6886.yaml b/board/module/chip_imu_mpu6886.yaml index 25b6a84..e901fde 100644 --- a/board/module/chip_imu_mpu6886.yaml +++ b/board/module/chip_imu_mpu6886.yaml @@ -8,6 +8,7 @@ substitutions: i2c_bus: i2c_internal # Built-in 6-axis (IMU) that also includes a temperature sensor + sensor: - platform: mpu6886 i2c_id: ${module.internal.i2c_bus} diff --git a/board/module/chip_rtc_bm8563.yaml b/board/module/chip_rtc_bm8563.yaml index 3229b22..f2c95dd 100644 --- a/board/module/chip_rtc_bm8563.yaml +++ b/board/module/chip_rtc_bm8563.yaml @@ -8,6 +8,12 @@ substitutions: internal: i2c_bus: i2c_internal +esphome: + on_boot: + - priority: 800 + then: + - bm8563.read_time + # i2c RTC only with one additional i2c bus time: - platform: bm8563 @@ -18,9 +24,3 @@ time: on_time_sync: - then: - bm8563.write_time: - -esphome: - on_boot: - - priority: 800 - then: - - bm8563.read_time \ No newline at end of file diff --git a/board/module/epaper.yaml b/board/module/epaper.yaml index d57762b..16f2728 100644 --- a/board/module/epaper.yaml +++ b/board/module/epaper.yaml @@ -29,6 +29,61 @@ time: else: - logger.log: "No sensors updated - skipping display refresh." +sensor: + # Create sensors for monitoring remotely. + - platform: template + name: "Display Last Update" + device_class: timestamp + entity_category: "diagnostic" + id: display_last_update + - platform: template + name: "Recorded Display Refresh" + accuracy_decimals: 0 + unit_of_measurement: "Refreshes" + state_class: "total_increasing" + entity_category: "diagnostic" + lambda: 'return id(recorded_display_refresh);' + # Alternate epaper colors + on_value: + - then: + - lambda: |- + // This C++ logic updates the color globals + if (((int)x) % 5 == 0) { + // On refreshes 0, 5, 10, etc., set Black background, White text + id(epaper_bg_color) = COLOR_ON; + id(epaper_text_color) = COLOR_OFF; + } else { + // On all other refreshes, set White background, Black text + id(epaper_bg_color) = COLOR_OFF; + id(epaper_text_color) = COLOR_ON; + } + +# Buttons in Home Assistant +button: + - platform: template + name: "Refresh Screen" + entity_category: config + on_press: + - then: + - script.execute: update_screen + + - platform: template + name: "Repair Screen" + entity_category: config + on_press: + - then: + - script.wait: update_screen + - logger.log: "Trying to repair screen" + - repeat: + count: 5 + then: + - script.wait: update_screen + - script.wait: repair_script + - script.execute: repair_script + - script.wait: repair_script + - logger.log: "Repair script finished" + - display.page.show: ${display.home_page} + script: # Script for updating screen - Refresh display and publish refresh count and time. - id: update_screen @@ -83,58 +138,3 @@ globals: restore_value: yes max_restore_data_length: 16 initial_value: 'COLOR_ON' # Default to black text - -# Buttons in Home Assistant -button: - - platform: template - name: "Refresh Screen" - entity_category: config - on_press: - - then: - - script.execute: update_screen - - - platform: template - name: "Repair Screen" - entity_category: config - on_press: - - then: - - script.wait: update_screen - - logger.log: "Trying to repair screen" - - repeat: - count: 5 - then: - - script.wait: update_screen - - script.wait: repair_script - - script.execute: repair_script - - script.wait: repair_script - - logger.log: "Repair script finished" - - display.page.show: ${display.home_page} - -sensor: - # Create sensors for monitoring remotely. - - platform: template - name: "Display Last Update" - device_class: timestamp - entity_category: "diagnostic" - id: display_last_update - - platform: template - name: "Recorded Display Refresh" - accuracy_decimals: 0 - unit_of_measurement: "Refreshes" - state_class: "total_increasing" - entity_category: "diagnostic" - lambda: 'return id(recorded_display_refresh);' - # Alternate epaper colors - on_value: - - then: - - lambda: |- - // This C++ logic updates the color globals - if (((int)x) % 5 == 0) { - // On refreshes 0, 5, 10, etc., set Black background, White text - id(epaper_bg_color) = COLOR_ON; - id(epaper_text_color) = COLOR_OFF; - } else { - // On all other refreshes, set White background, Black text - id(epaper_bg_color) = COLOR_OFF; - id(epaper_text_color) = COLOR_ON; - } diff --git a/board/module/hat_dlight.yaml b/board/module/hat_dlight.yaml index 6bf92ed..5f731a2 100644 --- a/board/module/hat_dlight.yaml +++ b/board/module/hat_dlight.yaml @@ -16,4 +16,4 @@ sensor: window_size: 6 send_every: 3 address: 0x23 - update_interval: 5s \ No newline at end of file + update_interval: 5s diff --git a/board/module/module_cc1101_async.yaml b/board/module/module_cc1101_async.yaml index f7f483a..63723f1 100644 --- a/board/module/module_cc1101_async.yaml +++ b/board/module/module_cc1101_async.yaml @@ -26,92 +26,6 @@ substitutions: packet_mode: "false" num_preamble: "2" -logger: - logs: - cc1101: DEBUG - remote_transmitter: DEBUG - remote_receiver: DEBUG - radio_frequency: DEBUG - -# Module CC1101 -cc1101: - id: radio_cc1101_async - # Hardware settings - cs_pin: ${pin.ext.mbus.p21} - gdo0_pin: - number: ${pin.ext.mbus.p22} - allow_other_uses: true -# gdo2_pin: ${pin.ext.mbus.p2} - # General settings - frequency: ${module.cc1101.frequency} - output_power: ${module.cc1101.output_power} - modulation_type: ${module.cc1101.modulation_type} - symbol_rate: ${module.cc1101.symbol_rate} - rx_attenuation: ${module.cc1101.rx_attenuation} - dc_blocking_filter: false - # Tuner settings - filter_bandwidth: ${module.cc1101.filter_bandwidth} - fsk_deviation: ${module.cc1101.fsk_deviation} - # Packet Mode settings - packet_mode: ${module.cc1101.packet_mode} - -# Can NOT toggle packet mode at runtime, use separate package file -remote_transmitter: - id: rf_tx - pin: - number: ${pin.ext.mbus.p22} # Must match GDO0 - allow_other_uses: true - carrier_duty_percent: 100% - on_transmit: - then: - - cc1101.begin_tx: - - lvgl.label.update: - id: lbl_cc1101_state - text: "Sender..." - - lvgl.label.update: - id: lbl_cc1101_packet - text: "..." - - lvgl.led.update: - id: led_cc1101_state - color: c_purple - on_complete: - then: - - cc1101.begin_rx: - - lvgl.label.update: - id: lbl_cc1101_state - text: "Mottar..." - - lvgl.led.update: - id: led_cc1101_state - color: c_green - -remote_receiver: - id: rf_rx - pin: ${pin.ext.mbus.p2} # Must match GDO2 - dump: raw - -radio_frequency: - - platform: ir_rf_proxy - id: rf_proxy_tx - name: "CC1101 Proxy Transmitter" - remote_transmitter_id: rf_tx - frequency: ${module.cc1101.frequency} - # Optional: retune the CC1101 when an API request specifies a different - # carrier frequency. `x` is the radio_frequency call object. - on_control: - then: - - if: - condition: - lambda: "return x.get_frequency().has_value() && *x.get_frequency() > 0;" - then: - - cc1101.set_frequency: - value: !lambda "return *x.get_frequency();" - - - platform: ir_rf_proxy - id: rf_proxy_rx - name: "CC1101 Proxy Receiver" - remote_receiver_id: rf_rx - frequency: ${module.cc1101.frequency} - esphome: on_boot: # Sync CC1101 settings on boot (in case we changed them from Home Assistant) @@ -177,6 +91,57 @@ esphome: then: - cc1101.begin_rx: +logger: + logs: + cc1101: DEBUG + remote_transmitter: DEBUG + remote_receiver: DEBUG + radio_frequency: DEBUG + +button: + # Put CC1101 into idle mode from Home Assistant + - platform: template + id: cc1101_idle + name: "CC1101 Idle" + icon: "mdi:email-lock" + entity_category: config + on_press: + - then: + - cc1101.set_idle: + - delay: 1s + - switch.turn_off: cc1101_rx + - then: + - lvgl.label.update: + id: lbl_cc1101_state + text: "Stopper" + - lvgl.led.update: + id: led_cc1101_state + color: c_yellow + +.sizing: + - &page_styles + <<: !include ../../gui/styles/page_styles.yaml + page_pad_top: 32 + page_pad_bottom: 32 + screen_height: 240 + screen_width: 320 + # Calculate the usable height for the page content area + # (screen_height - (2 * status_bar_height) - (2 * container_pad)) + # 240 - (2 * 32) - (2 * 1) = 170 + usable_screen_height: 170 + # Calculate the usable width for the page content area + # (screen_width - (2 * container_pad)) + # 320 (2 * 4) = 312 + usable_screen_width: 312 + + - &container_styles + <<: !include ../../gui/styles/container_styles.yaml + container_pad_top: 1 + container_pad_bottom: 1 + container_pad_left: 4 + container_pad_right: 4 + container_scrollable: false # prevents scrollbars on pages where space is used up to the last + # Adjustments number: # Change frequency from Home Assistant @@ -437,49 +402,62 @@ switch: id: led_cc1101_state color: c_red -button: - # Put CC1101 into idle mode from Home Assistant - - platform: template - id: cc1101_idle - name: "CC1101 Idle" - icon: "mdi:email-lock" - entity_category: config - on_press: - - then: - - cc1101.set_idle: - - delay: 1s - - switch.turn_off: cc1101_rx - - then: - - lvgl.label.update: - id: lbl_cc1101_state - text: "Stopper" - - lvgl.led.update: - id: led_cc1101_state - color: c_yellow +# Can NOT toggle packet mode at runtime, use separate package file +remote_transmitter: + id: rf_tx + pin: + number: ${pin.ext.mbus.p22} # Must match GDO0 + allow_other_uses: true + carrier_duty_percent: 100% + on_transmit: + then: + - cc1101.begin_tx: + - lvgl.label.update: + id: lbl_cc1101_state + text: "Sender..." + - lvgl.label.update: + id: lbl_cc1101_packet + text: "..." + - lvgl.led.update: + id: led_cc1101_state + color: c_purple + on_complete: + then: + - cc1101.begin_rx: + - lvgl.label.update: + id: lbl_cc1101_state + text: "Mottar..." + - lvgl.led.update: + id: led_cc1101_state + color: c_green -.sizing: - - &page_styles - <<: !include ../../gui/styles/page_styles.yaml - page_pad_top: 32 - page_pad_bottom: 32 - screen_height: 240 - screen_width: 320 - # Calculate the usable height for the page content area - # (screen_height - (2 * status_bar_height) - (2 * container_pad)) - # 240 - (2 * 32) - (2 * 1) = 170 - usable_screen_height: 170 - # Calculate the usable width for the page content area - # (screen_width - (2 * container_pad)) - # 320 (2 * 4) = 312 - usable_screen_width: 312 +remote_receiver: + id: rf_rx + pin: ${pin.ext.mbus.p2} # Must match GDO2 + dump: raw - - &container_styles - <<: !include ../../gui/styles/container_styles.yaml - container_pad_top: 1 - container_pad_bottom: 1 - container_pad_left: 4 - container_pad_right: 4 - container_scrollable: false # prevents scrollbars on pages where space is used up to the last +radio_frequency: + - platform: ir_rf_proxy + id: rf_proxy_tx + name: "CC1101 Proxy Transmitter" + remote_transmitter_id: rf_tx + frequency: ${module.cc1101.frequency} + # Optional: retune the CC1101 when an API request specifies a different + # carrier frequency. `x` is the radio_frequency call object. + on_control: + then: + - if: + condition: + lambda: "return x.get_frequency().has_value() && *x.get_frequency() > 0;" + then: + - cc1101.set_frequency: + value: !lambda "return *x.get_frequency();" + + - platform: ir_rf_proxy + id: rf_proxy_rx + name: "CC1101 Proxy Receiver" + remote_receiver_id: rf_rx + frequency: ${module.cc1101.frequency} lvgl: pages: @@ -488,3 +466,25 @@ lvgl: vars: <<: [*page_styles, *container_styles] page_title: Radio + +# Module CC1101 +cc1101: + id: radio_cc1101_async + # Hardware settings + cs_pin: ${pin.ext.mbus.p21} + gdo0_pin: + number: ${pin.ext.mbus.p22} + allow_other_uses: true +# gdo2_pin: ${pin.ext.mbus.p2} + # General settings + frequency: ${module.cc1101.frequency} + output_power: ${module.cc1101.output_power} + modulation_type: ${module.cc1101.modulation_type} + symbol_rate: ${module.cc1101.symbol_rate} + rx_attenuation: ${module.cc1101.rx_attenuation} + dc_blocking_filter: false + # Tuner settings + filter_bandwidth: ${module.cc1101.filter_bandwidth} + fsk_deviation: ${module.cc1101.fsk_deviation} + # Packet Mode settings + packet_mode: ${module.cc1101.packet_mode} diff --git a/board/module/module_cc1101_packet.yaml b/board/module/module_cc1101_packet.yaml index a88d1d9..beda799 100644 --- a/board/module/module_cc1101_packet.yaml +++ b/board/module/module_cc1101_packet.yaml @@ -23,70 +23,6 @@ substitutions: packet_mode: "true" num_preamble: "2" -logger: - logs: - cc1101: DEBUG - -# Module CC1101 -cc1101: - id: radio_cc1101_packet - # Hardware settings - cs_pin: ${pin.ext.mbus.p21} - gdo0_pin: - number: ${pin.ext.mbus.p22} -# allow_other_uses: true -# gdo2_pin: ${pin.ext.mbus.p2} - # General settings - frequency: ${module.cc1101.frequency} - output_power: ${module.cc1101.output_power} - modulation_type: ${module.cc1101.modulation_type} - symbol_rate: ${module.cc1101.symbol_rate} - rx_attenuation: ${module.cc1101.rx_attenuation} - dc_blocking_filter: false - # Tuner settings - filter_bandwidth: ${module.cc1101.filter_bandwidth} - fsk_deviation: ${module.cc1101.fsk_deviation} - # Packet Mode settings - packet_mode: ${module.cc1101.packet_mode} - packet_length: 0 - sync0: 0x54 - sync1: 0x3d - num_preamble: ${module.cc1101.num_preamble} - on_packet: - - then: - - logger.log: - level: DEBUG - tag: "cc1101" - format: "packet %s freq_offset %.0f Hz rssi %.1f dBm lqi %u" - args: ['format_hex_pretty(x).c_str()', 'freq_offset', 'rssi', 'lqi'] - # Set Last packet RSSI - - sensor.template.publish: - id: cc1101_rssi - state: !lambda 'return rssi;' - # Set Last packet LQI - - sensor.template.publish: - id: cc1101_lqi - state: !lambda 'return lqi;' - # Send the packet to the Home Assistant text file - - homeassistant.action: - action: notify.send_message - data: - entity_id: notify.cc1101_packet_log - data_template: - message: "{{ log_entry }}" - variables: - log_entry: |- - // 1. Safely format the numbers into a locked 128-byte character buffer - char buf[128]; - snprintf(buf, sizeof(buf), "RSSI: %.1f dBm | LQI: %u | Data: ", rssi, lqi); - - // 2. Safely concatenate the buffer with the dynamically sized hex string - return std::string(buf) + format_hex_pretty(x); - on_success: - - logger.log: "Sent packet to Home Assistant" - on_error: - - logger.log: "Failed to send packet to Home Assistant" - esphome: on_boot: # Sync CC1101 settings on boot (in case we changed them from Home Assistant) @@ -152,6 +88,116 @@ esphome: then: - cc1101.begin_rx: +logger: + logs: + cc1101: DEBUG + +# Diagnostics +sensor: + # Last Packet RSSI + - platform: template + id: cc1101_rssi + name: "CC1101 Last RSSI" + update_interval: never + device_class: signal_strength + entity_category: diagnostic + unit_of_measurement: dBm + state_class: measurement + accuracy_decimals: 1 + disabled_by_default: true + filters: + - throttle: 2s + on_value: + - then: + - lvgl.label.update: + id: lbl_rssi_value + text: + format: "%.0f" + args: [ 'x' ] + # Last Packet LQI + - platform: template + id: cc1101_lqi + name: "CC1101 Last LQI" + icon: "mdi:link-variant" + update_interval: never + unit_of_measurement: "LQI" + entity_category: diagnostic + state_class: measurement + accuracy_decimals: 0 + disabled_by_default: true + filters: + - throttle: 2s + on_value: + - then: + - lvgl.label.update: + id: lbl_lqi_value + text: + format: "%.0f" + args: [ 'x' ] + - lvgl.label.update: + id: lbl_cc1101_state + text: "Mottar" + - lvgl.label.update: + id: lbl_cc1101_packet + text: "Pakke" + - lvgl.led.update: + id: led_cc1101_state + color: c_blue + - delay: 2s + - lvgl.label.update: + id: lbl_cc1101_state + text: "Mottar..." + - lvgl.label.update: + id: lbl_cc1101_packet + text: " " + - lvgl.led.update: + id: led_cc1101_state + color: c_green + +.sizing: + - &page_styles + <<: !include ../../gui/styles/page_styles.yaml + page_pad_top: 32 + page_pad_bottom: 32 + screen_height: 240 + screen_width: 320 + # Calculate the usable height for the page content area + # (screen_height - (2 * status_bar_height) - (2 * container_pad)) + # 240 - (2 * 32) - (2 * 1) = 170 + usable_screen_height: 170 + # Calculate the usable width for the page content area + # (screen_width - (2 * container_pad)) + # 320 (2 * 4) = 312 + usable_screen_width: 312 + + - &container_styles + <<: !include ../../gui/styles/container_styles.yaml + container_pad_top: 1 + container_pad_bottom: 1 + container_pad_left: 4 + container_pad_right: 4 + container_scrollable: false # prevents scrollbars on pages where space is used up to the last + +button: + # Put CC1101 into idle mode from Home Assistant + - platform: template + id: cc1101_idle + name: "CC1101 Idle" + icon: "mdi:email-lock" + entity_category: config + on_press: + - then: + - cc1101.set_idle: + - delay: 1s + - switch.turn_off: cc1101_rx + - then: + - lvgl.label.update: + id: lbl_cc1101_state + text: "Stopper" + - lvgl.led.update: + id: led_cc1101_state + color: c_yellow + # Adjustments number: # Change frequency from Home Assistant @@ -412,112 +458,6 @@ switch: id: led_cc1101_state color: c_red -button: - # Put CC1101 into idle mode from Home Assistant - - platform: template - id: cc1101_idle - name: "CC1101 Idle" - icon: "mdi:email-lock" - entity_category: config - on_press: - - then: - - cc1101.set_idle: - - delay: 1s - - switch.turn_off: cc1101_rx - - then: - - lvgl.label.update: - id: lbl_cc1101_state - text: "Stopper" - - lvgl.led.update: - id: led_cc1101_state - color: c_yellow - -# Diagnostics -sensor: - # Last Packet RSSI - - platform: template - id: cc1101_rssi - name: "CC1101 Last RSSI" - update_interval: never - device_class: signal_strength - entity_category: diagnostic - unit_of_measurement: dBm - state_class: measurement - accuracy_decimals: 1 - disabled_by_default: true - filters: - - throttle: 2s - on_value: - - then: - - lvgl.label.update: - id: lbl_rssi_value - text: - format: "%.0f" - args: [ 'x' ] - # Last Packet LQI - - platform: template - id: cc1101_lqi - name: "CC1101 Last LQI" - icon: "mdi:link-variant" - update_interval: never - unit_of_measurement: "LQI" - entity_category: diagnostic - state_class: measurement - accuracy_decimals: 0 - disabled_by_default: true - filters: - - throttle: 2s - on_value: - - then: - - lvgl.label.update: - id: lbl_lqi_value - text: - format: "%.0f" - args: [ 'x' ] - - lvgl.label.update: - id: lbl_cc1101_state - text: "Mottar" - - lvgl.label.update: - id: lbl_cc1101_packet - text: "Pakke" - - lvgl.led.update: - id: led_cc1101_state - color: c_blue - - delay: 2s - - lvgl.label.update: - id: lbl_cc1101_state - text: "Mottar..." - - lvgl.label.update: - id: lbl_cc1101_packet - text: " " - - lvgl.led.update: - id: led_cc1101_state - color: c_green - -.sizing: - - &page_styles - <<: !include ../../gui/styles/page_styles.yaml - page_pad_top: 32 - page_pad_bottom: 32 - screen_height: 240 - screen_width: 320 - # Calculate the usable height for the page content area - # (screen_height - (2 * status_bar_height) - (2 * container_pad)) - # 240 - (2 * 32) - (2 * 1) = 170 - usable_screen_height: 170 - # Calculate the usable width for the page content area - # (screen_width - (2 * container_pad)) - # 320 (2 * 4) = 312 - usable_screen_width: 312 - - - &container_styles - <<: !include ../../gui/styles/container_styles.yaml - container_pad_top: 1 - container_pad_bottom: 1 - container_pad_left: 4 - container_pad_right: 4 - container_scrollable: false # prevents scrollbars on pages where space is used up to the last - lvgl: pages: - <<: !include @@ -525,3 +465,63 @@ lvgl: vars: <<: [*page_styles, *container_styles] page_title: Radio + +# Module CC1101 +cc1101: + id: radio_cc1101_packet + # Hardware settings + cs_pin: ${pin.ext.mbus.p21} + gdo0_pin: + number: ${pin.ext.mbus.p22} +# allow_other_uses: true +# gdo2_pin: ${pin.ext.mbus.p2} + # General settings + frequency: ${module.cc1101.frequency} + output_power: ${module.cc1101.output_power} + modulation_type: ${module.cc1101.modulation_type} + symbol_rate: ${module.cc1101.symbol_rate} + rx_attenuation: ${module.cc1101.rx_attenuation} + dc_blocking_filter: false + # Tuner settings + filter_bandwidth: ${module.cc1101.filter_bandwidth} + fsk_deviation: ${module.cc1101.fsk_deviation} + # Packet Mode settings + packet_mode: ${module.cc1101.packet_mode} + packet_length: 0 + sync0: 0x54 + sync1: 0x3d + num_preamble: ${module.cc1101.num_preamble} + on_packet: + - then: + - logger.log: + level: DEBUG + tag: "cc1101" + format: "packet %s freq_offset %.0f Hz rssi %.1f dBm lqi %u" + args: ['format_hex_pretty(x).c_str()', 'freq_offset', 'rssi', 'lqi'] + # Set Last packet RSSI + - sensor.template.publish: + id: cc1101_rssi + state: !lambda 'return rssi;' + # Set Last packet LQI + - sensor.template.publish: + id: cc1101_lqi + state: !lambda 'return lqi;' + # Send the packet to the Home Assistant text file + - homeassistant.action: + action: notify.send_message + data: + entity_id: notify.cc1101_packet_log + data_template: + message: "{{ log_entry }}" + variables: + log_entry: |- + // 1. Safely format the numbers into a locked 128-byte character buffer + char buf[128]; + snprintf(buf, sizeof(buf), "RSSI: %.1f dBm | LQI: %u | Data: ", rssi, lqi); + + // 2. Safely concatenate the buffer with the dynamically sized hex string + return std::string(buf) + format_hex_pretty(x); + on_success: + - logger.log: "Sent packet to Home Assistant" + on_error: + - logger.log: "Failed to send packet to Home Assistant" diff --git a/board/module/module_cc1101_wmbus.yaml b/board/module/module_cc1101_wmbus.yaml index 7d97935..0e79aeb 100644 --- a/board/module/module_cc1101_wmbus.yaml +++ b/board/module/module_cc1101_wmbus.yaml @@ -14,11 +14,6 @@ substitutions: frequency: "868.95MHz" # 855 ~ 925MHz supported by this chip water_meter_serial: !secret water_meter_serial -# Pull the custom wM-Bus component directly from GitHub -external_components: - - source: github://SzczepanLeon/esphome-components@main - components: [ wmbus_radio, wmbus_common, wmbus_meter ] - # Make water meter always appear as a separate device in the kitchen area esphome: areas: @@ -40,56 +35,10 @@ logger: sensor.wmbus_meter: DEBUG text_sensor.wmbus_meter: DEBUG -# CC1101 module hardware settings -# https://github.com/SzczepanLeon/esphome-components/tree/main#radio-configuration -# https://github.com/SzczepanLeon/esphome-components/blob/main/ESP32-C3_SuperMini_CC1101.yaml -wmbus_radio: - id: radio_cc1101_wmbus -# radio_type: Must be CC1101 - radio_type: CC1101 -# cs_pin: SPI chip select pin - cs_pin: ${pin.ext.mbus.p21} -# irq_pin: Interrupt pin (GDO0) - irq_pin: ${pin.ext.mbus.p22} -# frequency (Optional): Operating frequency, 300–928 MHz. Defaults to 868.950 MHz - frequency: ${module.cc1101.frequency} - on_frame: - - then: - - logger.log: - level: DEBUG - tag: "wmbus_radio" - format: "Frame received: RSSI=%ddBm, Mode=%s, Data=%s" - args: [ 'frame->rssi()', 'toString(frame->link_mode())', 'frame->as_hex().c_str()' ] - -# Define drivers/meters to enable -# Uncomment and list only the drivers you need to save flash space -wmbus_common: - drivers: -# - auto - - flowiq2200 -# - multical21 - -# https://github.com/SzczepanLeon/esphome-components/blob/version_4/docs/wmbus.md -## If You want to send telegram to another machine and decode it via wmbusmeters addon. -# socket_transmitter: -# id: socket_to_wmbusmeters -# ip_address: 192.168.68.100 # Home Assistant IP -# port: 7011 -# protocol: TCP # or UDP - -# Define your water meter -wmbus_meter: - - id: water_meter - meter_id: 0x${module.cc1101.water_meter_serial} - type: flowiq2200 - key: !secret water_meter_encryption_key - mode: - - C1 - on_telegram: - - logger.log: - level: DEBUG - tag: "wmbus_meter" - format: "Telegram received from water meter" +# Pull the custom wM-Bus component directly from GitHub +external_components: + - source: github://SzczepanLeon/esphome-components@main + components: [ wmbus_radio, wmbus_common, wmbus_meter ] # Water meter sensors sensor: @@ -235,3 +184,54 @@ lvgl: vars: <<: [*page_styles, *container_styles] page_title: Radio + +# CC1101 module hardware settings +# https://github.com/SzczepanLeon/esphome-components/tree/main#radio-configuration +# https://github.com/SzczepanLeon/esphome-components/blob/main/ESP32-C3_SuperMini_CC1101.yaml +wmbus_radio: + id: radio_cc1101_wmbus +# radio_type: Must be CC1101 + radio_type: CC1101 +# cs_pin: SPI chip select pin + cs_pin: ${pin.ext.mbus.p21} +# irq_pin: Interrupt pin (GDO0) + irq_pin: ${pin.ext.mbus.p22} +# frequency (Optional): Operating frequency, 300–928 MHz. Defaults to 868.950 MHz + frequency: ${module.cc1101.frequency} + on_frame: + - then: + - logger.log: + level: DEBUG + tag: "wmbus_radio" + format: "Frame received: RSSI=%ddBm, Mode=%s, Data=%s" + args: [ 'frame->rssi()', 'toString(frame->link_mode())', 'frame->as_hex().c_str()' ] + +# Define drivers/meters to enable +# Uncomment and list only the drivers you need to save flash space +wmbus_common: + drivers: +# - auto + - flowiq2200 +# - multical21 + +# https://github.com/SzczepanLeon/esphome-components/blob/version_4/docs/wmbus.md +## If You want to send telegram to another machine and decode it via wmbusmeters addon. +# socket_transmitter: +# id: socket_to_wmbusmeters +# ip_address: 192.168.68.100 # Home Assistant IP +# port: 7011 +# protocol: TCP # or UDP + +# Define your water meter +wmbus_meter: + - id: water_meter + meter_id: 0x${module.cc1101.water_meter_serial} + type: flowiq2200 + key: !secret water_meter_encryption_key + mode: + - C1 + on_telegram: + - logger.log: + level: DEBUG + tag: "wmbus_meter" + format: "Telegram received from water meter" diff --git a/board/module/module_dual_kmeter.yaml b/board/module/module_dual_kmeter.yaml index d19f67f..44f90a8 100644 --- a/board/module/module_dual_kmeter.yaml +++ b/board/module/module_dual_kmeter.yaml @@ -18,24 +18,14 @@ substitutions: # tank_temp_max: The hottest the bottom probe gets (red indicator fills down to the bottom). tank_temp_max: "550" # Represents 55.0°C (Normal resting temp) -external_components: - - source: github://m5stack/esphome-yaml/components - components: [dual_kmeter] - # Enable logging for this component logger: logs: sensor.dual_kmeter: DEBUG -globals: - # Stores the dynamic minimum (Coldest recorded temperature) - - id: tank_dynamic_min - type: int - initial_value: ${module.tank_temp_min | pprint} # pprint to bypass parser issues - # Stores the dynamic maximum (Hottest recorded temperature) - - id: tank_dynamic_max - type: int - initial_value: ${module.tank_temp_max | pprint} +external_components: + - source: github://m5stack/esphome-yaml/components + components: [dual_kmeter] # Module13.2 Dual Kmeter sensor: @@ -185,6 +175,16 @@ sensor: tank_temp_min: ${module.tank_temp_min} tank_temp_max: ${module.tank_temp_max} +globals: + # Stores the dynamic minimum (Coldest recorded temperature) + - id: tank_dynamic_min + type: int + initial_value: ${module.tank_temp_min | pprint} # pprint to bypass parser issues + # Stores the dynamic maximum (Hottest recorded temperature) + - id: tank_dynamic_max + type: int + initial_value: ${module.tank_temp_max | pprint} + # include lvgl page for dual kmeter lvgl: pages: diff --git a/board/module/unit_dlight.yaml b/board/module/unit_dlight.yaml index 2a4b9a8..817fe42 100644 --- a/board/module/unit_dlight.yaml +++ b/board/module/unit_dlight.yaml @@ -20,4 +20,4 @@ sensor: window_size: 6 send_every: 3 address: 0x23 - update_interval: 5s \ No newline at end of file + update_interval: 5s diff --git a/board/module/unit_env_pro.yaml b/board/module/unit_env_pro.yaml index aab1508..572559a 100644 --- a/board/module/unit_env_pro.yaml +++ b/board/module/unit_env_pro.yaml @@ -8,15 +8,6 @@ substitutions: module: env_i2c_bus: i2c_grove -# UNIT ENV Pro -bme68x_bsec2_i2c: - id: bme68x_bsec_component - i2c_id: ${module.env_i2c_bus} - address: 0x77 - model: BME688 - sample_rate: LP - operating_age: 4d - state_save_interval: 6h sensor: - platform: bme68x_bsec2 bme68x_bsec2_id: bme68x_bsec_component @@ -238,4 +229,14 @@ text_sensor: // ESP_LOGD("iaq-classification", "IAQ not yet established: %s", id(static_iaq_bme688).state); return {"Ukjent"}; // "unknown" in Norwegian } - update_interval: never \ No newline at end of file + update_interval: never + +# UNIT ENV Pro +bme68x_bsec2_i2c: + id: bme68x_bsec_component + i2c_id: ${module.env_i2c_bus} + address: 0x77 + model: BME688 + sample_rate: LP + operating_age: 4d + state_save_interval: 6h diff --git a/board/module/unit_ir_remote.yaml b/board/module/unit_ir_remote.yaml index f9f1025..0ba02a8 100644 --- a/board/module/unit_ir_remote.yaml +++ b/board/module/unit_ir_remote.yaml @@ -14,17 +14,18 @@ logger: remote_transmitter: DEBUG infrared: DEBUG +remote_transmitter: + id: ir_tx + pin: ${module.ir_out_pin} + carrier_duty_percent: 50% + rmt_symbols: ${device.rmt_symbols_block} + # UNIT IR Remote remote_receiver: id: ir_rx pin: ${module.ir_in_pin} rmt_symbols: ${device.rmt_symbols_block} dump: raw -remote_transmitter: - id: ir_tx - pin: ${module.ir_out_pin} - carrier_duty_percent: 50% - rmt_symbols: ${device.rmt_symbols_block} # Infrared platform — creates infrared entities infrared: diff --git a/board/module/unit_mq5.yaml b/board/module/unit_mq5.yaml index 44f4beb..cb2b0f1 100644 --- a/board/module/unit_mq5.yaml +++ b/board/module/unit_mq5.yaml @@ -12,6 +12,21 @@ external_components: - source: github://m5stack/esphome-yaml/components components: m5stack_unit_mq +# Binary GAS DETECTED sensor +binary_sensor: + - platform: template + name: "MQ-5 Combustible Gas" + device_class: gas + # Triggers if the current reading jumps more than 200mV above our dynamic baseline + lambda: |- + // If the reading is invalid (true), completely suppress the alarm + if (id(mq5_led).state) { + return false; + } + + // If the reading is valid, evaluate the gas threshold + return id(mq5_mq_voltage).state > (id(mq5_dynamic_baseline) + 200.0); + # UNIT MQ-5 sensor: # The device needs to be heated for a period of time before it can output normally @@ -125,18 +140,3 @@ globals: - id: mq5_dynamic_baseline type: float initial_value: '250.0' - -# Binary GAS DETECTED sensor -binary_sensor: - - platform: template - name: "MQ-5 Combustible Gas" - device_class: gas - # Triggers if the current reading jumps more than 200mV above our dynamic baseline - lambda: |- - // If the reading is invalid (true), completely suppress the alarm - if (id(mq5_led).state) { - return false; - } - - // If the reading is valid, evaluate the gas threshold - return id(mq5_mq_voltage).state > (id(mq5_dynamic_baseline) + 200.0); diff --git a/board/module/unit_pdm.yaml b/board/module/unit_pdm.yaml index a983167..060e012 100644 --- a/board/module/unit_pdm.yaml +++ b/board/module/unit_pdm.yaml @@ -14,17 +14,6 @@ i2s_audio: i2s_lrclk_pin: ${pin.audio.i2s_lrclk} i2s_bclk_pin: ${pin.audio.i2s_bclk} -# UNIT Mini PDM -microphone: - - platform: i2s_audio - i2s_audio_id: i2s_audio_bus - id: i2s_mic_pdm - bits_per_sample: 8bit - sample_rate: 8000 - adc_type: external - i2s_din_pin: ${pin.audio.mic} - pdm: true - sensor: - platform: sound_level id: sound_level_sensor @@ -48,3 +37,14 @@ switch: on_turn_on: - microphone.mute: + +# UNIT Mini PDM +microphone: + - platform: i2s_audio + i2s_audio_id: i2s_audio_bus + id: i2s_mic_pdm + bits_per_sample: 8bit + sample_rate: 8000 + adc_type: external + i2s_din_pin: ${pin.audio.mic} + pdm: true diff --git a/board/sunton-8048s043c.yaml b/board/sunton-8048s043c.yaml index 59d4584..bc92dbe 100644 --- a/board/sunton-8048s043c.yaml +++ b/board/sunton-8048s043c.yaml @@ -125,4 +125,4 @@ touchscreen: # on_update: # - logger.log: # format: Touch %d at (%d, %d) -# args: [ 'touch->id', 'touch->x', 'touch->y' ] \ No newline at end of file +# args: [ 'touch->id', 'touch->x', 'touch->y' ] diff --git a/board/ulanzi_tc001.yaml b/board/ulanzi_tc001.yaml index 333cf67..54f15c7 100644 --- a/board/ulanzi_tc001.yaml +++ b/board/ulanzi_tc001.yaml @@ -20,14 +20,6 @@ substitutions: framework: type: esp-idf -external_components: - - source: - type: git - url: https://github.com/lubeda/EsphoMaTrixv2 - ref: 2026.4.1 - refresh: 60s - components: [ ehmtxv2 ] - esphome: project: name: "Ulanzi.EHMTXv2" @@ -53,6 +45,27 @@ esp32: ignore_efuse_custom_mac: true sram1_as_iram: true +time: + - id: !extend time_homeassistant + on_time_sync: + - then: + - ds1307.write_time: + - platform: ds1307 + update_interval: never + id: time_rtc + on_time: + # Every day at 08:00 + - seconds: 0 + minutes: 0 + hours: 8 + then: + # Initialize CLOCK screen + - lambda: |- + id(rgb8x32)->clock_screen(1440,30,false,160,240,160); + # Initialize DATE screen + - lambda: |- + id(rgb8x32)->date_screen(1440,15,false,160,240,160); + i2c: id: i2c_bus sda: ${pin.int.i2c.sda} @@ -60,32 +73,72 @@ i2c: frequency: 200kHz scan: true -globals: - # aab = auto-adjustable brightness - - id: aab_enable - type: "bool" - restore_value: true - initial_value: "true" - - id: aab_add - type: int - initial_value: '10' - - id: aab_max - type: int - initial_value: '220' - - id: aab_min - type: int - initial_value: '40' +external_components: + - source: + type: git + url: https://github.com/lubeda/EsphoMaTrixv2 + ref: 2026.4.1 + refresh: 60s + components: [ ehmtxv2 ] -api: - # Enable custom Home Assistant services for EHMTXv2 - custom_services: true - actions: - - action: tune - variables: - tune: string - then: - - rtttl.play: - rtttl: !lambda 'return tune;' +output: + - platform: ledc + pin: ${pin.audio.buzzer} + id: rtttl_out + +light: +# - platform: neopixelbus +# id: light_ehmtx +# variant: ws2812 +# type: GRB +# pin: ${pin.light.led_matrix} +# num_leds: 256 +# color_correct: [30%, 30%, 30%] +# gamma_correct: 2.0 +# restore_mode: ALWAYS_OFF +# name: "Light" +# on_turn_on: +# lambda: |- +# id(display_ehmtx)->set_enabled(false); +# on_turn_off: +# lambda: |- +# id(display_ehmtx)->set_enabled(true); + - platform: esp32_rmt_led_strip + id: light_ehmtx + chipset: ws2812 + rgb_order: GRB + max_refresh_rate: 30ms + pin: ${pin.light.led_matrix} + num_leds: 256 + rmt_symbols: ${device.rmt_symbols_block * 4} + color_correct: [30%, 30%, 30%] + gamma_correct: 2.0 + restore_mode: ALWAYS_OFF + name: "Light" + on_turn_on: + lambda: |- + id(display_ehmtx)->set_enabled(false); + on_turn_off: + lambda: |- + id(display_ehmtx)->set_enabled(true); + +display: + - platform: addressable_light + id: display_ehmtx + addressable_light_id: light_ehmtx + width: 32 + height: 8 + pixel_mapper: |- + if (y % 2 == 0) { + return (y * 32) + x; + } + return (y * 32) + (31 - x); + rotation: 0° + update_interval: 16ms + auto_clear_enabled: true + lambda: |- + id(rgb8x32)->tick(); + id(rgb8x32)->draw(); binary_sensor: - platform: gpio @@ -117,55 +170,6 @@ binary_sensor: # lambda: |- # id(rgb8x32)->skip_screen(); -number: - - platform: template - id: screen_brightness - name: "Brightness" - entity_category: config - min_value: 0 - max_value: 255 - update_interval: 1s - step: 25 - lambda: |- - return id(rgb8x32)->get_brightness(); - set_action: - lambda: |- - id(rgb8x32)->set_brightness(x); - -switch: - - platform: template - id: displaycontrol - name: "Display" - icon: "mdi:power" - entity_category: config - restore_mode: ALWAYS_ON - lambda: |- - return id(rgb8x32)->show_display; - turn_on_action: - lambda: |- - id(rgb8x32)->set_display_on(); - turn_off_action: - lambda: |- - id(rgb8x32)->set_display_off(); - - platform: template - id: switch_autobrightness - name: "Auto-Adjust Brightness" - icon: mdi:brightness-auto - entity_category: config - restore_mode: RESTORE_DEFAULT_ON - lambda: |- - if (id(aab_enable)) { - return true; - } else { - return false; - } - turn_on_action: - lambda: |- - id(aab_enable) = true; - turn_off_action: - lambda: |- - id(aab_enable) = false; - sensor: - platform: sht3xd temperature: @@ -237,98 +241,105 @@ sensor: if ( abs(d) > 2 ) id(rgb8x32)->set_brightness(n); } -output: - - platform: ledc - pin: - number: ${pin.audio.buzzer} - ignore_strapping_warning: true - id: rtttl_out - -rtttl: - output: rtttl_out +number: + - platform: template + id: screen_brightness + name: "Brightness" + entity_category: config + min_value: 0 + max_value: 255 + update_interval: 1s + step: 25 + lambda: |- + return id(rgb8x32)->get_brightness(); + set_action: + lambda: |- + id(rgb8x32)->set_brightness(x); -light: -# - platform: neopixelbus -# id: light_ehmtx -# variant: ws2812 -# type: GRB -# pin: ${pin.light.led_matrix} -# num_leds: 256 -# color_correct: [30%, 30%, 30%] -# gamma_correct: 2.0 -# restore_mode: ALWAYS_OFF -# name: "Light" -# on_turn_on: -# lambda: |- -# id(display_ehmtx)->set_enabled(false); -# on_turn_off: -# lambda: |- -# id(display_ehmtx)->set_enabled(true); - - platform: esp32_rmt_led_strip - id: light_ehmtx - chipset: ws2812 - rgb_order: GRB - max_refresh_rate: 30ms - pin: ${pin.light.led_matrix} - num_leds: 256 - rmt_symbols: ${device.rmt_symbols_block * 4} - color_correct: [30%, 30%, 30%] - gamma_correct: 2.0 - restore_mode: ALWAYS_OFF - name: "Light" - on_turn_on: +switch: + - platform: template + id: displaycontrol + name: "Display" + icon: "mdi:power" + entity_category: config + restore_mode: ALWAYS_ON + lambda: |- + return id(rgb8x32)->show_display; + turn_on_action: lambda: |- - id(display_ehmtx)->set_enabled(false); - on_turn_off: + id(rgb8x32)->set_display_on(); + turn_off_action: lambda: |- - id(display_ehmtx)->set_enabled(true); + id(rgb8x32)->set_display_off(); + - platform: template + id: switch_autobrightness + name: "Auto-Adjust Brightness" + icon: mdi:brightness-auto + entity_category: config + restore_mode: RESTORE_DEFAULT_ON + lambda: |- + if (id(aab_enable)) { + return true; + } else { + return false; + } + turn_on_action: + lambda: |- + id(aab_enable) = true; + turn_off_action: + lambda: |- + id(aab_enable) = false; -time: - - id: !extend time_homeassistant - on_time_sync: - - then: - - ds1307.write_time: - - platform: ds1307 - update_interval: never - id: time_rtc - on_time: - # Every day at 08:00 - - seconds: 0 - minutes: 0 - hours: 8 - then: - # Initialize CLOCK screen - - lambda: |- - id(rgb8x32)->clock_screen(1440,30,false,160,240,160); - # Initialize DATE screen - - lambda: |- - id(rgb8x32)->date_screen(1440,15,false,160,240,160); +globals: + # aab = auto-adjustable brightness + - id: aab_enable + type: "bool" + restore_value: true + initial_value: "true" + - id: aab_add + type: int + initial_value: '10' + - id: aab_max + type: int + initial_value: '220' + - id: aab_min + type: int + initial_value: '40' -display: - - platform: addressable_light - id: display_ehmtx - addressable_light_id: light_ehmtx - width: 32 - height: 8 - pixel_mapper: |- - if (y % 2 == 0) { - return (y * 32) + x; - } - return (y * 32) + (31 - x); - rotation: 0° - update_interval: 16ms - auto_clear_enabled: true - lambda: |- - id(rgb8x32)->tick(); - id(rgb8x32)->draw(); +api: + # Enable custom Home Assistant services for EHMTXv2 + custom_services: true + actions: + - action: tune + variables: + tune: string + then: + - rtttl.play: + rtttl: !lambda 'return tune;' + +rtttl: + output: rtttl_out #image: # - file: img/1pixel.gif # id: breaking20237 -#animation: -# - file: img/1pixel.gif -# id: breaking202371 +font: + # adapt the filename to your local settings + - file: gui/fonts/MatrixClock-Light8.bdf + id: default_font + size: 8 + glyphs: &norwegian_glyphs [ '!', ' ', '"', '#', '$', '%', '&', "'", '(', ')', '*', ',', '.', '/', '[', '\', ']', '^', '`', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '-', ':', ';', '<', '=', '>', '?', '@', '_', '°', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'æ', 'ø', 'å' ] + - file: gui/fonts/MatrixClock-Chunky6.bdf + id: special_font + size: 6 + glyphs: &clock_glyphs [ '!', ' ', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', 'A', 'P', 'M', 'T', 'a', 'p', 'm', 't' ] ehmtxv2: id: rgb8x32 @@ -360,19 +371,6 @@ ehmtxv2: id(rgb8x32)->set_weekday_color(155,155,155); id(rgb8x32)->set_today_color(240,160,160); -font: - # adapt the filename to your local settings - - file: gui/fonts/MatrixClock-Light8.bdf - id: default_font - size: 8 - glyphs: &norwegian_glyphs [ '!', ' ', '"', '#', '$', '%', '&', "'", '(', ')', '*', ',', '.', '/', '[', '\', ']', '^', '`', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '-', ':', ';', '<', '=', '>', '?', '@', '_', '°', - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', - 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'æ', 'ø', 'å' ] - - file: gui/fonts/MatrixClock-Chunky6.bdf - id: special_font - size: 6 - glyphs: &clock_glyphs [ '!', ' ', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', 'A', 'P', 'M', 'T', 'a', 'p', 'm', 't' ] +#animation: +# - file: img/1pixel.gif +# id: breaking202371 diff --git a/board/upesy_wroom.yaml b/board/upesy_wroom.yaml index 0f129a5..2ea5dea 100644 --- a/board/upesy_wroom.yaml +++ b/board/upesy_wroom.yaml @@ -29,4 +29,4 @@ esp32: type: ${device.framework.type} status_led: - pin: ${pin.light.led} \ No newline at end of file + pin: ${pin.light.led} diff --git a/board/waveshare_epaper_driver.yaml b/board/waveshare_epaper_driver.yaml index f7c7c70..ecdb329 100644 --- a/board/waveshare_epaper_driver.yaml +++ b/board/waveshare_epaper_driver.yaml @@ -72,4 +72,4 @@ display: - id: page_white lambda: |- // Fill background. - it.fill( COLOR_OFF ); \ No newline at end of file + it.fill( COLOR_OFF );