esphome 2024.12.4__py3-none-any.whl → 2025.2.0b2__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 +16 -3
- esphome/components/adc/__init__.py +17 -11
- esphome/components/adc/adc_sensor.h +17 -0
- esphome/components/adc/adc_sensor_common.cpp +55 -0
- esphome/components/adc/adc_sensor_esp32.cpp +8 -5
- esphome/components/adc/adc_sensor_esp8266.cpp +10 -6
- esphome/components/adc/adc_sensor_libretiny.cpp +11 -6
- esphome/components/adc/adc_sensor_rp2040.cpp +13 -10
- esphome/components/adc/sensor.py +9 -3
- esphome/components/ads1115/ads1115.cpp +56 -7
- esphome/components/ads1115/ads1115.h +13 -1
- esphome/components/ads1115/sensor/__init__.py +16 -0
- esphome/components/ads1115/sensor/ads1115_sensor.cpp +2 -1
- esphome/components/ads1115/sensor/ads1115_sensor.h +2 -0
- esphome/components/animation/__init__.py +23 -261
- esphome/components/animation/animation.cpp +2 -2
- esphome/components/animation/animation.h +2 -1
- esphome/components/api/api_pb2.cpp +14 -0
- esphome/components/api/api_pb2.h +1 -0
- esphome/components/audio/__init__.py +112 -0
- esphome/components/audio/audio.cpp +67 -0
- esphome/components/audio/audio.h +125 -7
- esphome/components/audio/audio_decoder.cpp +361 -0
- esphome/components/audio/audio_decoder.h +135 -0
- esphome/components/audio/audio_reader.cpp +308 -0
- esphome/components/audio/audio_reader.h +85 -0
- esphome/components/audio/audio_resampler.cpp +159 -0
- esphome/components/audio/audio_resampler.h +101 -0
- esphome/components/audio/audio_transfer_buffer.cpp +165 -0
- esphome/components/audio/audio_transfer_buffer.h +139 -0
- esphome/components/audio_adc/__init__.py +41 -0
- esphome/components/audio_adc/audio_adc.h +17 -0
- esphome/components/audio_adc/automation.h +23 -0
- esphome/components/bk72xx/__init__.py +1 -0
- esphome/components/ble_client/ble_client.cpp +1 -2
- esphome/components/ble_client/sensor/__init__.py +1 -1
- esphome/components/ble_client/text_sensor/__init__.py +1 -1
- esphome/components/bluetooth_proxy/bluetooth_connection.cpp +5 -0
- esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -0
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
- esphome/components/ch422g/ch422g.h +2 -0
- esphome/components/climate/__init__.py +1 -1
- esphome/components/climate_ir/climate_ir.cpp +2 -1
- esphome/components/coolix/coolix.cpp +2 -1
- esphome/components/cse7766/cse7766.cpp +8 -16
- esphome/components/custom/__init__.py +0 -3
- esphome/components/custom/binary_sensor/__init__.py +2 -28
- esphome/components/custom/climate/__init__.py +2 -27
- esphome/components/custom/cover/__init__.py +2 -27
- esphome/components/custom/light/__init__.py +2 -27
- esphome/components/custom/output/__init__.py +2 -58
- esphome/components/custom/sensor/__init__.py +2 -24
- esphome/components/custom/switch/__init__.py +2 -24
- esphome/components/custom/text_sensor/__init__.py +2 -29
- esphome/components/custom_component/__init__.py +3 -27
- esphome/components/daly_bms/daly_bms.cpp +6 -0
- esphome/components/daly_bms/daly_bms.h +2 -0
- esphome/components/daly_bms/sensor.py +6 -0
- esphome/components/debug/debug_component.cpp +4 -0
- esphome/components/debug/debug_component.h +14 -0
- esphome/components/debug/debug_esp32.cpp +154 -74
- esphome/components/dfplayer/dfplayer.cpp +15 -2
- esphome/components/dfrobot_sen0395/dfrobot_sen0395.cpp +2 -1
- esphome/components/dht/dht.cpp +2 -1
- esphome/components/display/__init__.py +18 -5
- esphome/components/display/display.cpp +2 -1
- esphome/components/display/rect.cpp +2 -1
- esphome/components/es7210/__init__.py +0 -0
- esphome/components/es7210/audio_adc.py +51 -0
- esphome/components/es7210/es7210.cpp +228 -0
- esphome/components/es7210/es7210.h +62 -0
- esphome/components/es7210/es7210_const.h +129 -0
- esphome/components/es7243e/__init__.py +0 -0
- esphome/components/es7243e/audio_adc.py +34 -0
- esphome/components/es7243e/es7243e.cpp +125 -0
- esphome/components/es7243e/es7243e.h +37 -0
- esphome/components/es7243e/es7243e_const.h +54 -0
- esphome/components/es8156/__init__.py +0 -0
- esphome/components/es8156/audio_dac.py +27 -0
- esphome/components/es8156/es8156.cpp +87 -0
- esphome/components/es8156/es8156.h +51 -0
- esphome/components/es8156/es8156_const.h +68 -0
- esphome/components/es8311/audio_dac.py +1 -2
- esphome/components/esp32/__init__.py +1 -0
- esphome/components/esp32/core.cpp +5 -1
- esphome/components/esp32/gpio.h +2 -0
- esphome/components/esp32_ble/__init__.py +39 -0
- esphome/components/esp32_ble/queue.h +4 -4
- esphome/components/esp32_ble_client/ble_client_base.cpp +46 -0
- esphome/components/esp32_ble_client/ble_client_base.h +2 -0
- esphome/components/esp32_ble_server/__init__.py +582 -12
- esphome/components/esp32_ble_server/ble_characteristic.cpp +48 -60
- esphome/components/esp32_ble_server/ble_characteristic.h +24 -17
- esphome/components/esp32_ble_server/ble_descriptor.cpp +21 -9
- esphome/components/esp32_ble_server/ble_descriptor.h +17 -6
- esphome/components/esp32_ble_server/ble_server.cpp +62 -67
- esphome/components/esp32_ble_server/ble_server.h +28 -32
- esphome/components/esp32_ble_server/ble_server_automations.cpp +77 -0
- esphome/components/esp32_ble_server/ble_server_automations.h +115 -0
- esphome/components/esp32_ble_server/ble_service.cpp +17 -15
- esphome/components/esp32_ble_server/ble_service.h +10 -14
- esphome/components/esp32_ble_tracker/__init__.py +6 -39
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +33 -10
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +8 -4
- esphome/components/esp32_improv/__init__.py +2 -8
- esphome/components/esp32_improv/esp32_improv_component.cpp +21 -20
- esphome/components/esp32_improv/esp32_improv_component.h +3 -4
- esphome/components/esp32_rmt/__init__.py +28 -3
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +73 -6
- esphome/components/esp32_rmt_led_strip/led_strip.h +21 -3
- esphome/components/esp32_rmt_led_strip/light.py +72 -7
- esphome/components/esp32_touch/esp32_touch.cpp +5 -0
- esphome/components/esp8266/__init__.py +1 -0
- esphome/components/esp8266/gpio.h +1 -0
- esphome/components/ethernet/__init__.py +10 -10
- esphome/components/event/event.cpp +4 -2
- esphome/components/event/event.h +2 -0
- esphome/components/event_emitter/__init__.py +5 -0
- esphome/components/event_emitter/event_emitter.cpp +14 -0
- esphome/components/event_emitter/event_emitter.h +63 -0
- esphome/components/gcja5/gcja5.cpp +2 -1
- esphome/components/graph/graph.cpp +4 -9
- esphome/components/haier/haier_base.cpp +2 -1
- esphome/components/haier/hon_climate.cpp +2 -1
- esphome/components/heatpumpir/heatpumpir.cpp +2 -1
- esphome/components/host/__init__.py +1 -0
- esphome/components/host/gpio.h +1 -0
- esphome/components/http_request/http_request.h +2 -2
- esphome/components/http_request/http_request_arduino.cpp +1 -1
- esphome/components/http_request/http_request_idf.cpp +1 -1
- esphome/components/i2c/i2c_bus_esp_idf.cpp +4 -0
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +7 -5
- esphome/components/i2s_audio/speaker/__init__.py +53 -6
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +92 -46
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -0
- esphome/components/ili9xxx/display.py +29 -11
- esphome/components/ili9xxx/ili9xxx_display.cpp +2 -5
- esphome/components/ili9xxx/ili9xxx_display.h +2 -1
- esphome/components/image/__init__.py +443 -255
- esphome/components/image/image.cpp +115 -61
- esphome/components/image/image.h +15 -24
- esphome/components/json/json_util.cpp +8 -34
- esphome/components/libretiny/__init__.py +1 -0
- esphome/components/libretiny/gpio_arduino.h +1 -0
- esphome/components/light/light_color_values.h +1 -1
- esphome/components/logger/__init__.py +43 -7
- esphome/components/logger/logger.cpp +16 -11
- esphome/components/logger/logger.h +11 -7
- esphome/components/logger/select/__init__.py +29 -0
- esphome/components/logger/select/logger_level_select.cpp +27 -0
- esphome/components/logger/select/logger_level_select.h +15 -0
- esphome/components/lvgl/__init__.py +96 -73
- esphome/components/lvgl/automation.py +39 -7
- esphome/components/lvgl/defines.py +8 -2
- esphome/components/lvgl/lvgl_esphome.cpp +8 -15
- esphome/components/lvgl/lvgl_esphome.h +20 -5
- esphome/components/lvgl/schemas.py +25 -14
- esphome/components/lvgl/trigger.py +27 -3
- esphome/components/lvgl/widgets/dropdown.py +1 -1
- esphome/components/lvgl/widgets/keyboard.py +8 -1
- esphome/components/lvgl/widgets/meter.py +2 -1
- esphome/components/lvgl/widgets/msgbox.py +1 -1
- esphome/components/lvgl/widgets/obj.py +1 -12
- esphome/components/lvgl/widgets/page.py +37 -2
- esphome/components/lvgl/widgets/tabview.py +1 -1
- esphome/components/max6956/max6956.h +2 -0
- esphome/components/mcp23016/mcp23016.h +2 -0
- esphome/components/mcp23xxx_base/mcp23xxx_base.h +2 -0
- esphome/components/mdns/__init__.py +1 -1
- esphome/components/media_player/__init__.py +37 -8
- esphome/components/media_player/automation.h +11 -2
- esphome/components/media_player/media_player.cpp +8 -0
- esphome/components/media_player/media_player.h +8 -4
- esphome/components/micronova/switch/micronova_switch.cpp +4 -2
- esphome/components/midea/ac_automations.h +3 -1
- esphome/components/midea/air_conditioner.cpp +7 -5
- esphome/components/midea/air_conditioner.h +1 -1
- esphome/components/midea/climate.py +4 -2
- esphome/components/midea/ir_transmitter.h +36 -5
- esphome/components/mixer/__init__.py +0 -0
- esphome/components/mixer/speaker/__init__.py +172 -0
- esphome/components/mixer/speaker/automation.h +19 -0
- esphome/components/mixer/speaker/mixer_speaker.cpp +624 -0
- esphome/components/mixer/speaker/mixer_speaker.h +207 -0
- esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp +7 -13
- esphome/components/mpr121/mpr121.h +2 -0
- esphome/components/mqtt/__init__.py +1 -1
- esphome/components/mqtt/mqtt_client.cpp +7 -1
- esphome/components/mqtt/mqtt_client.h +1 -1
- esphome/components/mqtt/mqtt_climate.cpp +2 -2
- esphome/components/network/ip_address.h +2 -0
- esphome/components/nextion/automation.h +17 -0
- esphome/components/nextion/display.py +42 -17
- esphome/components/nextion/nextion.cpp +4 -10
- esphome/components/nextion/nextion.h +89 -82
- esphome/components/nextion/nextion_commands.cpp +10 -10
- esphome/components/ntc/sensor.py +2 -4
- esphome/components/online_image/__init__.py +98 -46
- esphome/components/online_image/bmp_image.cpp +101 -0
- esphome/components/online_image/bmp_image.h +40 -0
- esphome/components/online_image/image_decoder.cpp +28 -2
- esphome/components/online_image/image_decoder.h +24 -15
- esphome/components/online_image/jpeg_image.cpp +90 -0
- esphome/components/online_image/jpeg_image.h +34 -0
- esphome/components/online_image/online_image.cpp +112 -53
- esphome/components/online_image/online_image.h +24 -7
- esphome/components/online_image/png_image.cpp +7 -3
- esphome/components/online_image/png_image.h +2 -1
- esphome/components/opentherm/__init__.py +73 -7
- esphome/components/opentherm/automation.h +25 -0
- esphome/components/opentherm/const.py +1 -0
- esphome/components/opentherm/generate.py +39 -6
- esphome/components/opentherm/hub.cpp +117 -79
- esphome/components/opentherm/hub.h +31 -15
- esphome/components/opentherm/opentherm.cpp +47 -23
- esphome/components/opentherm/opentherm.h +27 -6
- esphome/components/opentherm/opentherm_macros.h +11 -0
- esphome/components/opentherm/schema.py +78 -1
- esphome/components/opentherm/validate.py +7 -2
- esphome/components/pca6416a/pca6416a.h +2 -0
- esphome/components/pca9554/pca9554.h +2 -0
- esphome/components/pcf8574/pcf8574.h +2 -0
- esphome/components/preferences/__init__.py +2 -4
- esphome/components/preferences/syncer.h +10 -3
- esphome/components/prometheus/prometheus_handler.cpp +313 -0
- esphome/components/prometheus/prometheus_handler.h +48 -7
- esphome/components/psram/psram.cpp +8 -1
- esphome/components/pulse_counter/pulse_counter_sensor.cpp +14 -9
- esphome/components/pulse_counter/pulse_counter_sensor.h +4 -4
- esphome/components/pulse_meter/pulse_meter_sensor.cpp +2 -0
- esphome/components/qspi_dbi/__init__.py +3 -0
- esphome/components/qspi_dbi/display.py +74 -47
- esphome/components/qspi_dbi/models.py +245 -2
- esphome/components/qspi_dbi/qspi_dbi.cpp +9 -16
- esphome/components/qspi_dbi/qspi_dbi.h +2 -2
- esphome/components/remote_base/__init__.py +77 -25
- esphome/components/remote_base/remote_base.cpp +1 -1
- esphome/components/remote_base/remote_base.h +20 -2
- esphome/components/remote_base/toto_protocol.cpp +100 -0
- esphome/components/remote_base/toto_protocol.h +45 -0
- esphome/components/remote_receiver/__init__.py +55 -10
- esphome/components/remote_receiver/remote_receiver.h +36 -3
- esphome/components/remote_receiver/remote_receiver_esp32.cpp +145 -6
- esphome/components/remote_transmitter/__init__.py +62 -4
- esphome/components/remote_transmitter/remote_transmitter.h +21 -2
- esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +140 -4
- esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +3 -3
- esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +3 -3
- esphome/components/resampler/__init__.py +0 -0
- esphome/components/resampler/speaker/__init__.py +103 -0
- esphome/components/resampler/speaker/resampler_speaker.cpp +318 -0
- esphome/components/resampler/speaker/resampler_speaker.h +107 -0
- esphome/components/resistance/resistance_sensor.h +2 -3
- esphome/components/resistance/sensor.py +2 -9
- esphome/components/rotary_encoder/rotary_encoder.cpp +8 -4
- esphome/components/rp2040/__init__.py +1 -0
- esphome/components/rp2040/gpio.h +1 -0
- esphome/components/rtl87xx/__init__.py +2 -0
- esphome/components/sdl/binary_sensor.py +270 -0
- esphome/components/sdl/sdl_esphome.cpp +16 -0
- esphome/components/sdl/sdl_esphome.h +9 -0
- esphome/components/seeed_mr60bha2/binary_sensor.py +25 -0
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +26 -2
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +9 -20
- esphome/components/seeed_mr60bha2/sensor.py +9 -1
- esphome/components/sn74hc165/sn74hc165.h +3 -0
- esphome/components/sn74hc595/sn74hc595.h +3 -0
- esphome/components/speaker/__init__.py +5 -4
- esphome/components/speaker/media_player/__init__.py +458 -0
- esphome/components/speaker/media_player/audio_pipeline.cpp +568 -0
- esphome/components/speaker/media_player/audio_pipeline.h +159 -0
- esphome/components/speaker/media_player/automation.h +26 -0
- esphome/components/speaker/media_player/speaker_media_player.cpp +577 -0
- esphome/components/speaker/media_player/speaker_media_player.h +160 -0
- esphome/components/speaker/speaker.h +20 -0
- esphome/components/spi/__init__.py +1 -5
- esphome/components/spi/spi.cpp +7 -1
- esphome/components/spi/spi.h +21 -2
- esphome/components/spi_led_strip/light.py +3 -5
- esphome/components/spi_led_strip/spi_led_strip.cpp +67 -0
- esphome/components/spi_led_strip/spi_led_strip.h +8 -60
- esphome/components/sprinkler/sprinkler.cpp +3 -1
- esphome/components/sx1509/sx1509_gpio_pin.h +2 -0
- esphome/components/tca9555/tca9555.h +2 -0
- esphome/components/toshiba/toshiba.cpp +2 -1
- esphome/components/tuya/light/tuya_light.cpp +4 -2
- esphome/components/uart/uart_component_esp32_arduino.cpp +2 -2
- esphome/components/uart/uart_component_esp_idf.cpp +2 -2
- esphome/components/udp/__init__.py +8 -2
- esphome/components/udp/udp_component.cpp +25 -56
- esphome/components/udp/udp_component.h +3 -0
- esphome/components/uponor_smatrix/sensor/__init__.py +14 -4
- esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.cpp +5 -0
- esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.h +1 -0
- esphome/components/uptime/text_sensor/__init__.py +19 -0
- esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +63 -0
- esphome/components/uptime/text_sensor/uptime_text_sensor.h +25 -0
- esphome/components/voice_assistant/voice_assistant.cpp +24 -14
- esphome/components/voice_assistant/voice_assistant.h +8 -0
- esphome/components/waveshare_epaper/display.py +22 -1
- esphome/components/waveshare_epaper/waveshare_213v3.cpp +9 -3
- esphome/components/waveshare_epaper/waveshare_epaper.cpp +1155 -44
- esphome/components/waveshare_epaper/waveshare_epaper.h +208 -7
- esphome/components/web_server/web_server.cpp +28 -6
- esphome/components/weikai/weikai.h +2 -0
- esphome/components/wifi/__init__.py +6 -6
- esphome/components/wifi/wifi_component.cpp +1 -1
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +30 -1
- esphome/components/wireguard/__init__.py +2 -2
- esphome/components/xl9535/xl9535.h +2 -0
- esphome/components/xxtea/__init__.py +3 -0
- esphome/components/xxtea/xxtea.cpp +46 -0
- esphome/components/xxtea/xxtea.h +26 -0
- esphome/components/yashima/yashima.cpp +2 -1
- esphome/config.py +9 -5
- esphome/config_validation.py +55 -17
- esphome/const.py +7 -10
- esphome/core/__init__.py +6 -13
- esphome/core/base_automation.h +1 -0
- esphome/core/config.py +59 -72
- esphome/core/defines.h +9 -1
- esphome/core/gpio.h +7 -0
- esphome/core/helpers.cpp +19 -15
- esphome/core/helpers.h +57 -8
- esphome/core/log.h +9 -7
- esphome/cpp_generator.py +2 -2
- esphome/espota2.py +3 -2
- esphome/loader.py +12 -4
- esphome/log.py +5 -7
- esphome/yaml_util.py +2 -2
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/METADATA +12 -7
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/RECORD +341 -292
- esphome/components/custom/binary_sensor/custom_binary_sensor.cpp +0 -16
- esphome/components/custom/binary_sensor/custom_binary_sensor.h +0 -26
- esphome/components/custom/climate/custom_climate.h +0 -22
- esphome/components/custom/cover/custom_cover.h +0 -21
- esphome/components/custom/light/custom_light_output.h +0 -24
- esphome/components/custom/output/custom_output.h +0 -37
- esphome/components/custom/sensor/custom_sensor.cpp +0 -16
- esphome/components/custom/sensor/custom_sensor.h +0 -24
- esphome/components/custom/switch/custom_switch.cpp +0 -16
- esphome/components/custom/switch/custom_switch.h +0 -24
- esphome/components/custom/text_sensor/custom_text_sensor.cpp +0 -16
- esphome/components/custom/text_sensor/custom_text_sensor.h +0 -26
- esphome/components/custom_component/custom_component.h +0 -28
- esphome/components/esp32_ble_server/ble_2901.cpp +0 -18
- esphome/components/esp32_ble_server/ble_2901.h +0 -19
- esphome/components/resistance_sampler/__init__.py +0 -6
- esphome/components/resistance_sampler/resistance_sampler.h +0 -10
- esphome/components/uptime/{sensor.py → sensor/__init__.py} +3 -3
- /esphome/components/uptime/{uptime_seconds_sensor.cpp → sensor/uptime_seconds_sensor.cpp} +0 -0
- /esphome/components/uptime/{uptime_seconds_sensor.h → sensor/uptime_seconds_sensor.h} +0 -0
- /esphome/components/uptime/{uptime_timestamp_sensor.cpp → sensor/uptime_timestamp_sensor.cpp} +0 -0
- /esphome/components/uptime/{uptime_timestamp_sensor.h → sensor/uptime_timestamp_sensor.h} +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/LICENSE +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/WHEEL +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/entry_points.txt +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,165 @@
|
|
1
|
+
#include "audio_transfer_buffer.h"
|
2
|
+
|
3
|
+
#ifdef USE_ESP32
|
4
|
+
|
5
|
+
#include "esphome/core/helpers.h"
|
6
|
+
|
7
|
+
namespace esphome {
|
8
|
+
namespace audio {
|
9
|
+
|
10
|
+
AudioTransferBuffer::~AudioTransferBuffer() { this->deallocate_buffer_(); };
|
11
|
+
|
12
|
+
std::unique_ptr<AudioSinkTransferBuffer> AudioSinkTransferBuffer::create(size_t buffer_size) {
|
13
|
+
std::unique_ptr<AudioSinkTransferBuffer> sink_buffer = make_unique<AudioSinkTransferBuffer>();
|
14
|
+
|
15
|
+
if (!sink_buffer->allocate_buffer_(buffer_size)) {
|
16
|
+
return nullptr;
|
17
|
+
}
|
18
|
+
|
19
|
+
return sink_buffer;
|
20
|
+
}
|
21
|
+
|
22
|
+
std::unique_ptr<AudioSourceTransferBuffer> AudioSourceTransferBuffer::create(size_t buffer_size) {
|
23
|
+
std::unique_ptr<AudioSourceTransferBuffer> source_buffer = make_unique<AudioSourceTransferBuffer>();
|
24
|
+
|
25
|
+
if (!source_buffer->allocate_buffer_(buffer_size)) {
|
26
|
+
return nullptr;
|
27
|
+
}
|
28
|
+
|
29
|
+
return source_buffer;
|
30
|
+
}
|
31
|
+
|
32
|
+
size_t AudioTransferBuffer::free() const {
|
33
|
+
if (this->buffer_size_ == 0) {
|
34
|
+
return 0;
|
35
|
+
}
|
36
|
+
return this->buffer_size_ - (this->buffer_length_ - (this->data_start_ - this->buffer_));
|
37
|
+
}
|
38
|
+
|
39
|
+
void AudioTransferBuffer::decrease_buffer_length(size_t bytes) {
|
40
|
+
this->buffer_length_ -= bytes;
|
41
|
+
this->data_start_ += bytes;
|
42
|
+
}
|
43
|
+
|
44
|
+
void AudioTransferBuffer::increase_buffer_length(size_t bytes) { this->buffer_length_ += bytes; }
|
45
|
+
|
46
|
+
void AudioTransferBuffer::clear_buffered_data() {
|
47
|
+
this->buffer_length_ = 0;
|
48
|
+
if (this->ring_buffer_.use_count() > 0) {
|
49
|
+
this->ring_buffer_->reset();
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
void AudioSinkTransferBuffer::clear_buffered_data() {
|
54
|
+
this->buffer_length_ = 0;
|
55
|
+
if (this->ring_buffer_.use_count() > 0) {
|
56
|
+
this->ring_buffer_->reset();
|
57
|
+
}
|
58
|
+
#ifdef USE_SPEAKER
|
59
|
+
if (this->speaker_ != nullptr) {
|
60
|
+
this->speaker_->stop();
|
61
|
+
}
|
62
|
+
#endif
|
63
|
+
}
|
64
|
+
|
65
|
+
bool AudioTransferBuffer::has_buffered_data() const {
|
66
|
+
if (this->ring_buffer_.use_count() > 0) {
|
67
|
+
return ((this->ring_buffer_->available() > 0) || (this->available() > 0));
|
68
|
+
}
|
69
|
+
return (this->available() > 0);
|
70
|
+
}
|
71
|
+
|
72
|
+
bool AudioTransferBuffer::reallocate(size_t new_buffer_size) {
|
73
|
+
if (this->buffer_length_ > 0) {
|
74
|
+
// Already has data in the buffer, fail
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
this->deallocate_buffer_();
|
78
|
+
return this->allocate_buffer_(new_buffer_size);
|
79
|
+
}
|
80
|
+
|
81
|
+
bool AudioTransferBuffer::allocate_buffer_(size_t buffer_size) {
|
82
|
+
this->buffer_size_ = buffer_size;
|
83
|
+
|
84
|
+
RAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
|
85
|
+
|
86
|
+
this->buffer_ = allocator.allocate(this->buffer_size_);
|
87
|
+
if (this->buffer_ == nullptr) {
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
|
91
|
+
this->data_start_ = this->buffer_;
|
92
|
+
this->buffer_length_ = 0;
|
93
|
+
|
94
|
+
return true;
|
95
|
+
}
|
96
|
+
|
97
|
+
void AudioTransferBuffer::deallocate_buffer_() {
|
98
|
+
if (this->buffer_ != nullptr) {
|
99
|
+
RAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
|
100
|
+
allocator.deallocate(this->buffer_, this->buffer_size_);
|
101
|
+
this->buffer_ = nullptr;
|
102
|
+
this->data_start_ = nullptr;
|
103
|
+
}
|
104
|
+
|
105
|
+
this->buffer_size_ = 0;
|
106
|
+
this->buffer_length_ = 0;
|
107
|
+
}
|
108
|
+
|
109
|
+
size_t AudioSourceTransferBuffer::transfer_data_from_source(TickType_t ticks_to_wait) {
|
110
|
+
// Shift data in buffer to start
|
111
|
+
if (this->buffer_length_ > 0) {
|
112
|
+
memmove(this->buffer_, this->data_start_, this->buffer_length_);
|
113
|
+
}
|
114
|
+
this->data_start_ = this->buffer_;
|
115
|
+
|
116
|
+
size_t bytes_to_read = this->free();
|
117
|
+
size_t bytes_read = 0;
|
118
|
+
if (bytes_to_read > 0) {
|
119
|
+
if (this->ring_buffer_.use_count() > 0) {
|
120
|
+
bytes_read = this->ring_buffer_->read((void *) this->get_buffer_end(), bytes_to_read, ticks_to_wait);
|
121
|
+
}
|
122
|
+
|
123
|
+
this->increase_buffer_length(bytes_read);
|
124
|
+
}
|
125
|
+
return bytes_read;
|
126
|
+
}
|
127
|
+
|
128
|
+
size_t AudioSinkTransferBuffer::transfer_data_to_sink(TickType_t ticks_to_wait) {
|
129
|
+
size_t bytes_written = 0;
|
130
|
+
if (this->available()) {
|
131
|
+
#ifdef USE_SPEAKER
|
132
|
+
if (this->speaker_ != nullptr) {
|
133
|
+
bytes_written = this->speaker_->play(this->data_start_, this->available(), ticks_to_wait);
|
134
|
+
} else
|
135
|
+
#endif
|
136
|
+
if (this->ring_buffer_.use_count() > 0) {
|
137
|
+
bytes_written =
|
138
|
+
this->ring_buffer_->write_without_replacement((void *) this->data_start_, this->available(), ticks_to_wait);
|
139
|
+
}
|
140
|
+
|
141
|
+
this->decrease_buffer_length(bytes_written);
|
142
|
+
|
143
|
+
// Shift unwritten data to the start of the buffer
|
144
|
+
memmove(this->buffer_, this->data_start_, this->buffer_length_);
|
145
|
+
this->data_start_ = this->buffer_;
|
146
|
+
}
|
147
|
+
return bytes_written;
|
148
|
+
}
|
149
|
+
|
150
|
+
bool AudioSinkTransferBuffer::has_buffered_data() const {
|
151
|
+
#ifdef USE_SPEAKER
|
152
|
+
if (this->speaker_ != nullptr) {
|
153
|
+
return (this->speaker_->has_buffered_data() || (this->available() > 0));
|
154
|
+
}
|
155
|
+
#endif
|
156
|
+
if (this->ring_buffer_.use_count() > 0) {
|
157
|
+
return ((this->ring_buffer_->available() > 0) || (this->available() > 0));
|
158
|
+
}
|
159
|
+
return (this->available() > 0);
|
160
|
+
}
|
161
|
+
|
162
|
+
} // namespace audio
|
163
|
+
} // namespace esphome
|
164
|
+
|
165
|
+
#endif
|
@@ -0,0 +1,139 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#ifdef USE_ESP32
|
4
|
+
#include "esphome/core/defines.h"
|
5
|
+
#include "esphome/core/ring_buffer.h"
|
6
|
+
|
7
|
+
#ifdef USE_SPEAKER
|
8
|
+
#include "esphome/components/speaker/speaker.h"
|
9
|
+
#endif
|
10
|
+
|
11
|
+
#include "esp_err.h"
|
12
|
+
|
13
|
+
#include <freertos/FreeRTOS.h>
|
14
|
+
|
15
|
+
namespace esphome {
|
16
|
+
namespace audio {
|
17
|
+
|
18
|
+
class AudioTransferBuffer {
|
19
|
+
/*
|
20
|
+
* @brief Class that facilitates tranferring data between a buffer and an audio source or sink.
|
21
|
+
* The transfer buffer is a typical C array that temporarily holds data for processing in other audio components.
|
22
|
+
* Both sink and source transfer buffers can use a ring buffer as the sink/source.
|
23
|
+
* - The ring buffer is stored in a shared_ptr, so destroying the transfer buffer object will release ownership.
|
24
|
+
*/
|
25
|
+
public:
|
26
|
+
/// @brief Destructor that deallocates the transfer buffer
|
27
|
+
~AudioTransferBuffer();
|
28
|
+
|
29
|
+
/// @brief Returns a pointer to the start of the transfer buffer where available() bytes of exisiting data can be read
|
30
|
+
uint8_t *get_buffer_start() const { return this->data_start_; }
|
31
|
+
|
32
|
+
/// @brief Returns a pointer to the end of the transfer buffer where free() bytes of new data can be written
|
33
|
+
uint8_t *get_buffer_end() const { return this->data_start_ + this->buffer_length_; }
|
34
|
+
|
35
|
+
/// @brief Updates the internal state of the transfer buffer. This should be called after reading data
|
36
|
+
/// @param bytes The number of bytes consumed/read
|
37
|
+
void decrease_buffer_length(size_t bytes);
|
38
|
+
|
39
|
+
/// @brief Updates the internal state of the transfer buffer. This should be called after writing data
|
40
|
+
/// @param bytes The number of bytes written
|
41
|
+
void increase_buffer_length(size_t bytes);
|
42
|
+
|
43
|
+
/// @brief Returns the transfer buffer's currently available bytes to read
|
44
|
+
size_t available() const { return this->buffer_length_; }
|
45
|
+
|
46
|
+
/// @brief Returns the transfer buffers allocated bytes
|
47
|
+
size_t capacity() const { return this->buffer_size_; }
|
48
|
+
|
49
|
+
/// @brief Returns the transfer buffer's currrently free bytes available to write
|
50
|
+
size_t free() const;
|
51
|
+
|
52
|
+
/// @brief Clears data in the transfer buffer and, if possible, the source/sink.
|
53
|
+
virtual void clear_buffered_data();
|
54
|
+
|
55
|
+
/// @brief Tests if there is any data in the tranfer buffer or the source/sink.
|
56
|
+
/// @return True if there is data, false otherwise.
|
57
|
+
virtual bool has_buffered_data() const;
|
58
|
+
|
59
|
+
bool reallocate(size_t new_buffer_size);
|
60
|
+
|
61
|
+
protected:
|
62
|
+
/// @brief Allocates the transfer buffer in external memory, if available.
|
63
|
+
/// @return True is successful, false otherwise.
|
64
|
+
bool allocate_buffer_(size_t buffer_size);
|
65
|
+
|
66
|
+
/// @brief Deallocates the buffer and resets the class variables.
|
67
|
+
void deallocate_buffer_();
|
68
|
+
|
69
|
+
// A possible source or sink for the transfer buffer
|
70
|
+
std::shared_ptr<RingBuffer> ring_buffer_;
|
71
|
+
|
72
|
+
uint8_t *buffer_{nullptr};
|
73
|
+
uint8_t *data_start_{nullptr};
|
74
|
+
|
75
|
+
size_t buffer_size_{0};
|
76
|
+
size_t buffer_length_{0};
|
77
|
+
};
|
78
|
+
|
79
|
+
class AudioSinkTransferBuffer : public AudioTransferBuffer {
|
80
|
+
/*
|
81
|
+
* @brief A class that implements a transfer buffer for audio sinks.
|
82
|
+
* Supports writing processed data in the transfer buffer to a ring buffer or a speaker component.
|
83
|
+
*/
|
84
|
+
public:
|
85
|
+
/// @brief Creates a new sink transfer buffer.
|
86
|
+
/// @param buffer_size Size of the transfer buffer in bytes.
|
87
|
+
/// @return unique_ptr if successfully allocated, nullptr otherwise
|
88
|
+
static std::unique_ptr<AudioSinkTransferBuffer> create(size_t buffer_size);
|
89
|
+
|
90
|
+
/// @brief Writes any available data in the transfer buffer to the sink.
|
91
|
+
/// @param ticks_to_wait FreeRTOS ticks to block while waiting for the sink to have enough space
|
92
|
+
/// @return Number of bytes written
|
93
|
+
size_t transfer_data_to_sink(TickType_t ticks_to_wait);
|
94
|
+
|
95
|
+
/// @brief Adds a ring buffer as the transfer buffer's sink.
|
96
|
+
/// @param ring_buffer weak_ptr to the allocated ring buffer
|
97
|
+
void set_sink(const std::weak_ptr<RingBuffer> &ring_buffer) { this->ring_buffer_ = ring_buffer.lock(); }
|
98
|
+
|
99
|
+
#ifdef USE_SPEAKER
|
100
|
+
/// @brief Adds a speaker as the transfer buffer's sink.
|
101
|
+
/// @param speaker Pointer to the speaker component
|
102
|
+
void set_sink(speaker::Speaker *speaker) { this->speaker_ = speaker; }
|
103
|
+
#endif
|
104
|
+
|
105
|
+
void clear_buffered_data() override;
|
106
|
+
|
107
|
+
bool has_buffered_data() const override;
|
108
|
+
|
109
|
+
protected:
|
110
|
+
#ifdef USE_SPEAKER
|
111
|
+
speaker::Speaker *speaker_{nullptr};
|
112
|
+
#endif
|
113
|
+
};
|
114
|
+
|
115
|
+
class AudioSourceTransferBuffer : public AudioTransferBuffer {
|
116
|
+
/*
|
117
|
+
* @brief A class that implements a transfer buffer for audio sources.
|
118
|
+
* Supports reading audio data from a ring buffer into the transfer buffer for processing.
|
119
|
+
*/
|
120
|
+
public:
|
121
|
+
/// @brief Creates a new source transfer buffer.
|
122
|
+
/// @param buffer_size Size of the transfer buffer in bytes.
|
123
|
+
/// @return unique_ptr if successfully allocated, nullptr otherwise
|
124
|
+
static std::unique_ptr<AudioSourceTransferBuffer> create(size_t buffer_size);
|
125
|
+
|
126
|
+
/// @brief Reads any available data from the sink into the transfer buffer.
|
127
|
+
/// @param ticks_to_wait FreeRTOS ticks to block while waiting for the source to have enough data
|
128
|
+
/// @return Number of bytes read
|
129
|
+
size_t transfer_data_from_source(TickType_t ticks_to_wait);
|
130
|
+
|
131
|
+
/// @brief Adds a ring buffer as the transfer buffer's source.
|
132
|
+
/// @param ring_buffer weak_ptr to the allocated ring buffer
|
133
|
+
void set_source(const std::weak_ptr<RingBuffer> &ring_buffer) { this->ring_buffer_ = ring_buffer.lock(); };
|
134
|
+
};
|
135
|
+
|
136
|
+
} // namespace audio
|
137
|
+
} // namespace esphome
|
138
|
+
|
139
|
+
#endif
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from esphome import automation
|
2
|
+
import esphome.codegen as cg
|
3
|
+
import esphome.config_validation as cv
|
4
|
+
from esphome.const import CONF_ID, CONF_MIC_GAIN
|
5
|
+
from esphome.core import coroutine_with_priority
|
6
|
+
|
7
|
+
CODEOWNERS = ["@kbx81"]
|
8
|
+
IS_PLATFORM_COMPONENT = True
|
9
|
+
|
10
|
+
audio_adc_ns = cg.esphome_ns.namespace("audio_adc")
|
11
|
+
AudioAdc = audio_adc_ns.class_("AudioAdc")
|
12
|
+
|
13
|
+
SetMicGainAction = audio_adc_ns.class_("SetMicGainAction", automation.Action)
|
14
|
+
|
15
|
+
|
16
|
+
SET_MIC_GAIN_ACTION_SCHEMA = cv.maybe_simple_value(
|
17
|
+
{
|
18
|
+
cv.GenerateID(): cv.use_id(AudioAdc),
|
19
|
+
cv.Required(CONF_MIC_GAIN): cv.templatable(cv.decibel),
|
20
|
+
},
|
21
|
+
key=CONF_MIC_GAIN,
|
22
|
+
)
|
23
|
+
|
24
|
+
|
25
|
+
@automation.register_action(
|
26
|
+
"audio_adc.set_mic_gain", SetMicGainAction, SET_MIC_GAIN_ACTION_SCHEMA
|
27
|
+
)
|
28
|
+
async def audio_adc_set_mic_gain_to_code(config, action_id, template_arg, args):
|
29
|
+
paren = await cg.get_variable(config[CONF_ID])
|
30
|
+
var = cg.new_Pvariable(action_id, template_arg, paren)
|
31
|
+
|
32
|
+
template_ = await cg.templatable(config.get(CONF_MIC_GAIN), args, float)
|
33
|
+
cg.add(var.set_mic_gain(template_))
|
34
|
+
|
35
|
+
return var
|
36
|
+
|
37
|
+
|
38
|
+
@coroutine_with_priority(100.0)
|
39
|
+
async def to_code(config):
|
40
|
+
cg.add_define("USE_AUDIO_ADC")
|
41
|
+
cg.add_global(audio_adc_ns.using)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/core/defines.h"
|
4
|
+
#include "esphome/core/hal.h"
|
5
|
+
|
6
|
+
namespace esphome {
|
7
|
+
namespace audio_adc {
|
8
|
+
|
9
|
+
class AudioAdc {
|
10
|
+
public:
|
11
|
+
virtual bool set_mic_gain(float mic_gain) = 0;
|
12
|
+
|
13
|
+
virtual float mic_gain() = 0;
|
14
|
+
};
|
15
|
+
|
16
|
+
} // namespace audio_adc
|
17
|
+
} // namespace esphome
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/core/automation.h"
|
4
|
+
#include "esphome/core/component.h"
|
5
|
+
#include "audio_adc.h"
|
6
|
+
|
7
|
+
namespace esphome {
|
8
|
+
namespace audio_adc {
|
9
|
+
|
10
|
+
template<typename... Ts> class SetMicGainAction : public Action<Ts...> {
|
11
|
+
public:
|
12
|
+
explicit SetMicGainAction(AudioAdc *audio_adc) : audio_adc_(audio_adc) {}
|
13
|
+
|
14
|
+
TEMPLATABLE_VALUE(float, mic_gain)
|
15
|
+
|
16
|
+
void play(Ts... x) override { this->audio_adc_->set_mic_gain(this->mic_gain_.value(x...)); }
|
17
|
+
|
18
|
+
protected:
|
19
|
+
AudioAdc *audio_adc_;
|
20
|
+
};
|
21
|
+
|
22
|
+
} // namespace audio_adc
|
23
|
+
} // namespace esphome
|
@@ -25,8 +25,7 @@ void BLEClient::loop() {
|
|
25
25
|
|
26
26
|
void BLEClient::dump_config() {
|
27
27
|
ESP_LOGCONFIG(TAG, "BLE Client:");
|
28
|
-
|
29
|
-
ESP_LOGCONFIG(TAG, " Auto-Connect: %s", TRUEFALSE(this->auto_connect_));
|
28
|
+
BLEClientBase::dump_config();
|
30
29
|
}
|
31
30
|
|
32
31
|
bool BLEClient::parse_device(const espbt::ESPBTDevice &device) {
|
@@ -11,6 +11,7 @@ from esphome.const import (
|
|
11
11
|
DEVICE_CLASS_SIGNAL_STRENGTH,
|
12
12
|
STATE_CLASS_MEASUREMENT,
|
13
13
|
UNIT_DECIBEL_MILLIWATT,
|
14
|
+
CONF_NOTIFY,
|
14
15
|
)
|
15
16
|
|
16
17
|
from .. import ble_client_ns
|
@@ -19,7 +20,6 @@ DEPENDENCIES = ["ble_client"]
|
|
19
20
|
|
20
21
|
CONF_DESCRIPTOR_UUID = "descriptor_uuid"
|
21
22
|
|
22
|
-
CONF_NOTIFY = "notify"
|
23
23
|
CONF_ON_NOTIFY = "on_notify"
|
24
24
|
TYPE_CHARACTERISTIC = "characteristic"
|
25
25
|
TYPE_RSSI = "rssi"
|
@@ -6,6 +6,7 @@ from esphome.const import (
|
|
6
6
|
CONF_CHARACTERISTIC_UUID,
|
7
7
|
CONF_ID,
|
8
8
|
CONF_SERVICE_UUID,
|
9
|
+
CONF_NOTIFY,
|
9
10
|
CONF_TRIGGER_ID,
|
10
11
|
)
|
11
12
|
|
@@ -15,7 +16,6 @@ DEPENDENCIES = ["ble_client"]
|
|
15
16
|
|
16
17
|
CONF_DESCRIPTOR_UUID = "descriptor_uuid"
|
17
18
|
|
18
|
-
CONF_NOTIFY = "notify"
|
19
19
|
CONF_ON_NOTIFY = "on_notify"
|
20
20
|
|
21
21
|
adv_data_t = cg.std_vector.template(cg.uint8)
|
@@ -13,6 +13,11 @@ namespace bluetooth_proxy {
|
|
13
13
|
|
14
14
|
static const char *const TAG = "bluetooth_proxy.connection";
|
15
15
|
|
16
|
+
void BluetoothConnection::dump_config() {
|
17
|
+
ESP_LOGCONFIG(TAG, "BLE Connection:");
|
18
|
+
BLEClientBase::dump_config();
|
19
|
+
}
|
20
|
+
|
16
21
|
bool BluetoothConnection::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
|
17
22
|
esp_ble_gattc_cb_param_t *param) {
|
18
23
|
if (!BLEClientBase::gattc_event_handler(event, gattc_if, param))
|
@@ -11,6 +11,7 @@ class BluetoothProxy;
|
|
11
11
|
|
12
12
|
class BluetoothConnection : public esp32_ble_client::BLEClientBase {
|
13
13
|
public:
|
14
|
+
void dump_config() override;
|
14
15
|
bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
|
15
16
|
esp_ble_gattc_cb_param_t *param) override;
|
16
17
|
void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) override;
|
@@ -475,6 +475,11 @@ void BluetoothProxy::send_connections_free() {
|
|
475
475
|
api::BluetoothConnectionsFreeResponse call;
|
476
476
|
call.free = this->get_bluetooth_connections_free();
|
477
477
|
call.limit = this->get_bluetooth_connections_limit();
|
478
|
+
for (auto *connection : this->connections_) {
|
479
|
+
if (connection->address_ != 0) {
|
480
|
+
call.allocated.push_back(connection->address_);
|
481
|
+
}
|
482
|
+
}
|
478
483
|
this->api_connection_->send_bluetooth_connections_free_response(call);
|
479
484
|
}
|
480
485
|
|
@@ -57,6 +57,8 @@ class CH422GGPIOPin : public GPIOPin {
|
|
57
57
|
void set_inverted(bool inverted) { inverted_ = inverted; }
|
58
58
|
void set_flags(gpio::Flags flags);
|
59
59
|
|
60
|
+
gpio::Flags get_flags() const override { return this->flags_; }
|
61
|
+
|
60
62
|
protected:
|
61
63
|
CH422GComponent *parent_{};
|
62
64
|
uint8_t pin_{};
|
@@ -115,7 +115,7 @@ CONF_MAX_HUMIDITY = "max_humidity"
|
|
115
115
|
CONF_TARGET_HUMIDITY = "target_humidity"
|
116
116
|
|
117
117
|
visual_temperature = cv.float_with_unit(
|
118
|
-
"visual_temperature", "(°C|° C|°|C|°
|
118
|
+
"visual_temperature", "(°C|° C|°|C|°K|° K|K|°F|° F|F)?"
|
119
119
|
)
|
120
120
|
|
121
121
|
|
@@ -37,8 +37,9 @@ void ClimateIR::setup() {
|
|
37
37
|
this->publish_state();
|
38
38
|
});
|
39
39
|
this->current_temperature = this->sensor_->state;
|
40
|
-
} else
|
40
|
+
} else {
|
41
41
|
this->current_temperature = NAN;
|
42
|
+
}
|
42
43
|
// restore set points
|
43
44
|
auto restore = this->restore_state_();
|
44
45
|
if (restore.has_value()) {
|
@@ -131,8 +131,9 @@ bool CoolixClimate::on_coolix(climate::Climate *parent, remote_base::RemoteRecei
|
|
131
131
|
} else {
|
132
132
|
parent->mode = climate::CLIMATE_MODE_FAN_ONLY;
|
133
133
|
}
|
134
|
-
} else
|
134
|
+
} else {
|
135
135
|
parent->mode = climate::CLIMATE_MODE_COOL;
|
136
|
+
}
|
136
137
|
|
137
138
|
// Fan Speed
|
138
139
|
if ((remote_state & COOLIX_FAN_AUTO) == COOLIX_FAN_AUTO || parent->mode == climate::CLIMATE_MODE_HEAT_COOL ||
|
@@ -1,8 +1,5 @@
|
|
1
1
|
#include "cse7766.h"
|
2
2
|
#include "esphome/core/log.h"
|
3
|
-
#include <cinttypes>
|
4
|
-
#include <iomanip>
|
5
|
-
#include <sstream>
|
6
3
|
|
7
4
|
namespace esphome {
|
8
5
|
namespace cse7766 {
|
@@ -72,12 +69,8 @@ bool CSE7766Component::check_byte_() {
|
|
72
69
|
void CSE7766Component::parse_data_() {
|
73
70
|
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
74
71
|
{
|
75
|
-
std::
|
76
|
-
|
77
|
-
for (uint8_t i = 0; i < 23; i++) {
|
78
|
-
ss << ' ' << std::setw(2) << static_cast<unsigned>(this->raw_data_[i]);
|
79
|
-
}
|
80
|
-
ESP_LOGVV(TAG, "%s", ss.str().c_str());
|
72
|
+
std::string s = format_hex_pretty(this->raw_data_, sizeof(this->raw_data_));
|
73
|
+
ESP_LOGVV(TAG, "Raw data: %s", s.c_str());
|
81
74
|
}
|
82
75
|
#endif
|
83
76
|
|
@@ -211,21 +204,20 @@ void CSE7766Component::parse_data_() {
|
|
211
204
|
|
212
205
|
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
213
206
|
{
|
214
|
-
std::
|
215
|
-
ss << "Parsed:";
|
207
|
+
std::string buf = "Parsed:";
|
216
208
|
if (have_voltage) {
|
217
|
-
|
209
|
+
buf += str_sprintf(" V=%fV", voltage);
|
218
210
|
}
|
219
211
|
if (have_current) {
|
220
|
-
|
212
|
+
buf += str_sprintf(" I=%fmA (~%fmA)", current * 1000.0f, calculated_current * 1000.0f);
|
221
213
|
}
|
222
214
|
if (have_power) {
|
223
|
-
|
215
|
+
buf += str_sprintf(" P=%fW", power);
|
224
216
|
}
|
225
217
|
if (energy != 0.0f) {
|
226
|
-
|
218
|
+
buf += str_sprintf(" E=%fkWh (%u)", energy, cf_pulses);
|
227
219
|
}
|
228
|
-
ESP_LOGVV(TAG, "%s",
|
220
|
+
ESP_LOGVV(TAG, "%s", buf.c_str());
|
229
221
|
}
|
230
222
|
#endif
|
231
223
|
}
|
@@ -1,31 +1,5 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
1
|
import esphome.config_validation as cv
|
3
|
-
from esphome.components import binary_sensor
|
4
|
-
from esphome.const import CONF_BINARY_SENSORS, CONF_ID, CONF_LAMBDA
|
5
|
-
from .. import custom_ns
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
CONFIG_SCHEMA = cv.Schema(
|
10
|
-
{
|
11
|
-
cv.GenerateID(): cv.declare_id(CustomBinarySensorConstructor),
|
12
|
-
cv.Required(CONF_LAMBDA): cv.returning_lambda,
|
13
|
-
cv.Required(CONF_BINARY_SENSORS): cv.ensure_list(
|
14
|
-
binary_sensor.binary_sensor_schema()
|
15
|
-
),
|
16
|
-
}
|
3
|
+
CONFIG_SCHEMA = cv.invalid(
|
4
|
+
'The "custom" component has been removed. Consider conversion to an external component.\nhttps://esphome.io/guides/contributing#a-note-about-custom-components'
|
17
5
|
)
|
18
|
-
|
19
|
-
|
20
|
-
async def to_code(config):
|
21
|
-
template_ = await cg.process_lambda(
|
22
|
-
config[CONF_LAMBDA],
|
23
|
-
[],
|
24
|
-
return_type=cg.std_vector.template(binary_sensor.BinarySensorPtr),
|
25
|
-
)
|
26
|
-
|
27
|
-
rhs = CustomBinarySensorConstructor(template_)
|
28
|
-
custom = cg.variable(config[CONF_ID], rhs)
|
29
|
-
for i, conf in enumerate(config[CONF_BINARY_SENSORS]):
|
30
|
-
rhs = custom.Pget_binary_sensor(i)
|
31
|
-
await binary_sensor.register_binary_sensor(rhs, conf)
|
@@ -1,30 +1,5 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
1
|
import esphome.config_validation as cv
|
3
|
-
from esphome.components import climate
|
4
|
-
from esphome.const import CONF_ID, CONF_LAMBDA
|
5
|
-
from .. import custom_ns
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
CONFIG_SCHEMA = cv.Schema(
|
11
|
-
{
|
12
|
-
cv.GenerateID(): cv.declare_id(CustomClimateConstructor),
|
13
|
-
cv.Required(CONF_LAMBDA): cv.returning_lambda,
|
14
|
-
cv.Required(CONF_CLIMATES): cv.ensure_list(climate.CLIMATE_SCHEMA),
|
15
|
-
}
|
3
|
+
CONFIG_SCHEMA = cv.invalid(
|
4
|
+
'The "custom" component has been removed. Consider conversion to an external component.\nhttps://esphome.io/guides/contributing#a-note-about-custom-components'
|
16
5
|
)
|
17
|
-
|
18
|
-
|
19
|
-
async def to_code(config):
|
20
|
-
template_ = await cg.process_lambda(
|
21
|
-
config[CONF_LAMBDA],
|
22
|
-
[],
|
23
|
-
return_type=cg.std_vector.template(climate.Climate.operator("ptr")),
|
24
|
-
)
|
25
|
-
|
26
|
-
rhs = CustomClimateConstructor(template_)
|
27
|
-
custom = cg.variable(config[CONF_ID], rhs)
|
28
|
-
for i, conf in enumerate(config[CONF_CLIMATES]):
|
29
|
-
rhs = custom.Pget_climate(i)
|
30
|
-
await climate.register_climate(rhs, conf)
|
@@ -1,30 +1,5 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
1
|
import esphome.config_validation as cv
|
3
|
-
from esphome.components import cover
|
4
|
-
from esphome.const import CONF_ID, CONF_LAMBDA
|
5
|
-
from .. import custom_ns
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
CONFIG_SCHEMA = cv.Schema(
|
11
|
-
{
|
12
|
-
cv.GenerateID(): cv.declare_id(CustomCoverConstructor),
|
13
|
-
cv.Required(CONF_LAMBDA): cv.returning_lambda,
|
14
|
-
cv.Required(CONF_COVERS): cv.ensure_list(cover.COVER_SCHEMA),
|
15
|
-
}
|
3
|
+
CONFIG_SCHEMA = cv.invalid(
|
4
|
+
'The "custom" component has been removed. Consider conversion to an external component.\nhttps://esphome.io/guides/contributing#a-note-about-custom-components'
|
16
5
|
)
|
17
|
-
|
18
|
-
|
19
|
-
async def to_code(config):
|
20
|
-
template_ = await cg.process_lambda(
|
21
|
-
config[CONF_LAMBDA],
|
22
|
-
[],
|
23
|
-
return_type=cg.std_vector.template(cover.Cover.operator("ptr")),
|
24
|
-
)
|
25
|
-
|
26
|
-
rhs = CustomCoverConstructor(template_)
|
27
|
-
custom = cg.variable(config[CONF_ID], rhs)
|
28
|
-
for i, conf in enumerate(config[CONF_COVERS]):
|
29
|
-
rhs = custom.Pget_cover(i)
|
30
|
-
await cover.register_cover(rhs, conf)
|