esphome 2024.7.2__py3-none-any.whl → 2024.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/__main__.py +15 -81
- esphome/automation.py +1 -1
- esphome/codegen.py +53 -53
- esphome/components/ade7953/sensor.py +1 -1
- esphome/components/ade7953_spi/ade7953_spi.cpp +1 -1
- esphome/components/airthings_wave_plus/airthings_wave_plus.cpp +5 -2
- esphome/components/airthings_wave_plus/airthings_wave_plus.h +2 -0
- esphome/components/airthings_wave_plus/sensor.py +12 -0
- esphome/components/alarm_control_panel/__init__.py +75 -66
- esphome/components/apds9306/__init__.py +4 -0
- esphome/components/apds9306/apds9306.cpp +151 -0
- esphome/components/apds9306/apds9306.h +66 -0
- esphome/components/apds9306/sensor.py +95 -0
- esphome/components/api/__init__.py +80 -52
- esphome/components/api/api_connection.cpp +14 -1
- esphome/components/api/api_pb2.cpp +33 -4
- esphome/components/api/api_pb2.h +8 -1
- esphome/components/api/api_server.cpp +10 -0
- esphome/components/api/api_server.h +3 -0
- esphome/components/atm90e32/__init__.py +7 -0
- esphome/components/atm90e32/atm90e32.cpp +68 -16
- esphome/components/atm90e32/atm90e32.h +20 -7
- esphome/components/atm90e32/atm90e32_reg.h +2 -0
- esphome/components/atm90e32/button/__init__.py +43 -0
- esphome/components/atm90e32/button/atm90e32_button.cpp +20 -0
- esphome/components/atm90e32/button/atm90e32_button.h +27 -0
- esphome/components/atm90e32/sensor.py +15 -11
- esphome/components/bedjet/bedjet_codec.h +1 -1
- esphome/components/binary/light/binary_light_output.h +3 -2
- esphome/components/binary_sensor/__init__.py +5 -5
- esphome/components/ble_client/__init__.py +3 -3
- esphome/components/ble_client/output/__init__.py +1 -1
- esphome/components/ble_client/sensor/__init__.py +4 -3
- esphome/components/ble_client/switch/__init__.py +2 -1
- esphome/components/ble_client/text_sensor/__init__.py +4 -3
- esphome/components/ble_presence/binary_sensor.py +3 -3
- esphome/components/ble_rssi/sensor.py +2 -2
- esphome/components/ble_scanner/text_sensor.py +1 -1
- esphome/components/bluetooth_proxy/__init__.py +3 -3
- esphome/components/bme68x_bsec2/__init__.py +196 -0
- esphome/components/bme68x_bsec2/bme68x_bsec2.cpp +523 -0
- esphome/components/bme68x_bsec2/bme68x_bsec2.h +163 -0
- esphome/components/bme68x_bsec2/sensor.py +130 -0
- esphome/components/bme68x_bsec2/text_sensor.py +33 -0
- esphome/components/bme68x_bsec2_i2c/__init__.py +28 -0
- esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.cpp +53 -0
- esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.h +28 -0
- esphome/components/bmp3xx/sensor.py +1 -1
- esphome/components/button/__init__.py +4 -4
- esphome/components/climate/__init__.py +5 -5
- esphome/components/climate/climate.h +1 -1
- esphome/components/cover/__init__.py +8 -8
- esphome/components/cst226/touchscreen/cst226_touchscreen.cpp +11 -7
- esphome/components/cst226/touchscreen/cst226_touchscreen.h +1 -1
- esphome/components/datetime/__init__.py +11 -13
- esphome/components/demo/demo_sensor.h +3 -2
- esphome/components/display/display.cpp +31 -0
- esphome/components/display/display.h +3 -0
- esphome/components/display_menu_base/__init__.py +14 -13
- esphome/components/ens160/sensor.py +1 -1
- esphome/components/esp32/__init__.py +22 -10
- esphome/components/esp32/boards.py +1 -1
- esphome/components/esp32/gpio.py +12 -13
- esphome/components/esp32/gpio_esp32.py +1 -2
- esphome/components/esp32/gpio_esp32_c2.py +1 -2
- esphome/components/esp32/gpio_esp32_c3.py +1 -5
- esphome/components/esp32/gpio_esp32_c6.py +1 -2
- esphome/components/esp32/gpio_esp32_h2.py +1 -2
- esphome/components/esp32/gpio_esp32_s2.py +1 -2
- esphome/components/esp32/gpio_esp32_s3.py +1 -6
- esphome/components/esp32_ble/__init__.py +20 -3
- esphome/components/esp32_ble/ble.cpp +9 -1
- esphome/components/esp32_ble/ble.h +9 -0
- esphome/components/esp32_ble/ble_advertising.cpp +42 -9
- esphome/components/esp32_ble/ble_advertising.h +21 -1
- esphome/components/esp32_ble_beacon/__init__.py +17 -7
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +45 -113
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.h +17 -19
- esphome/components/esp32_ble_client/__init__.py +0 -1
- esphome/components/esp32_ble_server/__init__.py +2 -3
- esphome/components/esp32_ble_tracker/__init__.py +2 -2
- esphome/components/esp32_improv/__init__.py +2 -4
- esphome/components/ethernet/__init__.py +17 -17
- esphome/components/ethernet_info/text_sensor.py +2 -2
- esphome/components/event/__init__.py +5 -5
- esphome/components/fan/__init__.py +14 -14
- esphome/components/fan/fan.cpp +2 -2
- esphome/components/fingerprint_grow/fingerprint_grow.cpp +1 -1
- esphome/components/fingerprint_grow/fingerprint_grow.h +1 -1
- esphome/components/graphical_display_menu/__init__.py +11 -8
- esphome/components/haier/haier_base.h +2 -2
- esphome/components/homeassistant/__init__.py +8 -1
- esphome/components/homeassistant/number/__init__.py +33 -0
- esphome/components/homeassistant/number/homeassistant_number.cpp +100 -0
- esphome/components/homeassistant/number/homeassistant_number.h +31 -0
- esphome/components/homeassistant/switch/__init__.py +30 -0
- esphome/components/homeassistant/switch/homeassistant_switch.cpp +59 -0
- esphome/components/homeassistant/switch/homeassistant_switch.h +22 -0
- esphome/components/host/__init__.py +3 -7
- esphome/components/http_request/__init__.py +12 -1
- esphome/components/http_request/http_request_arduino.cpp +2 -2
- esphome/components/http_request/http_request_idf.cpp +11 -2
- esphome/components/http_request/http_request_idf.h +10 -0
- esphome/components/http_request/ota/ota_http_request.cpp +1 -1
- esphome/components/http_request/update/http_request_update.cpp +2 -2
- esphome/components/http_request/update/http_request_update.h +2 -1
- esphome/components/hx711/hx711.cpp +10 -1
- esphome/components/hydreon_rgxx/hydreon_rgxx.cpp +1 -1
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +11 -2
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +2 -0
- esphome/components/ili9xxx/ili9xxx_defines.h +3 -1
- esphome/components/ili9xxx/ili9xxx_display.cpp +9 -22
- esphome/components/ili9xxx/ili9xxx_display.h +5 -7
- esphome/components/ili9xxx/ili9xxx_init.h +4 -4
- esphome/components/improv_base/__init__.py +2 -3
- esphome/components/improv_serial/__init__.py +4 -10
- esphome/components/improv_serial/improv_serial_component.cpp +4 -0
- esphome/components/jsn_sr04t/jsn_sr04t.cpp +18 -1
- esphome/components/jsn_sr04t/jsn_sr04t.h +7 -1
- esphome/components/jsn_sr04t/sensor.py +13 -0
- esphome/components/kalman_combinator/sensor.py +1 -1
- esphome/components/light/__init__.py +16 -15
- esphome/components/light/addressable_light_effect.h +12 -8
- esphome/components/light/automation.h +16 -1
- esphome/components/light/automation.py +21 -0
- esphome/components/light/base_light_effects.h +5 -5
- esphome/components/light/esp_color_correction.h +8 -8
- esphome/components/light/types.py +7 -0
- esphome/components/lock/__init__.py +3 -3
- esphome/components/logger/__init__.py +15 -18
- esphome/components/lvgl/__init__.py +346 -0
- esphome/components/lvgl/automation.py +226 -0
- esphome/components/lvgl/binary_sensor/__init__.py +43 -0
- esphome/components/lvgl/defines.py +508 -0
- esphome/components/lvgl/encoders.py +77 -0
- esphome/components/lvgl/font.cpp +76 -0
- esphome/components/lvgl/helpers.py +49 -0
- esphome/components/lvgl/light/__init__.py +32 -0
- esphome/components/lvgl/light/lvgl_light.h +48 -0
- esphome/components/lvgl/lv_validation.py +303 -0
- esphome/components/lvgl/lvcode.py +349 -0
- esphome/components/lvgl/lvgl_esphome.cpp +407 -0
- esphome/components/lvgl/lvgl_esphome.h +274 -0
- esphome/components/lvgl/lvgl_hal.h +21 -0
- esphome/components/lvgl/number/__init__.py +66 -0
- esphome/components/lvgl/number/lvgl_number.h +34 -0
- esphome/components/lvgl/schemas.py +436 -0
- esphome/components/lvgl/select/__init__.py +55 -0
- esphome/components/lvgl/select/lvgl_select.h +62 -0
- esphome/components/lvgl/sensor/__init__.py +47 -0
- esphome/components/lvgl/styles.py +58 -0
- esphome/components/lvgl/switch/__init__.py +56 -0
- esphome/components/lvgl/switch/lvgl_switch.h +34 -0
- esphome/components/lvgl/text/__init__.py +50 -0
- esphome/components/lvgl/text/lvgl_text.h +34 -0
- esphome/components/lvgl/text_sensor/__init__.py +42 -0
- esphome/components/lvgl/touchscreens.py +45 -0
- esphome/components/lvgl/trigger.py +74 -0
- esphome/components/lvgl/types.py +191 -0
- esphome/components/lvgl/widgets/__init__.py +419 -0
- esphome/components/lvgl/widgets/animimg.py +117 -0
- esphome/components/lvgl/widgets/arc.py +78 -0
- esphome/components/lvgl/widgets/button.py +20 -0
- esphome/components/lvgl/widgets/buttonmatrix.py +275 -0
- esphome/components/lvgl/widgets/checkbox.py +27 -0
- esphome/components/lvgl/widgets/dropdown.py +76 -0
- esphome/components/lvgl/widgets/img.py +85 -0
- esphome/components/lvgl/widgets/keyboard.py +49 -0
- esphome/components/lvgl/widgets/label.py +42 -0
- esphome/components/lvgl/widgets/led.py +29 -0
- esphome/components/lvgl/widgets/line.py +50 -0
- esphome/components/lvgl/widgets/lv_bar.py +55 -0
- esphome/components/lvgl/widgets/meter.py +302 -0
- esphome/components/lvgl/widgets/msgbox.py +134 -0
- esphome/components/lvgl/widgets/obj.py +28 -0
- esphome/components/lvgl/widgets/page.py +113 -0
- esphome/components/lvgl/widgets/roller.py +77 -0
- esphome/components/lvgl/widgets/slider.py +63 -0
- esphome/components/lvgl/widgets/spinbox.py +178 -0
- esphome/components/lvgl/widgets/spinner.py +43 -0
- esphome/components/lvgl/widgets/switch.py +20 -0
- esphome/components/lvgl/widgets/tabview.py +114 -0
- esphome/components/lvgl/widgets/textarea.py +66 -0
- esphome/components/lvgl/widgets/tileview.py +128 -0
- esphome/components/m5stack_8angle/__init__.py +33 -0
- esphome/components/m5stack_8angle/binary_sensor/__init__.py +30 -0
- esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +17 -0
- esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.h +19 -0
- esphome/components/m5stack_8angle/light/__init__.py +31 -0
- esphome/components/m5stack_8angle/light/m5stack_8angle_light.cpp +45 -0
- esphome/components/m5stack_8angle/light/m5stack_8angle_light.h +37 -0
- esphome/components/m5stack_8angle/m5stack_8angle.cpp +74 -0
- esphome/components/m5stack_8angle/m5stack_8angle.h +34 -0
- esphome/components/m5stack_8angle/sensor/__init__.py +66 -0
- esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +24 -0
- esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.h +27 -0
- esphome/components/matrix_keypad/matrix_keypad.cpp +2 -0
- esphome/components/max31856/sensor.py +5 -5
- esphome/components/media_player/__init__.py +3 -5
- esphome/components/media_player/automation.h +31 -27
- esphome/components/micro_wake_word/__init__.py +20 -25
- esphome/components/micro_wake_word/streaming_model.cpp +6 -4
- esphome/components/microphone/microphone.h +4 -1
- esphome/components/mitsubishi/mitsubishi.cpp +7 -1
- esphome/components/modbus_controller/__init__.py +26 -2
- esphome/components/modbus_controller/automation.h +19 -0
- esphome/components/modbus_controller/const.py +1 -0
- esphome/components/modbus_controller/modbus_controller.cpp +8 -0
- esphome/components/modbus_controller/modbus_controller.h +3 -0
- esphome/components/mqtt/__init__.py +20 -9
- esphome/components/mqtt/mqtt_alarm_control_panel.cpp +128 -0
- esphome/components/mqtt/mqtt_alarm_control_panel.h +39 -0
- esphome/components/mqtt/mqtt_backend.h +3 -1
- esphome/components/mqtt/mqtt_backend_esp32.cpp +4 -1
- esphome/components/mqtt/mqtt_backend_esp32.h +3 -1
- esphome/components/mqtt/mqtt_backend_esp8266.h +3 -1
- esphome/components/mqtt/mqtt_backend_libretiny.h +3 -1
- esphome/components/mqtt/mqtt_client.cpp +16 -3
- esphome/components/mqtt/mqtt_client.h +5 -1
- esphome/components/mqtt/mqtt_component.cpp +32 -4
- esphome/components/mqtt/mqtt_const.h +2 -0
- esphome/components/network/__init__.py +15 -12
- esphome/components/network/ip_address.h +3 -0
- esphome/components/network/util.cpp +2 -1
- esphome/components/network/util.h +3 -1
- esphome/components/nextion/base_component.py +5 -8
- esphome/components/number/__init__.py +7 -8
- esphome/components/online_image/__init__.py +167 -0
- esphome/components/online_image/image_decoder.cpp +44 -0
- esphome/components/online_image/image_decoder.h +112 -0
- esphome/components/online_image/online_image.cpp +283 -0
- esphome/components/online_image/online_image.h +195 -0
- esphome/components/online_image/png_image.cpp +68 -0
- esphome/components/online_image/png_image.h +33 -0
- esphome/components/ota/__init__.py +8 -4
- esphome/components/pid/pid_climate.h +2 -0
- esphome/components/pmwcs3/pmwcs3.cpp +31 -30
- esphome/components/remote_base/pronto_protocol.cpp +0 -3
- esphome/components/remote_transmitter/remote_transmitter.h +1 -1
- esphome/components/rgbct/rgbct_light_output.h +3 -2
- esphome/components/rgbw/rgbw_light_output.h +3 -2
- esphome/components/rgbww/rgbww_light_output.h +3 -2
- esphome/components/rp2040_pio_led_strip/led_strip.cpp +31 -5
- esphome/components/rp2040_pio_led_strip/led_strip.h +5 -0
- esphome/components/rtttl/rtttl.cpp +108 -21
- esphome/components/rtttl/rtttl.h +15 -6
- esphome/components/select/__init__.py +7 -7
- esphome/components/sensor/__init__.py +29 -10
- esphome/components/sensor/filter.cpp +8 -0
- esphome/components/sensor/filter.h +9 -0
- esphome/components/sml/sml_parser.cpp +48 -22
- esphome/components/socket/socket.cpp +11 -14
- esphome/components/speaker/__init__.py +14 -5
- esphome/components/speaker/automation.h +10 -0
- esphome/components/speaker/speaker.h +9 -0
- esphome/components/spi/spi.cpp +0 -6
- esphome/components/spi/spi.h +2 -19
- esphome/components/spi_led_strip/spi_led_strip.h +5 -4
- esphome/components/sprinkler/sprinkler.cpp +2 -2
- esphome/components/sprinkler/sprinkler.h +1 -1
- esphome/components/switch/__init__.py +3 -3
- esphome/components/text/__init__.py +5 -5
- esphome/components/text_sensor/__init__.py +7 -7
- esphome/components/time/__init__.py +8 -8
- esphome/components/touchscreen/binary_sensor/__init__.py +24 -10
- esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.cpp +3 -2
- esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.h +4 -2
- esphome/components/uart/uart_component_host.cpp +6 -2
- esphome/components/update/__init__.py +33 -15
- esphome/components/update/automation.h +23 -0
- esphome/components/update/update_entity.h +3 -1
- esphome/components/valve/__init__.py +3 -3
- esphome/components/voice_assistant/__init__.py +7 -8
- esphome/components/wake_on_lan/wake_on_lan.cpp +2 -0
- esphome/components/wake_on_lan/wake_on_lan.h +3 -1
- esphome/components/watchdog/__init__.py +1 -0
- esphome/components/{http_request → watchdog}/watchdog.cpp +0 -2
- esphome/components/{http_request → watchdog}/watchdog.h +0 -2
- esphome/components/waveshare_epaper/waveshare_epaper.cpp +5 -5
- esphome/components/web_server/server_index_v3.h +3615 -3603
- esphome/components/web_server/web_server.cpp +0 -209
- esphome/components/web_server/web_server.h +1 -1
- esphome/components/web_server/web_server_v1.cpp +217 -0
- esphome/components/web_server_base/web_server_base.h +1 -0
- esphome/components/wifi/__init__.py +15 -14
- esphome/components/wifi/wifi_component.cpp +2 -0
- esphome/components/wifi/wifi_component.h +7 -1
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +5 -2
- esphome/components/wifi/wifi_component_esp8266.cpp +2 -0
- esphome/components/wifi/wifi_component_esp_idf.cpp +43 -7
- esphome/components/wifi/wifi_component_libretiny.cpp +2 -0
- esphome/components/wifi/wifi_component_pico_w.cpp +2 -0
- esphome/components/wifi/wpa2_eap.py +6 -7
- esphome/components/wifi_info/text_sensor.py +3 -3
- esphome/components/wifi_info/wifi_info_text_sensor.cpp +2 -0
- esphome/components/wifi_info/wifi_info_text_sensor.h +2 -0
- esphome/components/wifi_signal/sensor.py +1 -1
- esphome/components/wifi_signal/wifi_signal_sensor.cpp +2 -0
- esphome/components/wifi_signal/wifi_signal_sensor.h +2 -1
- esphome/components/xiaomi_ble/xiaomi_ble.cpp +20 -3
- esphome/components/xiaomi_ble/xiaomi_ble.h +1 -0
- esphome/components/xiaomi_lywsd02mmc/__init__.py +0 -0
- esphome/components/xiaomi_lywsd02mmc/sensor.py +77 -0
- esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.cpp +73 -0
- esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.h +37 -0
- esphome/config.py +17 -19
- esphome/config_validation.py +55 -23
- esphome/const.py +25 -9
- esphome/core/__init__.py +17 -14
- esphome/core/application.h +42 -21
- esphome/core/automation.h +5 -3
- esphome/core/base_automation.h +3 -2
- esphome/core/bytebuffer.cpp +134 -0
- esphome/core/bytebuffer.h +96 -0
- esphome/core/color.h +24 -16
- esphome/core/config.py +3 -3
- esphome/core/defines.h +14 -1
- esphome/core/entity_base.h +2 -2
- esphome/core/entity_helpers.py +1 -2
- esphome/core/gpio.h +0 -18
- esphome/core/helpers.h +1 -1
- esphome/core/optional.h +15 -16
- esphome/coroutine.py +1 -1
- esphome/cpp_generator.py +1 -1
- esphome/cpp_helpers.py +3 -5
- esphome/dashboard/core.py +3 -3
- esphome/dashboard/dashboard.py +3 -3
- esphome/dashboard/entries.py +1 -1
- esphome/dashboard/util/file.py +1 -1
- esphome/dashboard/web_server.py +3 -3
- esphome/external_files.py +5 -3
- esphome/final_validate.py +2 -2
- esphome/git.py +4 -4
- esphome/helpers.py +5 -5
- esphome/loader.py +15 -10
- esphome/mqtt.py +4 -8
- esphome/pins.py +6 -6
- esphome/platformio_api.py +5 -5
- esphome/storage_json.py +2 -1
- esphome/types.py +1 -1
- esphome/util.py +2 -3
- esphome/voluptuous_schema.py +1 -0
- esphome/vscode.py +5 -4
- esphome/wizard.py +1 -1
- esphome/writer.py +7 -7
- esphome/yaml_util.py +3 -3
- esphome/zeroconf.py +1 -1
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/METADATA +3 -3
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/RECORD +353 -247
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/LICENSE +0 -0
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/WHEEL +0 -0
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/components/binary_sensor/binary_sensor.h"
|
4
|
+
#include "esphome/core/component.h"
|
5
|
+
|
6
|
+
#include "../m5stack_8angle.h"
|
7
|
+
|
8
|
+
namespace esphome {
|
9
|
+
namespace m5stack_8angle {
|
10
|
+
|
11
|
+
class M5Stack8AngleSwitchBinarySensor : public binary_sensor::BinarySensor,
|
12
|
+
public PollingComponent,
|
13
|
+
public Parented<M5Stack8AngleComponent> {
|
14
|
+
public:
|
15
|
+
void update() override;
|
16
|
+
};
|
17
|
+
|
18
|
+
} // namespace m5stack_8angle
|
19
|
+
} // namespace esphome
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import esphome.codegen as cg
|
2
|
+
import esphome.config_validation as cv
|
3
|
+
from esphome.components import light
|
4
|
+
|
5
|
+
from esphome.const import CONF_OUTPUT_ID
|
6
|
+
|
7
|
+
from .. import M5Stack8AngleComponent, m5stack_8angle_ns, CONF_M5STACK_8ANGLE_ID
|
8
|
+
|
9
|
+
|
10
|
+
M5Stack8AngleLightsComponent = m5stack_8angle_ns.class_(
|
11
|
+
"M5Stack8AngleLightOutput",
|
12
|
+
light.AddressableLight,
|
13
|
+
)
|
14
|
+
|
15
|
+
|
16
|
+
CONFIG_SCHEMA = cv.All(
|
17
|
+
light.ADDRESSABLE_LIGHT_SCHEMA.extend(
|
18
|
+
{
|
19
|
+
cv.GenerateID(CONF_M5STACK_8ANGLE_ID): cv.use_id(M5Stack8AngleComponent),
|
20
|
+
cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(M5Stack8AngleLightsComponent),
|
21
|
+
}
|
22
|
+
)
|
23
|
+
)
|
24
|
+
|
25
|
+
|
26
|
+
async def to_code(config):
|
27
|
+
hub = await cg.get_variable(config[CONF_M5STACK_8ANGLE_ID])
|
28
|
+
lights = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
29
|
+
await light.register_light(lights, config)
|
30
|
+
await cg.register_component(lights, config)
|
31
|
+
cg.add(lights.set_parent(hub))
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#include "m5stack_8angle_light.h"
|
2
|
+
|
3
|
+
#include "esphome/core/log.h"
|
4
|
+
|
5
|
+
namespace esphome {
|
6
|
+
namespace m5stack_8angle {
|
7
|
+
|
8
|
+
static const char *const TAG = "m5stack_8angle.light";
|
9
|
+
|
10
|
+
void M5Stack8AngleLightOutput::setup() {
|
11
|
+
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
|
12
|
+
this->buf_ = allocator.allocate(M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED);
|
13
|
+
if (this->buf_ == nullptr) {
|
14
|
+
ESP_LOGE(TAG, "Failed to allocate buffer of size %u", M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED);
|
15
|
+
this->mark_failed();
|
16
|
+
return;
|
17
|
+
};
|
18
|
+
memset(this->buf_, 0xFF, M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED);
|
19
|
+
|
20
|
+
this->effect_data_ = allocator.allocate(M5STACK_8ANGLE_NUM_LEDS);
|
21
|
+
if (this->effect_data_ == nullptr) {
|
22
|
+
ESP_LOGE(TAG, "Failed to allocate effect data of size %u", M5STACK_8ANGLE_NUM_LEDS);
|
23
|
+
this->mark_failed();
|
24
|
+
return;
|
25
|
+
};
|
26
|
+
memset(this->effect_data_, 0x00, M5STACK_8ANGLE_NUM_LEDS);
|
27
|
+
}
|
28
|
+
|
29
|
+
void M5Stack8AngleLightOutput::write_state(light::LightState *state) {
|
30
|
+
for (int i = 0; i < M5STACK_8ANGLE_NUM_LEDS;
|
31
|
+
i++) { // write one LED at a time, otherwise the message will be truncated
|
32
|
+
this->parent_->write_register(M5STACK_8ANGLE_REGISTER_RGB_24B + i * M5STACK_8ANGLE_BYTES_PER_LED,
|
33
|
+
this->buf_ + i * M5STACK_8ANGLE_BYTES_PER_LED, M5STACK_8ANGLE_BYTES_PER_LED);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
light::ESPColorView M5Stack8AngleLightOutput::get_view_internal(int32_t index) const {
|
38
|
+
size_t pos = index * M5STACK_8ANGLE_BYTES_PER_LED;
|
39
|
+
// red, green, blue, white, effect_data, color_correction
|
40
|
+
return {this->buf_ + pos, this->buf_ + pos + 1, this->buf_ + pos + 2,
|
41
|
+
nullptr, this->effect_data_ + index, &this->correction_};
|
42
|
+
}
|
43
|
+
|
44
|
+
} // namespace m5stack_8angle
|
45
|
+
} // namespace esphome
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/components/light/addressable_light.h"
|
4
|
+
#include "esphome/components/light/light_output.h"
|
5
|
+
|
6
|
+
#include "../m5stack_8angle.h"
|
7
|
+
|
8
|
+
namespace esphome {
|
9
|
+
namespace m5stack_8angle {
|
10
|
+
|
11
|
+
static const uint8_t M5STACK_8ANGLE_NUM_LEDS = 9;
|
12
|
+
static const uint8_t M5STACK_8ANGLE_BYTES_PER_LED = 4;
|
13
|
+
|
14
|
+
class M5Stack8AngleLightOutput : public light::AddressableLight, public Parented<M5Stack8AngleComponent> {
|
15
|
+
public:
|
16
|
+
void setup() override;
|
17
|
+
|
18
|
+
void write_state(light::LightState *state) override;
|
19
|
+
|
20
|
+
int32_t size() const override { return M5STACK_8ANGLE_NUM_LEDS; }
|
21
|
+
light::LightTraits get_traits() override {
|
22
|
+
auto traits = light::LightTraits();
|
23
|
+
traits.set_supported_color_modes({light::ColorMode::RGB});
|
24
|
+
return traits;
|
25
|
+
};
|
26
|
+
|
27
|
+
void clear_effect_data() override { memset(this->effect_data_, 0x00, M5STACK_8ANGLE_NUM_LEDS); };
|
28
|
+
|
29
|
+
protected:
|
30
|
+
light::ESPColorView get_view_internal(int32_t index) const override;
|
31
|
+
|
32
|
+
uint8_t *buf_{nullptr};
|
33
|
+
uint8_t *effect_data_{nullptr};
|
34
|
+
};
|
35
|
+
|
36
|
+
} // namespace m5stack_8angle
|
37
|
+
} // namespace esphome
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#include "m5stack_8angle.h"
|
2
|
+
#include "esphome/core/hal.h"
|
3
|
+
#include "esphome/core/log.h"
|
4
|
+
|
5
|
+
namespace esphome {
|
6
|
+
namespace m5stack_8angle {
|
7
|
+
|
8
|
+
static const char *const TAG = "m5stack_8angle";
|
9
|
+
|
10
|
+
void M5Stack8AngleComponent::setup() {
|
11
|
+
ESP_LOGCONFIG(TAG, "Setting up M5STACK_8ANGLE...");
|
12
|
+
i2c::ErrorCode err;
|
13
|
+
|
14
|
+
err = this->read(nullptr, 0);
|
15
|
+
if (err != i2c::NO_ERROR) {
|
16
|
+
ESP_LOGE(TAG, "I2C error %02X...", err);
|
17
|
+
this->mark_failed();
|
18
|
+
return;
|
19
|
+
};
|
20
|
+
|
21
|
+
err = this->read_register(M5STACK_8ANGLE_REGISTER_FW_VERSION, &this->fw_version_, 1);
|
22
|
+
if (err != i2c::NO_ERROR) {
|
23
|
+
ESP_LOGE(TAG, "I2C error %02X...", err);
|
24
|
+
this->mark_failed();
|
25
|
+
return;
|
26
|
+
};
|
27
|
+
}
|
28
|
+
|
29
|
+
void M5Stack8AngleComponent::dump_config() {
|
30
|
+
ESP_LOGCONFIG(TAG, "M5STACK_8ANGLE:");
|
31
|
+
LOG_I2C_DEVICE(this);
|
32
|
+
ESP_LOGCONFIG(TAG, " Firmware version: %d ", this->fw_version_);
|
33
|
+
}
|
34
|
+
|
35
|
+
float M5Stack8AngleComponent::read_knob_pos(uint8_t channel, AnalogBits bits) {
|
36
|
+
int32_t raw_pos = this->read_knob_pos_raw(channel, bits);
|
37
|
+
if (raw_pos == -1) {
|
38
|
+
return NAN;
|
39
|
+
}
|
40
|
+
return (float) raw_pos / ((1 << bits) - 1);
|
41
|
+
}
|
42
|
+
|
43
|
+
int32_t M5Stack8AngleComponent::read_knob_pos_raw(uint8_t channel, AnalogBits bits) {
|
44
|
+
uint16_t knob_pos = 0;
|
45
|
+
i2c::ErrorCode err;
|
46
|
+
if (bits == BITS_8) {
|
47
|
+
err = this->read_register(M5STACK_8ANGLE_REGISTER_ANALOG_INPUT_8B + channel, (uint8_t *) &knob_pos, 1);
|
48
|
+
} else if (bits == BITS_12) {
|
49
|
+
err = this->read_register(M5STACK_8ANGLE_REGISTER_ANALOG_INPUT_12B + (channel * 2), (uint8_t *) &knob_pos, 2);
|
50
|
+
} else {
|
51
|
+
ESP_LOGE(TAG, "Invalid number of bits: %d", bits);
|
52
|
+
return -1;
|
53
|
+
}
|
54
|
+
if (err == i2c::NO_ERROR) {
|
55
|
+
return knob_pos;
|
56
|
+
} else {
|
57
|
+
return -1;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
int8_t M5Stack8AngleComponent::read_switch() {
|
62
|
+
uint8_t out;
|
63
|
+
i2c::ErrorCode err = this->read_register(M5STACK_8ANGLE_REGISTER_DIGITAL_INPUT, (uint8_t *) &out, 1);
|
64
|
+
if (err == i2c::NO_ERROR) {
|
65
|
+
return out ? 1 : 0;
|
66
|
+
} else {
|
67
|
+
return -1;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
float M5Stack8AngleComponent::get_setup_priority() const { return setup_priority::DATA; }
|
72
|
+
|
73
|
+
} // namespace m5stack_8angle
|
74
|
+
} // namespace esphome
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/components/i2c/i2c.h"
|
4
|
+
#include "esphome/core/component.h"
|
5
|
+
|
6
|
+
namespace esphome {
|
7
|
+
namespace m5stack_8angle {
|
8
|
+
|
9
|
+
static const uint8_t M5STACK_8ANGLE_REGISTER_ANALOG_INPUT_12B = 0x00;
|
10
|
+
static const uint8_t M5STACK_8ANGLE_REGISTER_ANALOG_INPUT_8B = 0x10;
|
11
|
+
static const uint8_t M5STACK_8ANGLE_REGISTER_DIGITAL_INPUT = 0x20;
|
12
|
+
static const uint8_t M5STACK_8ANGLE_REGISTER_RGB_24B = 0x30;
|
13
|
+
static const uint8_t M5STACK_8ANGLE_REGISTER_FW_VERSION = 0xFE;
|
14
|
+
|
15
|
+
enum AnalogBits : uint8_t {
|
16
|
+
BITS_8 = 8,
|
17
|
+
BITS_12 = 12,
|
18
|
+
};
|
19
|
+
|
20
|
+
class M5Stack8AngleComponent : public i2c::I2CDevice, public Component {
|
21
|
+
public:
|
22
|
+
void setup() override;
|
23
|
+
void dump_config() override;
|
24
|
+
float get_setup_priority() const override;
|
25
|
+
float read_knob_pos(uint8_t channel, AnalogBits bits = AnalogBits::BITS_8);
|
26
|
+
int32_t read_knob_pos_raw(uint8_t channel, AnalogBits bits = AnalogBits::BITS_8);
|
27
|
+
int8_t read_switch();
|
28
|
+
|
29
|
+
protected:
|
30
|
+
uint8_t fw_version_;
|
31
|
+
};
|
32
|
+
|
33
|
+
} // namespace m5stack_8angle
|
34
|
+
} // namespace esphome
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import esphome.codegen as cg
|
2
|
+
import esphome.config_validation as cv
|
3
|
+
from esphome.components import sensor
|
4
|
+
|
5
|
+
from esphome.const import (
|
6
|
+
CONF_BIT_DEPTH,
|
7
|
+
CONF_CHANNEL,
|
8
|
+
CONF_RAW,
|
9
|
+
ICON_ROTATE_RIGHT,
|
10
|
+
STATE_CLASS_MEASUREMENT,
|
11
|
+
)
|
12
|
+
|
13
|
+
from .. import (
|
14
|
+
AnalogBits,
|
15
|
+
M5Stack8AngleComponent,
|
16
|
+
m5stack_8angle_ns,
|
17
|
+
CONF_M5STACK_8ANGLE_ID,
|
18
|
+
)
|
19
|
+
|
20
|
+
|
21
|
+
M5Stack8AngleKnobSensor = m5stack_8angle_ns.class_(
|
22
|
+
"M5Stack8AngleKnobSensor",
|
23
|
+
sensor.Sensor,
|
24
|
+
cg.PollingComponent,
|
25
|
+
)
|
26
|
+
|
27
|
+
|
28
|
+
BIT_DEPTHS = {
|
29
|
+
8: AnalogBits.BITS_8,
|
30
|
+
12: AnalogBits.BITS_12,
|
31
|
+
}
|
32
|
+
|
33
|
+
_validate_bits = cv.float_with_unit("bits", "bit")
|
34
|
+
|
35
|
+
|
36
|
+
CONFIG_SCHEMA = cv.All(
|
37
|
+
cv.Schema(
|
38
|
+
{
|
39
|
+
cv.GenerateID(): cv.declare_id(M5Stack8AngleKnobSensor),
|
40
|
+
cv.GenerateID(CONF_M5STACK_8ANGLE_ID): cv.use_id(M5Stack8AngleComponent),
|
41
|
+
cv.Required(CONF_CHANNEL): cv.int_range(min=1, max=8),
|
42
|
+
cv.Optional(CONF_BIT_DEPTH, default="8bit"): cv.All(
|
43
|
+
_validate_bits, cv.enum(BIT_DEPTHS)
|
44
|
+
),
|
45
|
+
cv.Optional(CONF_RAW, default=False): cv.boolean,
|
46
|
+
}
|
47
|
+
)
|
48
|
+
.extend(
|
49
|
+
sensor.sensor_schema(
|
50
|
+
M5Stack8AngleKnobSensor,
|
51
|
+
accuracy_decimals=2,
|
52
|
+
icon=ICON_ROTATE_RIGHT,
|
53
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
54
|
+
)
|
55
|
+
)
|
56
|
+
.extend(cv.polling_component_schema("10s"))
|
57
|
+
)
|
58
|
+
|
59
|
+
|
60
|
+
async def to_code(config):
|
61
|
+
var = await sensor.new_sensor(config)
|
62
|
+
await cg.register_component(var, config)
|
63
|
+
await cg.register_parented(var, config[CONF_M5STACK_8ANGLE_ID])
|
64
|
+
cg.add(var.set_channel(config[CONF_CHANNEL] - 1))
|
65
|
+
cg.add(var.set_bit_depth(BIT_DEPTHS[config[CONF_BIT_DEPTH]]))
|
66
|
+
cg.add(var.set_raw(config[CONF_RAW]))
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#include "m5stack_8angle_sensor.h"
|
2
|
+
|
3
|
+
namespace esphome {
|
4
|
+
namespace m5stack_8angle {
|
5
|
+
|
6
|
+
void M5Stack8AngleKnobSensor::update() {
|
7
|
+
if (this->parent_ != nullptr) {
|
8
|
+
int32_t raw_pos = this->parent_->read_knob_pos_raw(this->channel_, this->bits_);
|
9
|
+
if (raw_pos == -1) {
|
10
|
+
this->status_set_warning("Could not read knob position from M5Stack 8Angle.");
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
if (this->raw_) {
|
14
|
+
this->publish_state(raw_pos);
|
15
|
+
} else {
|
16
|
+
float knob_pos = (float) raw_pos / ((1 << this->bits_) - 1);
|
17
|
+
this->publish_state(knob_pos);
|
18
|
+
}
|
19
|
+
this->status_clear_warning();
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
} // namespace m5stack_8angle
|
24
|
+
} // namespace esphome
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/components/sensor/sensor.h"
|
4
|
+
#include "esphome/core/component.h"
|
5
|
+
|
6
|
+
#include "../m5stack_8angle.h"
|
7
|
+
|
8
|
+
namespace esphome {
|
9
|
+
namespace m5stack_8angle {
|
10
|
+
|
11
|
+
class M5Stack8AngleKnobSensor : public sensor::Sensor,
|
12
|
+
public PollingComponent,
|
13
|
+
public Parented<M5Stack8AngleComponent> {
|
14
|
+
public:
|
15
|
+
void update() override;
|
16
|
+
void set_channel(uint8_t channel) { this->channel_ = channel; };
|
17
|
+
void set_bit_depth(AnalogBits bits) { this->bits_ = bits; };
|
18
|
+
void set_raw(bool raw) { this->raw_ = raw; };
|
19
|
+
|
20
|
+
protected:
|
21
|
+
uint8_t channel_;
|
22
|
+
AnalogBits bits_;
|
23
|
+
bool raw_;
|
24
|
+
};
|
25
|
+
|
26
|
+
} // namespace m5stack_8angle
|
27
|
+
} // namespace esphome
|
@@ -8,6 +8,7 @@ static const char *const TAG = "matrix_keypad";
|
|
8
8
|
|
9
9
|
void MatrixKeypad::setup() {
|
10
10
|
for (auto *pin : this->rows_) {
|
11
|
+
pin->setup();
|
11
12
|
if (!has_diodes_) {
|
12
13
|
pin->pin_mode(gpio::FLAG_INPUT);
|
13
14
|
} else {
|
@@ -15,6 +16,7 @@ void MatrixKeypad::setup() {
|
|
15
16
|
}
|
16
17
|
}
|
17
18
|
for (auto *pin : this->columns_) {
|
19
|
+
pin->setup();
|
18
20
|
if (has_pulldowns_) {
|
19
21
|
pin->pin_mode(gpio::FLAG_INPUT);
|
20
22
|
} else {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
2
|
from esphome.components import sensor, spi
|
3
|
+
import esphome.config_validation as cv
|
4
4
|
from esphome.const import (
|
5
5
|
CONF_MAINS_FILTER,
|
6
6
|
DEVICE_CLASS_TEMPERATURE,
|
@@ -15,8 +15,8 @@ MAX31856Sensor = max31856_ns.class_(
|
|
15
15
|
|
16
16
|
MAX31865ConfigFilter = max31856_ns.enum("MAX31856ConfigFilter")
|
17
17
|
FILTER = {
|
18
|
-
|
19
|
-
|
18
|
+
50: MAX31865ConfigFilter.FILTER_50HZ,
|
19
|
+
60: MAX31865ConfigFilter.FILTER_60HZ,
|
20
20
|
}
|
21
21
|
|
22
22
|
CONFIG_SCHEMA = (
|
@@ -29,8 +29,8 @@ CONFIG_SCHEMA = (
|
|
29
29
|
)
|
30
30
|
.extend(
|
31
31
|
{
|
32
|
-
cv.Optional(CONF_MAINS_FILTER, default="
|
33
|
-
FILTER,
|
32
|
+
cv.Optional(CONF_MAINS_FILTER, default="60Hz"): cv.All(
|
33
|
+
cv.frequency, cv.enum(FILTER, int=True)
|
34
34
|
),
|
35
35
|
}
|
36
36
|
)
|
@@ -1,20 +1,18 @@
|
|
1
1
|
from esphome import automation
|
2
|
-
import esphome.config_validation as cv
|
3
|
-
import esphome.codegen as cg
|
4
|
-
|
5
2
|
from esphome.automation import maybe_simple_id
|
3
|
+
import esphome.codegen as cg
|
4
|
+
import esphome.config_validation as cv
|
6
5
|
from esphome.const import (
|
7
6
|
CONF_ID,
|
7
|
+
CONF_ON_IDLE,
|
8
8
|
CONF_ON_STATE,
|
9
9
|
CONF_TRIGGER_ID,
|
10
10
|
CONF_VOLUME,
|
11
|
-
CONF_ON_IDLE,
|
12
11
|
)
|
13
12
|
from esphome.core import CORE
|
14
13
|
from esphome.coroutine import coroutine_with_priority
|
15
14
|
from esphome.cpp_helpers import setup_entity
|
16
15
|
|
17
|
-
|
18
16
|
CODEOWNERS = ["@jesserockz"]
|
19
17
|
|
20
18
|
IS_PLATFORM_COMPONENT = True
|
@@ -7,30 +7,24 @@ namespace esphome {
|
|
7
7
|
|
8
8
|
namespace media_player {
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
};
|
16
|
-
|
17
|
-
#define MEDIA_PLAYER_SIMPLE_STATE_TRIGGER(TRIGGER_CLASS, TRIGGER_STATE) \
|
18
|
-
class TRIGGER_CLASS : public Trigger<> { \
|
19
|
-
public: \
|
20
|
-
explicit TRIGGER_CLASS(MediaPlayer *player) { \
|
21
|
-
player->add_on_state_callback([this, player]() { \
|
22
|
-
if (player->state == MediaPlayerState::MEDIA_PLAYER_STATE_##TRIGGER_STATE) \
|
23
|
-
this->trigger(); \
|
24
|
-
}); \
|
25
|
-
} \
|
26
|
-
};
|
10
|
+
template<MediaPlayerCommand Command, typename... Ts>
|
11
|
+
class MediaPlayerCommandAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
12
|
+
public:
|
13
|
+
void play(Ts... x) override { this->parent_->make_call().set_command(Command).perform(); }
|
14
|
+
};
|
27
15
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
16
|
+
template<typename... Ts>
|
17
|
+
using PlayAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_PLAY, Ts...>;
|
18
|
+
template<typename... Ts>
|
19
|
+
using PauseAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_PAUSE, Ts...>;
|
20
|
+
template<typename... Ts>
|
21
|
+
using StopAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_STOP, Ts...>;
|
22
|
+
template<typename... Ts>
|
23
|
+
using ToggleAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_TOGGLE, Ts...>;
|
24
|
+
template<typename... Ts>
|
25
|
+
using VolumeUpAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_VOLUME_UP, Ts...>;
|
26
|
+
template<typename... Ts>
|
27
|
+
using VolumeDownAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_VOLUME_DOWN, Ts...>;
|
34
28
|
|
35
29
|
template<typename... Ts> class PlayMediaAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
36
30
|
TEMPLATABLE_VALUE(std::string, media_url)
|
@@ -49,10 +43,20 @@ class StateTrigger : public Trigger<> {
|
|
49
43
|
}
|
50
44
|
};
|
51
45
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
template<MediaPlayerState State> class MediaPlayerStateTrigger : public Trigger<> {
|
47
|
+
public:
|
48
|
+
explicit MediaPlayerStateTrigger(MediaPlayer *player) {
|
49
|
+
player->add_on_state_callback([this, player]() {
|
50
|
+
if (player->state == State)
|
51
|
+
this->trigger();
|
52
|
+
});
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
using IdleTrigger = MediaPlayerStateTrigger<MediaPlayerState::MEDIA_PLAYER_STATE_IDLE>;
|
57
|
+
using PlayTrigger = MediaPlayerStateTrigger<MediaPlayerState::MEDIA_PLAYER_STATE_PLAYING>;
|
58
|
+
using PauseTrigger = MediaPlayerStateTrigger<MediaPlayerState::MEDIA_PLAYER_STATE_PAUSED>;
|
59
|
+
using AnnouncementTrigger = MediaPlayerStateTrigger<MediaPlayerState::MEDIA_PLAYER_STATE_ANNOUNCING>;
|
56
60
|
|
57
61
|
template<typename... Ts> class IsIdleCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
58
62
|
public:
|
@@ -1,39 +1,34 @@
|
|
1
|
-
import logging
|
2
|
-
|
3
|
-
import json
|
4
1
|
import hashlib
|
5
|
-
|
2
|
+
import json
|
3
|
+
import logging
|
6
4
|
from pathlib import Path
|
5
|
+
from urllib.parse import urljoin
|
6
|
+
|
7
7
|
import requests
|
8
8
|
|
9
|
-
|
9
|
+
from esphome import automation, external_files, git
|
10
|
+
from esphome.automation import register_action, register_condition
|
10
11
|
import esphome.codegen as cg
|
11
|
-
|
12
|
-
from esphome.core import CORE, HexInt
|
13
|
-
|
14
12
|
from esphome.components import esp32, microphone
|
15
|
-
|
16
|
-
from esphome.automation import register_action, register_condition
|
17
|
-
|
18
|
-
|
13
|
+
import esphome.config_validation as cv
|
19
14
|
from esphome.const import (
|
20
|
-
|
15
|
+
CONF_FILE,
|
21
16
|
CONF_ID,
|
22
17
|
CONF_MICROPHONE,
|
23
18
|
CONF_MODEL,
|
24
|
-
|
25
|
-
CONF_FILE,
|
19
|
+
CONF_PASSWORD,
|
26
20
|
CONF_PATH,
|
21
|
+
CONF_RAW_DATA_ID,
|
27
22
|
CONF_REF,
|
28
23
|
CONF_REFRESH,
|
29
24
|
CONF_TYPE,
|
25
|
+
CONF_URL,
|
30
26
|
CONF_USERNAME,
|
31
|
-
CONF_PASSWORD,
|
32
|
-
CONF_RAW_DATA_ID,
|
33
27
|
TYPE_GIT,
|
34
28
|
TYPE_LOCAL,
|
29
|
+
__version__,
|
35
30
|
)
|
36
|
-
|
31
|
+
from esphome.core import CORE, HexInt
|
37
32
|
|
38
33
|
_LOGGER = logging.getLogger(__name__)
|
39
34
|
|
@@ -174,12 +169,12 @@ def _convert_manifest_v1_to_v2(v1_manifest):
|
|
174
169
|
CONF_SLIDING_WINDOW_AVERAGE_SIZE
|
175
170
|
]
|
176
171
|
del v2_manifest[KEY_MICRO][CONF_SLIDING_WINDOW_AVERAGE_SIZE]
|
177
|
-
|
178
|
-
|
179
|
-
] = 45672
|
180
|
-
|
181
|
-
|
182
|
-
] = 20
|
172
|
+
|
173
|
+
# Original Inception-based V1 manifest models require a minimum of 45672 bytes
|
174
|
+
v2_manifest[KEY_MICRO][CONF_TENSOR_ARENA_SIZE] = 45672
|
175
|
+
|
176
|
+
# Original Inception-based V1 manifest models use a 20 ms feature step size
|
177
|
+
v2_manifest[KEY_MICRO][CONF_FEATURE_STEP_SIZE] = 20
|
183
178
|
|
184
179
|
return v2_manifest
|
185
180
|
|
@@ -502,7 +497,7 @@ async def to_code(config):
|
|
502
497
|
)
|
503
498
|
|
504
499
|
cg.add(var.set_features_step_size(manifest[KEY_MICRO][CONF_FEATURE_STEP_SIZE]))
|
505
|
-
cg.add_library("kahrendt/ESPMicroSpeechFeatures", "1.
|
500
|
+
cg.add_library("kahrendt/ESPMicroSpeechFeatures", "1.1.0")
|
506
501
|
|
507
502
|
|
508
503
|
MICRO_WAKE_WORD_ACTION_SCHEMA = cv.Schema({cv.GenerateID(): cv.use_id(MicroWakeWord)})
|
@@ -148,7 +148,7 @@ WakeWordModel::WakeWordModel(const uint8_t *model_start, float probability_cutof
|
|
148
148
|
};
|
149
149
|
|
150
150
|
bool WakeWordModel::determine_detected() {
|
151
|
-
|
151
|
+
uint32_t sum = 0;
|
152
152
|
for (auto &prob : this->recent_streaming_probabilities_) {
|
153
153
|
sum += prob;
|
154
154
|
}
|
@@ -175,12 +175,14 @@ VADModel::VADModel(const uint8_t *model_start, float probability_cutoff, size_t
|
|
175
175
|
};
|
176
176
|
|
177
177
|
bool VADModel::determine_detected() {
|
178
|
-
|
178
|
+
uint32_t sum = 0;
|
179
179
|
for (auto &prob : this->recent_streaming_probabilities_) {
|
180
|
-
|
180
|
+
sum += prob;
|
181
181
|
}
|
182
182
|
|
183
|
-
|
183
|
+
float sliding_window_average = static_cast<float>(sum) / static_cast<float>(255 * this->sliding_window_size_);
|
184
|
+
|
185
|
+
return sliding_window_average > this->probability_cutoff_;
|
184
186
|
}
|
185
187
|
|
186
188
|
} // namespace micro_wake_word
|
@@ -110,7 +110,7 @@ void MitsubishiClimate::transmit_state() {
|
|
110
110
|
// Byte 15: HVAC specfic, i.e. POWERFUL, SMART SET, PLASMA, always 0x00
|
111
111
|
// Byte 16: Constant 0x00
|
112
112
|
// Byte 17: Checksum: SUM[Byte0...Byte16]
|
113
|
-
uint8_t remote_state[18] = {0x23, 0xCB, 0x26, 0x01, 0x00, 0x20,
|
113
|
+
uint8_t remote_state[18] = {0x23, 0xCB, 0x26, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00,
|
114
114
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
115
115
|
|
116
116
|
switch (this->mode) {
|
@@ -136,6 +136,12 @@ void MitsubishiClimate::transmit_state() {
|
|
136
136
|
break;
|
137
137
|
case climate::CLIMATE_MODE_OFF:
|
138
138
|
default:
|
139
|
+
remote_state[6] = MITSUBISHI_MODE_COOL;
|
140
|
+
remote_state[8] = MITSUBISHI_MODE_A_COOL;
|
141
|
+
if (this->supports_heat_) {
|
142
|
+
remote_state[6] = MITSUBISHI_MODE_HEAT;
|
143
|
+
remote_state[8] = MITSUBISHI_MODE_A_HEAT;
|
144
|
+
}
|
139
145
|
remote_state[5] = MITSUBISHI_OFF;
|
140
146
|
break;
|
141
147
|
}
|