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
@@ -3,14 +3,16 @@
|
|
3
3
|
|
4
4
|
#ifdef USE_ESP32
|
5
5
|
|
6
|
-
#include <nvs_flash.h>
|
7
|
-
#include <freertos/FreeRTOS.h>
|
8
|
-
#include <esp_bt_main.h>
|
9
6
|
#include <esp_bt.h>
|
10
|
-
#include <
|
7
|
+
#include <esp_bt_main.h>
|
11
8
|
#include <esp_gap_ble_api.h>
|
9
|
+
#include <freertos/FreeRTOS.h>
|
10
|
+
#include <freertos/task.h>
|
11
|
+
#include <nvs_flash.h>
|
12
12
|
#include <cstring>
|
13
|
+
|
13
14
|
#include "esphome/core/hal.h"
|
15
|
+
#include "esphome/core/helpers.h"
|
14
16
|
|
15
17
|
#ifdef USE_ARDUINO
|
16
18
|
#include <esp32-hal-bt.h>
|
@@ -21,20 +23,6 @@ namespace esp32_ble_beacon {
|
|
21
23
|
|
22
24
|
static const char *const TAG = "esp32_ble_beacon";
|
23
25
|
|
24
|
-
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
25
|
-
static esp_ble_adv_params_t ble_adv_params = {
|
26
|
-
.adv_int_min = 0x20,
|
27
|
-
.adv_int_max = 0x40,
|
28
|
-
.adv_type = ADV_TYPE_NONCONN_IND,
|
29
|
-
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
|
30
|
-
.peer_addr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
31
|
-
.peer_addr_type = BLE_ADDR_TYPE_PUBLIC,
|
32
|
-
.channel_map = ADV_CHNL_ALL,
|
33
|
-
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
|
34
|
-
};
|
35
|
-
|
36
|
-
#define ENDIAN_CHANGE_U16(x) ((((x) &0xFF00) >> 8) + (((x) &0xFF) << 8))
|
37
|
-
|
38
26
|
static const esp_ble_ibeacon_head_t IBEACON_COMMON_HEAD = {
|
39
27
|
.flags = {0x02, 0x01, 0x06}, .length = 0x1A, .type = 0xFF, .company_id = {0x4C, 0x00}, .beacon_type = {0x02, 0x15}};
|
40
28
|
|
@@ -53,117 +41,62 @@ void ESP32BLEBeacon::dump_config() {
|
|
53
41
|
" UUID: %s, Major: %u, Minor: %u, Min Interval: %ums, Max Interval: %ums, Measured Power: %d"
|
54
42
|
", TX Power: %ddBm",
|
55
43
|
uuid, this->major_, this->minor_, this->min_interval_, this->max_interval_, this->measured_power_,
|
56
|
-
this->tx_power_);
|
57
|
-
}
|
58
|
-
|
59
|
-
void ESP32BLEBeacon::setup() {
|
60
|
-
ESP_LOGCONFIG(TAG, "Setting up ESP32 BLE beacon...");
|
61
|
-
global_esp32_ble_beacon = this;
|
62
|
-
|
63
|
-
xTaskCreatePinnedToCore(ESP32BLEBeacon::ble_core_task,
|
64
|
-
"ble_task", // name
|
65
|
-
10000, // stack size (in words)
|
66
|
-
nullptr, // input params
|
67
|
-
1, // priority
|
68
|
-
nullptr, // Handle, not needed
|
69
|
-
0 // core
|
70
|
-
);
|
44
|
+
(this->tx_power_ * 3) - 12);
|
71
45
|
}
|
72
46
|
|
73
|
-
float ESP32BLEBeacon::get_setup_priority() const { return setup_priority::
|
74
|
-
void ESP32BLEBeacon::ble_core_task(void *params) {
|
75
|
-
ble_setup();
|
47
|
+
float ESP32BLEBeacon::get_setup_priority() const { return setup_priority::AFTER_BLUETOOTH; }
|
76
48
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
#ifdef USE_ARDUINO
|
94
|
-
if (!btStart()) {
|
95
|
-
ESP_LOGE(TAG, "btStart failed: %d", esp_bt_controller_get_status());
|
96
|
-
return;
|
97
|
-
}
|
98
|
-
#else
|
99
|
-
if (esp_bt_controller_get_status() != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
100
|
-
// start bt controller
|
101
|
-
if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) {
|
102
|
-
esp_bt_controller_config_t cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
103
|
-
err = esp_bt_controller_init(&cfg);
|
104
|
-
if (err != ESP_OK) {
|
105
|
-
ESP_LOGE(TAG, "esp_bt_controller_init failed: %s", esp_err_to_name(err));
|
106
|
-
return;
|
107
|
-
}
|
108
|
-
while (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE)
|
109
|
-
;
|
110
|
-
}
|
111
|
-
if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED) {
|
112
|
-
err = esp_bt_controller_enable(ESP_BT_MODE_BLE);
|
113
|
-
if (err != ESP_OK) {
|
114
|
-
ESP_LOGE(TAG, "esp_bt_controller_enable failed: %s", esp_err_to_name(err));
|
115
|
-
return;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
if (esp_bt_controller_get_status() != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
119
|
-
ESP_LOGE(TAG, "esp bt controller enable failed");
|
120
|
-
return;
|
49
|
+
void ESP32BLEBeacon::setup() {
|
50
|
+
this->ble_adv_params_ = {
|
51
|
+
.adv_int_min = static_cast<uint16_t>(this->min_interval_ / 0.625f),
|
52
|
+
.adv_int_max = static_cast<uint16_t>(this->max_interval_ / 0.625f),
|
53
|
+
.adv_type = ADV_TYPE_NONCONN_IND,
|
54
|
+
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
|
55
|
+
.peer_addr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
56
|
+
.peer_addr_type = BLE_ADDR_TYPE_PUBLIC,
|
57
|
+
.channel_map = ADV_CHNL_ALL,
|
58
|
+
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
|
59
|
+
};
|
60
|
+
|
61
|
+
global_ble->advertising_register_raw_advertisement_callback([this](bool advertise) {
|
62
|
+
this->advertising_ = advertise;
|
63
|
+
if (advertise) {
|
64
|
+
this->on_advertise_();
|
121
65
|
}
|
122
|
-
}
|
123
|
-
|
66
|
+
});
|
67
|
+
}
|
124
68
|
|
125
|
-
|
69
|
+
void ESP32BLEBeacon::on_advertise_() {
|
70
|
+
esp_ble_ibeacon_t ibeacon_adv_data;
|
71
|
+
memcpy(&ibeacon_adv_data.ibeacon_head, &IBEACON_COMMON_HEAD, sizeof(esp_ble_ibeacon_head_t));
|
72
|
+
memcpy(&ibeacon_adv_data.ibeacon_vendor.proximity_uuid, this->uuid_.data(),
|
73
|
+
sizeof(ibeacon_adv_data.ibeacon_vendor.proximity_uuid));
|
74
|
+
ibeacon_adv_data.ibeacon_vendor.minor = byteswap(this->minor_);
|
75
|
+
ibeacon_adv_data.ibeacon_vendor.major = byteswap(this->major_);
|
76
|
+
ibeacon_adv_data.ibeacon_vendor.measured_power = static_cast<uint8_t>(this->measured_power_);
|
126
77
|
|
127
|
-
|
128
|
-
|
129
|
-
ESP_LOGE(TAG, "esp_bluedroid_init failed: %d", err);
|
130
|
-
return;
|
131
|
-
}
|
132
|
-
err = esp_bluedroid_enable();
|
78
|
+
ESP_LOGD(TAG, "Setting BLE TX power");
|
79
|
+
esp_err_t err = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, this->tx_power_);
|
133
80
|
if (err != ESP_OK) {
|
134
|
-
|
135
|
-
return;
|
81
|
+
ESP_LOGW(TAG, "esp_ble_tx_power_set failed: %s", esp_err_to_name(err));
|
136
82
|
}
|
137
|
-
err =
|
138
|
-
static_cast<esp_power_level_t>((global_esp32_ble_beacon->tx_power_ + 12) / 3));
|
83
|
+
err = esp_ble_gap_config_adv_data_raw((uint8_t *) &ibeacon_adv_data, sizeof(ibeacon_adv_data));
|
139
84
|
if (err != ESP_OK) {
|
140
|
-
ESP_LOGE(TAG, "
|
85
|
+
ESP_LOGE(TAG, "esp_ble_gap_config_adv_data_raw failed: %s", esp_err_to_name(err));
|
141
86
|
return;
|
142
87
|
}
|
143
|
-
err = esp_ble_gap_register_callback(ESP32BLEBeacon::gap_event_handler);
|
144
|
-
if (err != ESP_OK) {
|
145
|
-
ESP_LOGE(TAG, "esp_ble_gap_register_callback failed: %d", err);
|
146
|
-
return;
|
147
|
-
}
|
148
|
-
|
149
|
-
esp_ble_ibeacon_t ibeacon_adv_data;
|
150
|
-
memcpy(&ibeacon_adv_data.ibeacon_head, &IBEACON_COMMON_HEAD, sizeof(esp_ble_ibeacon_head_t));
|
151
|
-
memcpy(&ibeacon_adv_data.ibeacon_vendor.proximity_uuid, global_esp32_ble_beacon->uuid_.data(),
|
152
|
-
sizeof(ibeacon_adv_data.ibeacon_vendor.proximity_uuid));
|
153
|
-
ibeacon_adv_data.ibeacon_vendor.minor = ENDIAN_CHANGE_U16(global_esp32_ble_beacon->minor_);
|
154
|
-
ibeacon_adv_data.ibeacon_vendor.major = ENDIAN_CHANGE_U16(global_esp32_ble_beacon->major_);
|
155
|
-
ibeacon_adv_data.ibeacon_vendor.measured_power = static_cast<uint8_t>(global_esp32_ble_beacon->measured_power_);
|
156
|
-
|
157
|
-
esp_ble_gap_config_adv_data_raw((uint8_t *) &ibeacon_adv_data, sizeof(ibeacon_adv_data));
|
158
88
|
}
|
159
89
|
|
160
90
|
void ESP32BLEBeacon::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) {
|
91
|
+
if (!this->advertising_)
|
92
|
+
return;
|
93
|
+
|
161
94
|
esp_err_t err;
|
162
95
|
switch (event) {
|
163
96
|
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT: {
|
164
|
-
err = esp_ble_gap_start_advertising(&
|
97
|
+
err = esp_ble_gap_start_advertising(&this->ble_adv_params_);
|
165
98
|
if (err != ESP_OK) {
|
166
|
-
ESP_LOGE(TAG, "esp_ble_gap_start_advertising failed: %
|
99
|
+
ESP_LOGE(TAG, "esp_ble_gap_start_advertising failed: %s", esp_err_to_name(err));
|
167
100
|
}
|
168
101
|
break;
|
169
102
|
}
|
@@ -181,6 +114,7 @@ void ESP32BLEBeacon::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap
|
|
181
114
|
} else {
|
182
115
|
ESP_LOGD(TAG, "BLE stopped advertising successfully");
|
183
116
|
}
|
117
|
+
// this->advertising_ = false;
|
184
118
|
break;
|
185
119
|
}
|
186
120
|
default:
|
@@ -188,8 +122,6 @@ void ESP32BLEBeacon::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap
|
|
188
122
|
}
|
189
123
|
}
|
190
124
|
|
191
|
-
ESP32BLEBeacon *global_esp32_ble_beacon = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
192
|
-
|
193
125
|
} // namespace esp32_ble_beacon
|
194
126
|
} // namespace esphome
|
195
127
|
|
@@ -1,39 +1,39 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#include "esphome/components/esp32_ble/ble.h"
|
3
4
|
#include "esphome/core/component.h"
|
4
5
|
|
5
6
|
#ifdef USE_ESP32
|
6
7
|
|
7
|
-
#include <esp_gap_ble_api.h>
|
8
8
|
#include <esp_bt.h>
|
9
|
+
#include <esp_gap_ble_api.h>
|
9
10
|
|
10
11
|
namespace esphome {
|
11
12
|
namespace esp32_ble_beacon {
|
12
13
|
|
13
|
-
|
14
|
-
typedef struct {
|
14
|
+
using esp_ble_ibeacon_head_t = struct {
|
15
15
|
uint8_t flags[3];
|
16
16
|
uint8_t length;
|
17
17
|
uint8_t type;
|
18
18
|
uint8_t company_id[2];
|
19
19
|
uint8_t beacon_type[2];
|
20
|
-
} __attribute__((packed))
|
20
|
+
} __attribute__((packed));
|
21
21
|
|
22
|
-
|
23
|
-
typedef struct {
|
22
|
+
using esp_ble_ibeacon_vendor_t = struct {
|
24
23
|
uint8_t proximity_uuid[16];
|
25
24
|
uint16_t major;
|
26
25
|
uint16_t minor;
|
27
26
|
uint8_t measured_power;
|
28
|
-
} __attribute__((packed))
|
27
|
+
} __attribute__((packed));
|
29
28
|
|
30
|
-
|
31
|
-
typedef struct {
|
29
|
+
using esp_ble_ibeacon_t = struct {
|
32
30
|
esp_ble_ibeacon_head_t ibeacon_head;
|
33
31
|
esp_ble_ibeacon_vendor_t ibeacon_vendor;
|
34
|
-
} __attribute__((packed))
|
32
|
+
} __attribute__((packed));
|
35
33
|
|
36
|
-
|
34
|
+
using namespace esp32_ble;
|
35
|
+
|
36
|
+
class ESP32BLEBeacon : public Component, public GAPEventHandler, public Parented<ESP32BLE> {
|
37
37
|
public:
|
38
38
|
explicit ESP32BLEBeacon(const std::array<uint8_t, 16> &uuid) : uuid_(uuid) {}
|
39
39
|
|
@@ -46,12 +46,11 @@ class ESP32BLEBeacon : public Component {
|
|
46
46
|
void set_min_interval(uint16_t val) { this->min_interval_ = val; }
|
47
47
|
void set_max_interval(uint16_t val) { this->max_interval_ = val; }
|
48
48
|
void set_measured_power(int8_t val) { this->measured_power_ = val; }
|
49
|
-
void set_tx_power(
|
49
|
+
void set_tx_power(esp_power_level_t val) { this->tx_power_ = val; }
|
50
|
+
void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) override;
|
50
51
|
|
51
52
|
protected:
|
52
|
-
|
53
|
-
static void ble_core_task(void *params);
|
54
|
-
static void ble_setup();
|
53
|
+
void on_advertise_();
|
55
54
|
|
56
55
|
std::array<uint8_t, 16> uuid_;
|
57
56
|
uint16_t major_{};
|
@@ -59,12 +58,11 @@ class ESP32BLEBeacon : public Component {
|
|
59
58
|
uint16_t min_interval_{};
|
60
59
|
uint16_t max_interval_{};
|
61
60
|
int8_t measured_power_{};
|
62
|
-
|
61
|
+
esp_power_level_t tx_power_{};
|
62
|
+
esp_ble_adv_params_t ble_adv_params_;
|
63
|
+
bool advertising_{false};
|
63
64
|
};
|
64
65
|
|
65
|
-
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
66
|
-
extern ESP32BLEBeacon *global_esp32_ble_beacon;
|
67
|
-
|
68
66
|
} // namespace esp32_ble_beacon
|
69
67
|
} // namespace esphome
|
70
68
|
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import esphome.codegen as cg
|
2
|
+
from esphome.components import esp32_ble
|
3
|
+
from esphome.components.esp32 import add_idf_sdkconfig_option
|
2
4
|
import esphome.config_validation as cv
|
3
5
|
from esphome.const import CONF_ID, CONF_MODEL
|
4
|
-
from esphome.components import esp32_ble
|
5
6
|
from esphome.core import CORE
|
6
|
-
from esphome.components.esp32 import add_idf_sdkconfig_option
|
7
7
|
|
8
8
|
AUTO_LOAD = ["esp32_ble"]
|
9
9
|
CODEOWNERS = ["@jesserockz", "@clydebarrow", "@Rapsssito"]
|
10
|
-
CONFLICTS_WITH = ["esp32_ble_beacon"]
|
11
10
|
DEPENDENCIES = ["esp32"]
|
12
11
|
|
13
12
|
CONF_MANUFACTURER = "manufacturer"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import re
|
2
2
|
|
3
|
-
import esphome.codegen as cg
|
4
|
-
import esphome.config_validation as cv
|
5
3
|
from esphome import automation
|
4
|
+
import esphome.codegen as cg
|
6
5
|
from esphome.components import esp32_ble
|
7
6
|
from esphome.components.esp32 import add_idf_sdkconfig_option
|
7
|
+
import esphome.config_validation as cv
|
8
8
|
from esphome.const import (
|
9
9
|
CONF_ACTIVE,
|
10
10
|
CONF_DURATION,
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import esphome.codegen as cg
|
2
|
+
from esphome.components import binary_sensor, esp32_ble_server, output
|
2
3
|
import esphome.config_validation as cv
|
3
|
-
from esphome.components import binary_sensor, output, esp32_ble_server
|
4
4
|
from esphome.const import CONF_ID
|
5
5
|
|
6
|
-
|
7
6
|
AUTO_LOAD = ["esp32_ble_server"]
|
8
7
|
CODEOWNERS = ["@jesserockz"]
|
9
|
-
CONFLICTS_WITH = ["esp32_ble_beacon"]
|
10
8
|
DEPENDENCIES = ["wifi", "esp32"]
|
11
9
|
|
12
10
|
CONF_AUTHORIZED_DURATION = "authorized_duration"
|
@@ -51,7 +49,7 @@ async def to_code(config):
|
|
51
49
|
cg.add(ble_server.register_service_component(var))
|
52
50
|
|
53
51
|
cg.add_define("USE_IMPROV")
|
54
|
-
cg.add_library("
|
52
|
+
cg.add_library("improv/Improv", "1.2.4")
|
55
53
|
|
56
54
|
cg.add(var.set_identify_duration(config[CONF_IDENTIFY_DURATION]))
|
57
55
|
cg.add(var.set_authorized_duration(config[CONF_AUTHORIZED_DURATION]))
|
@@ -1,6 +1,4 @@
|
|
1
1
|
from esphome import pins
|
2
|
-
import esphome.config_validation as cv
|
3
|
-
import esphome.final_validate as fv
|
4
2
|
import esphome.codegen as cg
|
5
3
|
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant
|
6
4
|
from esphome.components.esp32.const import (
|
@@ -8,31 +6,33 @@ from esphome.components.esp32.const import (
|
|
8
6
|
VARIANT_ESP32S2,
|
9
7
|
VARIANT_ESP32S3,
|
10
8
|
)
|
9
|
+
from esphome.components.network import IPAddress
|
10
|
+
from esphome.components.spi import CONF_INTERFACE_INDEX, get_spi_interface
|
11
|
+
import esphome.config_validation as cv
|
11
12
|
from esphome.const import (
|
13
|
+
CONF_ADDRESS,
|
14
|
+
CONF_CLK_PIN,
|
15
|
+
CONF_CS_PIN,
|
16
|
+
CONF_DNS1,
|
17
|
+
CONF_DNS2,
|
12
18
|
CONF_DOMAIN,
|
19
|
+
CONF_GATEWAY,
|
13
20
|
CONF_ID,
|
14
|
-
|
21
|
+
CONF_INTERRUPT_PIN,
|
15
22
|
CONF_MANUAL_IP,
|
16
|
-
CONF_STATIC_IP,
|
17
|
-
CONF_TYPE,
|
18
|
-
CONF_USE_ADDRESS,
|
19
|
-
CONF_GATEWAY,
|
20
|
-
CONF_SUBNET,
|
21
|
-
CONF_DNS1,
|
22
|
-
CONF_DNS2,
|
23
|
-
CONF_CLK_PIN,
|
24
23
|
CONF_MISO_PIN,
|
25
24
|
CONF_MOSI_PIN,
|
26
|
-
|
27
|
-
CONF_INTERRUPT_PIN,
|
25
|
+
CONF_PAGE_ID,
|
28
26
|
CONF_RESET_PIN,
|
29
27
|
CONF_SPI,
|
30
|
-
|
31
|
-
|
28
|
+
CONF_STATIC_IP,
|
29
|
+
CONF_SUBNET,
|
30
|
+
CONF_TYPE,
|
31
|
+
CONF_USE_ADDRESS,
|
32
|
+
CONF_VALUE,
|
32
33
|
)
|
33
34
|
from esphome.core import CORE, coroutine_with_priority
|
34
|
-
|
35
|
-
from esphome.components.spi import get_spi_interface, CONF_INTERFACE_INDEX
|
35
|
+
import esphome.final_validate as fv
|
36
36
|
|
37
37
|
CONFLICTS_WITH = ["wifi"]
|
38
38
|
DEPENDENCIES = ["esp32"]
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
2
|
from esphome.components import text_sensor
|
3
|
+
import esphome.config_validation as cv
|
4
4
|
from esphome.const import (
|
5
|
-
CONF_IP_ADDRESS,
|
6
5
|
CONF_DNS_ADDRESS,
|
6
|
+
CONF_IP_ADDRESS,
|
7
7
|
CONF_MAC_ADDRESS,
|
8
8
|
ENTITY_CATEGORY_DIAGNOSTIC,
|
9
9
|
)
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
1
|
from esphome import automation
|
2
|
+
import esphome.codegen as cg
|
4
3
|
from esphome.components import mqtt
|
4
|
+
import esphome.config_validation as cv
|
5
5
|
from esphome.const import (
|
6
6
|
CONF_DEVICE_CLASS,
|
7
7
|
CONF_ENTITY_CATEGORY,
|
8
|
+
CONF_EVENT_TYPE,
|
8
9
|
CONF_ICON,
|
9
10
|
CONF_ID,
|
11
|
+
CONF_MQTT_ID,
|
10
12
|
CONF_ON_EVENT,
|
11
13
|
CONF_TRIGGER_ID,
|
12
|
-
CONF_MQTT_ID,
|
13
|
-
CONF_EVENT_TYPE,
|
14
14
|
DEVICE_CLASS_BUTTON,
|
15
15
|
DEVICE_CLASS_DOORBELL,
|
16
16
|
DEVICE_CLASS_EMPTY,
|
17
17
|
DEVICE_CLASS_MOTION,
|
18
18
|
)
|
19
19
|
from esphome.core import CORE, coroutine_with_priority
|
20
|
-
from esphome.cpp_helpers import setup_entity
|
21
20
|
from esphome.cpp_generator import MockObjClass
|
21
|
+
from esphome.cpp_helpers import setup_entity
|
22
22
|
|
23
23
|
CODEOWNERS = ["@nohat"]
|
24
24
|
IS_PLATFORM_COMPONENT = True
|
@@ -1,31 +1,31 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
1
|
from esphome import automation
|
4
2
|
from esphome.automation import maybe_simple_id
|
3
|
+
import esphome.codegen as cg
|
5
4
|
from esphome.components import mqtt, web_server
|
5
|
+
import esphome.config_validation as cv
|
6
6
|
from esphome.const import (
|
7
|
+
CONF_DIRECTION,
|
7
8
|
CONF_ID,
|
8
9
|
CONF_MQTT_ID,
|
9
|
-
CONF_WEB_SERVER_ID,
|
10
|
-
CONF_OSCILLATING,
|
11
|
-
CONF_OSCILLATION_COMMAND_TOPIC,
|
12
|
-
CONF_OSCILLATION_STATE_TOPIC,
|
13
|
-
CONF_SPEED,
|
14
|
-
CONF_SPEED_LEVEL_COMMAND_TOPIC,
|
15
|
-
CONF_SPEED_LEVEL_STATE_TOPIC,
|
16
|
-
CONF_SPEED_COMMAND_TOPIC,
|
17
|
-
CONF_SPEED_STATE_TOPIC,
|
18
10
|
CONF_OFF_SPEED_CYCLE,
|
19
11
|
CONF_ON_DIRECTION_SET,
|
20
12
|
CONF_ON_OSCILLATING_SET,
|
13
|
+
CONF_ON_PRESET_SET,
|
21
14
|
CONF_ON_SPEED_SET,
|
22
15
|
CONF_ON_STATE,
|
23
16
|
CONF_ON_TURN_OFF,
|
24
17
|
CONF_ON_TURN_ON,
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
CONF_OSCILLATING,
|
19
|
+
CONF_OSCILLATION_COMMAND_TOPIC,
|
20
|
+
CONF_OSCILLATION_STATE_TOPIC,
|
28
21
|
CONF_RESTORE_MODE,
|
22
|
+
CONF_SPEED,
|
23
|
+
CONF_SPEED_COMMAND_TOPIC,
|
24
|
+
CONF_SPEED_LEVEL_COMMAND_TOPIC,
|
25
|
+
CONF_SPEED_LEVEL_STATE_TOPIC,
|
26
|
+
CONF_SPEED_STATE_TOPIC,
|
27
|
+
CONF_TRIGGER_ID,
|
28
|
+
CONF_WEB_SERVER_ID,
|
29
29
|
)
|
30
30
|
from esphome.core import CORE, coroutine_with_priority
|
31
31
|
from esphome.cpp_helpers import setup_entity
|
esphome/components/fan/fan.cpp
CHANGED
@@ -45,8 +45,8 @@ void FanCall::validate_() {
|
|
45
45
|
this->speed_ = clamp(*this->speed_, 1, traits.supported_speed_count());
|
46
46
|
|
47
47
|
if (this->binary_state_.has_value() && *this->binary_state_) {
|
48
|
-
// when turning on, if current speed
|
49
|
-
if (traits.supports_speed() && !this->parent_.state && this->parent_.speed == 0) {
|
48
|
+
// when turning on, if neither current nor new speed available, set speed to 100%
|
49
|
+
if (traits.supports_speed() && !this->parent_.state && this->parent_.speed == 0 && !this->speed_.has_value()) {
|
50
50
|
this->speed_ = traits.supported_speed_count();
|
51
51
|
}
|
52
52
|
}
|
@@ -307,7 +307,7 @@ void FingerprintGrowComponent::delete_fingerprint(uint16_t finger_id) {
|
|
307
307
|
|
308
308
|
void FingerprintGrowComponent::delete_all_fingerprints() {
|
309
309
|
ESP_LOGI(TAG, "Deleting all stored fingerprints");
|
310
|
-
this->data_ = {
|
310
|
+
this->data_ = {DELETE_ALL};
|
311
311
|
switch (this->send_command_()) {
|
312
312
|
case OK:
|
313
313
|
ESP_LOGI(TAG, "Deleted all fingerprints");
|
@@ -1,19 +1,22 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
|
-
from esphome.components import display, font, color
|
4
|
-
from esphome.const import CONF_DISPLAY, CONF_ID, CONF_TRIGGER_ID
|
5
1
|
from esphome import automation, core
|
6
|
-
|
2
|
+
import esphome.codegen as cg
|
3
|
+
from esphome.components import color, display, font
|
7
4
|
from esphome.components.display_menu_base import (
|
8
5
|
DISPLAY_MENU_BASE_SCHEMA,
|
9
6
|
DisplayMenuComponent,
|
10
7
|
display_menu_to_code,
|
11
8
|
)
|
9
|
+
import esphome.config_validation as cv
|
10
|
+
from esphome.const import (
|
11
|
+
CONF_BACKGROUND_COLOR,
|
12
|
+
CONF_DISPLAY,
|
13
|
+
CONF_FONT,
|
14
|
+
CONF_FOREGROUND_COLOR,
|
15
|
+
CONF_ID,
|
16
|
+
CONF_TRIGGER_ID,
|
17
|
+
)
|
12
18
|
|
13
|
-
CONF_FONT = "font"
|
14
19
|
CONF_MENU_ITEM_VALUE = "menu_item_value"
|
15
|
-
CONF_FOREGROUND_COLOR = "foreground_color"
|
16
|
-
CONF_BACKGROUND_COLOR = "background_color"
|
17
20
|
CONF_ON_REDRAW = "on_redraw"
|
18
21
|
|
19
22
|
graphical_display_menu_ns = cg.esphome_ns.namespace("graphical_display_menu")
|
@@ -80,8 +80,8 @@ class HaierClimateBase : public esphome::Component,
|
|
80
80
|
const char *phase_to_string_(ProtocolPhases phase);
|
81
81
|
virtual void set_handlers() = 0;
|
82
82
|
virtual void process_phase(std::chrono::steady_clock::time_point now) = 0;
|
83
|
-
virtual haier_protocol::HaierMessage get_control_message() = 0;
|
84
|
-
virtual haier_protocol::HaierMessage get_power_message(bool state) = 0;
|
83
|
+
virtual haier_protocol::HaierMessage get_control_message() = 0; // NOLINT(readability-identifier-naming)
|
84
|
+
virtual haier_protocol::HaierMessage get_power_message(bool state) = 0; // NOLINT(readability-identifier-naming)
|
85
85
|
virtual void initialization(){};
|
86
86
|
virtual bool prepare_pending_action();
|
87
87
|
virtual void process_protocol_reset();
|
@@ -2,7 +2,7 @@ import esphome.codegen as cg
|
|
2
2
|
import esphome.config_validation as cv
|
3
3
|
from esphome.const import CONF_ATTRIBUTE, CONF_ENTITY_ID, CONF_INTERNAL
|
4
4
|
|
5
|
-
CODEOWNERS = ["@OttoWinter"]
|
5
|
+
CODEOWNERS = ["@OttoWinter", "@esphome/core"]
|
6
6
|
homeassistant_ns = cg.esphome_ns.namespace("homeassistant")
|
7
7
|
|
8
8
|
HOME_ASSISTANT_IMPORT_SCHEMA = cv.Schema(
|
@@ -13,6 +13,13 @@ HOME_ASSISTANT_IMPORT_SCHEMA = cv.Schema(
|
|
13
13
|
}
|
14
14
|
)
|
15
15
|
|
16
|
+
HOME_ASSISTANT_IMPORT_CONTROL_SCHEMA = cv.Schema(
|
17
|
+
{
|
18
|
+
cv.Required(CONF_ENTITY_ID): cv.entity_id,
|
19
|
+
cv.Optional(CONF_INTERNAL, default=True): cv.boolean,
|
20
|
+
}
|
21
|
+
)
|
22
|
+
|
16
23
|
|
17
24
|
def setup_home_assistant_entity(var, config):
|
18
25
|
cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import esphome.codegen as cg
|
2
|
+
from esphome.components import number
|
3
|
+
import esphome.config_validation as cv
|
4
|
+
|
5
|
+
from .. import (
|
6
|
+
HOME_ASSISTANT_IMPORT_CONTROL_SCHEMA,
|
7
|
+
homeassistant_ns,
|
8
|
+
setup_home_assistant_entity,
|
9
|
+
)
|
10
|
+
|
11
|
+
CODEOWNERS = ["@landonr"]
|
12
|
+
DEPENDENCIES = ["api"]
|
13
|
+
|
14
|
+
HomeassistantNumber = homeassistant_ns.class_(
|
15
|
+
"HomeassistantNumber", number.Number, cg.Component
|
16
|
+
)
|
17
|
+
|
18
|
+
CONFIG_SCHEMA = (
|
19
|
+
number.number_schema(HomeassistantNumber)
|
20
|
+
.extend(HOME_ASSISTANT_IMPORT_CONTROL_SCHEMA)
|
21
|
+
.extend(cv.COMPONENT_SCHEMA)
|
22
|
+
)
|
23
|
+
|
24
|
+
|
25
|
+
async def to_code(config):
|
26
|
+
var = await number.new_number(
|
27
|
+
config,
|
28
|
+
min_value=0,
|
29
|
+
max_value=0,
|
30
|
+
step=0,
|
31
|
+
)
|
32
|
+
await cg.register_component(var, config)
|
33
|
+
setup_home_assistant_entity(var, config)
|