esphome 2024.10.2__py3-none-any.whl → 2024.11.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 +22 -4
- esphome/automation.py +29 -2
- esphome/components/animation/__init__.py +5 -8
- esphome/components/animation/animation.cpp +1 -1
- esphome/components/audio/__init__.py +9 -0
- esphome/components/audio/audio.h +21 -0
- esphome/components/axs15231/__init__.py +6 -0
- esphome/components/axs15231/touchscreen/__init__.py +36 -0
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +64 -0
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.h +27 -0
- esphome/components/bme68x_bsec2/__init__.py +1 -1
- esphome/components/bme68x_bsec2/bme68x_bsec2.cpp +50 -47
- esphome/components/bme68x_bsec2/bme68x_bsec2.h +0 -2
- esphome/components/bytebuffer/__init__.py +5 -0
- esphome/components/bytebuffer/bytebuffer.h +421 -0
- esphome/components/climate/__init__.py +14 -13
- esphome/components/datetime/__init__.py +3 -3
- esphome/components/debug/debug_esp32.cpp +16 -8
- esphome/components/dfplayer/dfplayer.cpp +132 -6
- esphome/components/dfplayer/dfplayer.h +19 -53
- esphome/components/display/display.cpp +142 -0
- esphome/components/display/display.h +7 -0
- esphome/components/es8311/__init__.py +0 -0
- esphome/components/es8311/audio_dac.py +70 -0
- esphome/components/es8311/es8311.cpp +227 -0
- esphome/components/es8311/es8311.h +135 -0
- esphome/components/es8311/es8311_const.h +195 -0
- esphome/components/esp32/boards.py +199 -1
- esphome/components/esp32/gpio.py +3 -1
- esphome/components/esp32_ble/const_esp32c6.h +7 -0
- esphome/components/esp32_ble_client/ble_client_base.h +1 -1
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +3 -0
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -1
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +2 -2
- esphome/components/esp32_rmt_led_strip/led_strip.h +2 -0
- esphome/components/esp32_rmt_led_strip/light.py +3 -1
- esphome/components/esp8266/gpio.py +7 -5
- esphome/components/ethernet/__init__.py +55 -1
- esphome/components/ethernet/ethernet_component.cpp +14 -1
- esphome/components/ethernet/ethernet_component.h +7 -1
- esphome/components/font/__init__.py +213 -108
- esphome/components/gp8403/output/__init__.py +1 -1
- esphome/components/host/gpio.py +6 -4
- esphome/components/http_request/__init__.py +12 -0
- esphome/components/http_request/http_request.h +65 -3
- esphome/components/http_request/http_request_arduino.cpp +4 -3
- esphome/components/http_request/http_request_idf.cpp +12 -14
- esphome/components/http_request/ota/ota_http_request.cpp +1 -1
- esphome/components/http_request/update/http_request_update.cpp +1 -1
- esphome/components/i2c_device/__init__.py +26 -0
- esphome/components/i2c_device/i2c_device.cpp +17 -0
- esphome/components/i2c_device/i2c_device.h +18 -0
- esphome/components/i2s_audio/__init__.py +1 -3
- esphome/components/i2s_audio/speaker/__init__.py +12 -4
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +426 -200
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +92 -33
- esphome/components/ili9xxx/display.py +5 -1
- esphome/components/image/__init__.py +5 -8
- esphome/components/image/image.cpp +14 -14
- esphome/components/image/image.h +20 -24
- esphome/components/internal_temperature/internal_temperature.cpp +51 -2
- esphome/components/internal_temperature/internal_temperature.h +1 -0
- esphome/components/ld2420/ld2420.cpp +1 -1
- esphome/components/libretiny/gpio.py +4 -2
- esphome/components/light/__init__.py +32 -1
- esphome/components/light/automation.py +39 -32
- esphome/components/light/effects.py +36 -36
- esphome/components/light/light_state.cpp +6 -16
- esphome/components/light/light_state.h +34 -0
- esphome/components/light/types.py +3 -1
- esphome/components/logger/logger_esp32.cpp +15 -0
- esphome/components/lvgl/__init__.py +202 -95
- esphome/components/lvgl/automation.py +42 -40
- esphome/components/lvgl/binary_sensor/__init__.py +8 -15
- esphome/components/lvgl/defines.py +14 -8
- esphome/components/lvgl/encoders.py +11 -8
- esphome/components/lvgl/keypads.py +77 -0
- esphome/components/lvgl/light/__init__.py +6 -8
- esphome/components/lvgl/lv_validation.py +2 -4
- esphome/components/lvgl/lvcode.py +3 -9
- esphome/components/lvgl/lvgl_esphome.cpp +210 -89
- esphome/components/lvgl/lvgl_esphome.h +113 -30
- esphome/components/lvgl/lvgl_proxy.h +17 -0
- esphome/components/lvgl/number/__init__.py +10 -15
- esphome/components/lvgl/schemas.py +4 -2
- esphome/components/lvgl/select/__init__.py +12 -37
- esphome/components/lvgl/select/lvgl_select.h +27 -33
- esphome/components/lvgl/sensor/__init__.py +8 -14
- esphome/components/lvgl/styles.py +3 -4
- esphome/components/lvgl/switch/__init__.py +8 -13
- esphome/components/lvgl/text/__init__.py +5 -6
- esphome/components/lvgl/text_sensor/__init__.py +15 -15
- esphome/components/lvgl/touchscreens.py +2 -3
- esphome/components/lvgl/trigger.py +7 -9
- esphome/components/lvgl/types.py +9 -3
- esphome/components/lvgl/widgets/__init__.py +32 -21
- esphome/components/lvgl/widgets/animimg.py +4 -3
- esphome/components/lvgl/widgets/dropdown.py +22 -10
- esphome/components/lvgl/widgets/img.py +2 -0
- esphome/components/lvgl/widgets/msgbox.py +6 -5
- esphome/components/lvgl/widgets/obj.py +4 -2
- esphome/components/lvgl/widgets/page.py +3 -2
- esphome/components/lvgl/widgets/qrcode.py +54 -0
- esphome/components/lvgl/widgets/roller.py +21 -14
- esphome/components/lvgl/widgets/tileview.py +2 -1
- esphome/components/max17043/__init__.py +1 -0
- esphome/components/max17043/automation.h +20 -0
- esphome/components/max17043/max17043.cpp +98 -0
- esphome/components/max17043/max17043.h +29 -0
- esphome/components/max17043/sensor.py +77 -0
- esphome/components/media_player/__init__.py +11 -0
- esphome/components/media_player/automation.h +10 -0
- esphome/components/media_player/media_player.cpp +4 -0
- esphome/components/midea/air_conditioner.cpp +17 -1
- esphome/components/mlx90393/sensor.py +1 -1
- esphome/components/modbus/modbus.cpp +24 -12
- esphome/components/modbus_controller/__init__.py +31 -1
- esphome/components/modbus_controller/automation.h +16 -0
- esphome/components/modbus_controller/const.py +2 -0
- esphome/components/modbus_controller/modbus_controller.cpp +14 -2
- esphome/components/modbus_controller/modbus_controller.h +9 -0
- esphome/components/mopeka_pro_check/mopeka_pro_check.cpp +40 -21
- esphome/components/mopeka_pro_check/mopeka_pro_check.h +9 -2
- esphome/components/mopeka_pro_check/sensor.py +41 -0
- esphome/components/mqtt/__init__.py +36 -0
- esphome/components/mqtt/mqtt_client.cpp +27 -3
- esphome/components/mqtt/mqtt_client.h +27 -2
- esphome/components/mqtt/mqtt_climate.cpp +4 -2
- esphome/components/mqtt/mqtt_component.cpp +6 -0
- esphome/components/mqtt/mqtt_component.h +4 -0
- esphome/components/mqtt/mqtt_const.h +6 -0
- esphome/components/online_image/online_image.cpp +2 -8
- esphome/components/online_image/online_image.h +2 -6
- esphome/components/opentherm/__init__.py +35 -9
- esphome/components/opentherm/binary_sensor/__init__.py +33 -0
- esphome/components/opentherm/const.py +11 -0
- esphome/components/opentherm/generate.py +142 -0
- esphome/components/opentherm/hub.cpp +130 -24
- esphome/components/opentherm/hub.h +62 -9
- esphome/components/opentherm/input.h +18 -0
- esphome/components/opentherm/input.py +51 -0
- esphome/components/opentherm/number/__init__.py +74 -0
- esphome/components/opentherm/number/number.cpp +40 -0
- esphome/components/opentherm/number/number.h +31 -0
- esphome/components/opentherm/opentherm.cpp +30 -0
- esphome/components/opentherm/opentherm.h +34 -2
- esphome/components/opentherm/opentherm_macros.h +151 -0
- esphome/components/opentherm/output/__init__.py +47 -0
- esphome/components/opentherm/output/output.cpp +18 -0
- esphome/components/opentherm/output/output.h +33 -0
- esphome/components/opentherm/schema.py +814 -0
- esphome/components/opentherm/sensor/__init__.py +51 -0
- esphome/components/opentherm/switch/__init__.py +43 -0
- esphome/components/opentherm/switch/switch.cpp +28 -0
- esphome/components/opentherm/switch/switch.h +20 -0
- esphome/components/opentherm/validate.py +31 -0
- esphome/components/pcd8544/display.py +8 -4
- esphome/components/prometheus/prometheus_handler.cpp +176 -14
- esphome/components/prometheus/prometheus_handler.h +25 -7
- esphome/components/qspi_amoled/display.py +1 -141
- esphome/components/qspi_dbi/display.py +185 -0
- esphome/components/qspi_dbi/models.py +64 -0
- esphome/components/{qspi_amoled/qspi_amoled.cpp → qspi_dbi/qspi_dbi.cpp} +95 -46
- esphome/components/{qspi_amoled/qspi_amoled.h → qspi_dbi/qspi_dbi.h} +26 -15
- esphome/components/rp2040/__init__.py +6 -3
- esphome/components/rp2040/gpio.py +5 -3
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.cpp +20 -0
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.h +3 -2
- esphome/components/rtttl/rtttl.cpp +4 -1
- esphome/components/rtttl/rtttl.h +1 -0
- esphome/components/sdl/sdl_esphome.cpp +22 -5
- esphome/components/sdl/sdl_esphome.h +1 -0
- esphome/components/sdm_meter/sdm_meter.cpp +1 -1
- esphome/components/sensor/__init__.py +18 -8
- esphome/components/sensor/filter.cpp +19 -18
- esphome/components/sensor/filter.h +9 -10
- esphome/components/sgp4x/sgp4x.cpp +40 -74
- esphome/components/sgp4x/sgp4x.h +5 -3
- esphome/components/speaker/__init__.py +51 -5
- esphome/components/speaker/automation.h +25 -0
- esphome/components/speaker/speaker.h +72 -1
- esphome/components/spi/__init__.py +15 -14
- esphome/components/spi_device/__init__.py +4 -15
- esphome/components/ssd1306_spi/display.py +6 -2
- esphome/components/ssd1322_spi/display.py +6 -2
- esphome/components/ssd1325_spi/display.py +6 -2
- esphome/components/ssd1327_spi/display.py +6 -2
- esphome/components/ssd1331_spi/display.py +6 -2
- esphome/components/ssd1351_spi/display.py +6 -2
- esphome/components/st7567_spi/display.py +6 -2
- esphome/components/st7701s/display.py +5 -1
- esphome/components/st7735/display.py +10 -5
- esphome/components/st7789v/display.py +12 -7
- esphome/components/statsd/statsd.cpp +2 -0
- esphome/components/statsd/statsd.h +2 -0
- esphome/components/sun/sun.h +3 -0
- esphome/components/tc74/__init__.py +1 -0
- esphome/components/tc74/sensor.py +32 -0
- esphome/components/tc74/tc74.cpp +68 -0
- esphome/components/tc74/tc74.h +28 -0
- esphome/components/touchscreen/__init__.py +41 -50
- esphome/components/touchscreen/touchscreen.h +4 -8
- esphome/components/tuya/fan/tuya_fan.cpp +1 -1
- esphome/components/udp/udp_component.cpp +6 -3
- esphome/components/udp/udp_component.h +4 -2
- esphome/components/waveshare_epaper/display.py +6 -2
- esphome/components/web_server/web_server.cpp +22 -0
- esphome/components/web_server/web_server.h +3 -0
- esphome/components/weikai/weikai.h +2 -2
- esphome/components/wifi/wifi_component.cpp +2 -2
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +4 -4
- esphome/components/wifi/wifi_component_esp8266.cpp +4 -4
- esphome/components/wifi/wifi_component_esp_idf.cpp +2 -2
- esphome/components/xpt2046/touchscreen/__init__.py +7 -32
- esphome/config_validation.py +3 -1
- esphome/const.py +9 -2
- esphome/core/defines.h +8 -2
- esphome/core/helpers.cpp +32 -17
- esphome/core/helpers.h +32 -16
- esphome/core/ring_buffer.cpp +2 -2
- esphome/core/ring_buffer.h +2 -2
- esphome/dashboard/core.py +25 -0
- esphome/dashboard/status/mdns.py +3 -4
- esphome/dashboard/web_server.py +54 -19
- esphome/espota2.py +36 -35
- esphome/helpers.py +68 -16
- esphome/mqtt.py +9 -2
- esphome/storage_json.py +4 -0
- esphome/writer.py +7 -18
- esphome/zeroconf.py +8 -6
- {esphome-2024.10.2.dist-info → esphome-2024.11.0.dist-info}/METADATA +7 -5
- {esphome-2024.10.2.dist-info → esphome-2024.11.0.dist-info}/RECORD +237 -191
- esphome/core/bytebuffer.cpp +0 -167
- esphome/core/bytebuffer.h +0 -144
- /esphome/components/{qspi_amoled → qspi_dbi}/__init__.py +0 -0
- {esphome-2024.10.2.dist-info → esphome-2024.11.0.dist-info}/LICENSE +0 -0
- {esphome-2024.10.2.dist-info → esphome-2024.11.0.dist-info}/WHEEL +0 -0
- {esphome-2024.10.2.dist-info → esphome-2024.11.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.10.2.dist-info → esphome-2024.11.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,421 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <utility>
|
4
|
+
#include <vector>
|
5
|
+
#include <cinttypes>
|
6
|
+
#include <cstddef>
|
7
|
+
#include "esphome/core/helpers.h"
|
8
|
+
|
9
|
+
namespace esphome {
|
10
|
+
namespace bytebuffer {
|
11
|
+
|
12
|
+
enum Endian { LITTLE, BIG };
|
13
|
+
|
14
|
+
/**
|
15
|
+
* A class modelled on the Java ByteBuffer class. It wraps a vector of bytes and permits putting and getting
|
16
|
+
* items of various sizes, with an automatically incremented position.
|
17
|
+
*
|
18
|
+
* There are three variables maintained pointing into the buffer:
|
19
|
+
*
|
20
|
+
* capacity: the maximum amount of data that can be stored - set on construction and cannot be changed
|
21
|
+
* limit: the limit of the data currently available to get or put
|
22
|
+
* position: the current insert or extract position
|
23
|
+
*
|
24
|
+
* 0 <= position <= limit <= capacity
|
25
|
+
*
|
26
|
+
* In addition a mark can be set to the current position with mark(). A subsequent call to reset() will restore
|
27
|
+
* the position to the mark.
|
28
|
+
*
|
29
|
+
* The buffer can be marked to be little-endian (default) or big-endian. All subsequent operations will use that order.
|
30
|
+
*
|
31
|
+
* The flip() operation will reset the position to 0 and limit to the current position. This is useful for reading
|
32
|
+
* data from a buffer after it has been written.
|
33
|
+
*
|
34
|
+
* The code is defined here in the header file rather than in a .cpp file, so that it does not get compiled if not used.
|
35
|
+
* The templated functions ensure that only those typed functions actually used are compiled. The functions
|
36
|
+
* are implicitly inline-able which will aid performance.
|
37
|
+
*/
|
38
|
+
class ByteBuffer {
|
39
|
+
public:
|
40
|
+
// Default constructor (compatibility with TEMPLATABLE_VALUE)
|
41
|
+
// Creates a zero-length ByteBuffer which is little use to anybody.
|
42
|
+
ByteBuffer() : ByteBuffer(std::vector<uint8_t>()) {}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Create a new Bytebuffer with the given capacity
|
46
|
+
*/
|
47
|
+
ByteBuffer(size_t capacity, Endian endianness = LITTLE)
|
48
|
+
: data_(std::vector<uint8_t>(capacity)), endianness_(endianness), limit_(capacity){};
|
49
|
+
|
50
|
+
// templated functions to implement putting and getting data of various types. There are two flavours of all
|
51
|
+
// functions - one that uses the position as the offset, and updates the position accordingly, and one that
|
52
|
+
// takes an explicit offset and does not update the position.
|
53
|
+
// Separate temnplates are provided for types that fit into 32 bits and those that are bigger. These delegate
|
54
|
+
// the actual put/get to common code based around those sizes.
|
55
|
+
// This reduces the code size and execution time for smaller types. A similar structure for e.g. 16 bits is unlikely
|
56
|
+
// to provide any further benefit given that all target platforms are native 32 bit.
|
57
|
+
|
58
|
+
template<typename T>
|
59
|
+
T get(typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
60
|
+
typename std::enable_if<(sizeof(T) <= sizeof(uint32_t)), T>::type * = 0) {
|
61
|
+
// integral types that fit into 32 bit
|
62
|
+
return static_cast<T>(this->get_uint32_(sizeof(T)));
|
63
|
+
}
|
64
|
+
|
65
|
+
template<typename T>
|
66
|
+
T get(size_t offset, typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
67
|
+
typename std::enable_if<(sizeof(T) <= sizeof(uint32_t)), T>::type * = 0) {
|
68
|
+
return static_cast<T>(this->get_uint32_(offset, sizeof(T)));
|
69
|
+
}
|
70
|
+
|
71
|
+
template<typename T>
|
72
|
+
void put(const T &value, typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
73
|
+
typename std::enable_if<(sizeof(T) <= sizeof(uint32_t)), T>::type * = 0) {
|
74
|
+
this->put_uint32_(static_cast<uint32_t>(value), sizeof(T));
|
75
|
+
}
|
76
|
+
|
77
|
+
template<typename T>
|
78
|
+
void put(const T &value, size_t offset, typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
79
|
+
typename std::enable_if<(sizeof(T) <= sizeof(uint32_t)), T>::type * = 0) {
|
80
|
+
this->put_uint32_(static_cast<uint32_t>(value), offset, sizeof(T));
|
81
|
+
}
|
82
|
+
|
83
|
+
// integral types that do not fit into 32 bit (basically only 64 bit types)
|
84
|
+
template<typename T>
|
85
|
+
T get(typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
86
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
87
|
+
return static_cast<T>(this->get_uint64_(sizeof(T)));
|
88
|
+
}
|
89
|
+
|
90
|
+
template<typename T>
|
91
|
+
T get(size_t offset, typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
92
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
93
|
+
return static_cast<T>(this->get_uint64_(offset, sizeof(T)));
|
94
|
+
}
|
95
|
+
|
96
|
+
template<typename T>
|
97
|
+
void put(const T &value, typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
98
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
99
|
+
this->put_uint64_(value, sizeof(T));
|
100
|
+
}
|
101
|
+
|
102
|
+
template<typename T>
|
103
|
+
void put(const T &value, size_t offset, typename std::enable_if<std::is_integral<T>::value, T>::type * = 0,
|
104
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
105
|
+
this->put_uint64_(static_cast<uint64_t>(value), offset, sizeof(T));
|
106
|
+
}
|
107
|
+
|
108
|
+
// floating point types. Caters for 32 and 64 bit floating point.
|
109
|
+
template<typename T>
|
110
|
+
T get(typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
111
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint32_t)), T>::type * = 0) {
|
112
|
+
return bit_cast<T>(this->get_uint32_(sizeof(T)));
|
113
|
+
}
|
114
|
+
|
115
|
+
template<typename T>
|
116
|
+
T get(typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
117
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
118
|
+
return bit_cast<T>(this->get_uint64_(sizeof(T)));
|
119
|
+
}
|
120
|
+
|
121
|
+
template<typename T>
|
122
|
+
T get(size_t offset, typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
123
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint32_t)), T>::type * = 0) {
|
124
|
+
return bit_cast<T>(this->get_uint32_(offset, sizeof(T)));
|
125
|
+
}
|
126
|
+
|
127
|
+
template<typename T>
|
128
|
+
T get(size_t offset, typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
129
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
130
|
+
return bit_cast<T>(this->get_uint64_(offset, sizeof(T)));
|
131
|
+
}
|
132
|
+
template<typename T>
|
133
|
+
void put(const T &value, typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
134
|
+
typename std::enable_if<(sizeof(T) <= sizeof(uint32_t)), T>::type * = 0) {
|
135
|
+
this->put_uint32_(bit_cast<uint32_t>(value), sizeof(T));
|
136
|
+
}
|
137
|
+
|
138
|
+
template<typename T>
|
139
|
+
void put(const T &value, typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
140
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
141
|
+
this->put_uint64_(bit_cast<uint64_t>(value), sizeof(T));
|
142
|
+
}
|
143
|
+
|
144
|
+
template<typename T>
|
145
|
+
void put(const T &value, size_t offset, typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
146
|
+
typename std::enable_if<(sizeof(T) <= sizeof(uint32_t)), T>::type * = 0) {
|
147
|
+
this->put_uint32_(bit_cast<uint32_t>(value), offset, sizeof(T));
|
148
|
+
}
|
149
|
+
|
150
|
+
template<typename T>
|
151
|
+
void put(const T &value, size_t offset, typename std::enable_if<std::is_floating_point<T>::value, T>::type * = 0,
|
152
|
+
typename std::enable_if<(sizeof(T) == sizeof(uint64_t)), T>::type * = 0) {
|
153
|
+
this->put_uint64_(bit_cast<uint64_t>(value), offset, sizeof(T));
|
154
|
+
}
|
155
|
+
|
156
|
+
template<typename T> static ByteBuffer wrap(T value, Endian endianness = LITTLE) {
|
157
|
+
ByteBuffer buffer = ByteBuffer(sizeof(T), endianness);
|
158
|
+
buffer.put(value);
|
159
|
+
buffer.flip();
|
160
|
+
return buffer;
|
161
|
+
}
|
162
|
+
|
163
|
+
static ByteBuffer wrap(std::vector<uint8_t> const &data, Endian endianness = LITTLE) {
|
164
|
+
ByteBuffer buffer = {data};
|
165
|
+
buffer.endianness_ = endianness;
|
166
|
+
return buffer;
|
167
|
+
}
|
168
|
+
|
169
|
+
static ByteBuffer wrap(const uint8_t *ptr, size_t len, Endian endianness = LITTLE) {
|
170
|
+
return wrap(std::vector<uint8_t>(ptr, ptr + len), endianness);
|
171
|
+
}
|
172
|
+
|
173
|
+
// convenience functions with explicit types named..
|
174
|
+
void put_float(float value) { this->put(value); }
|
175
|
+
void put_double(double value) { this->put(value); }
|
176
|
+
|
177
|
+
uint8_t get_uint8() { return this->data_[this->position_++]; }
|
178
|
+
// Get a 16 bit unsigned value, increment by 2
|
179
|
+
uint16_t get_uint16() { return this->get<uint16_t>(); }
|
180
|
+
// Get a 24 bit unsigned value, increment by 3
|
181
|
+
uint32_t get_uint24() { return this->get_uint32_(3); };
|
182
|
+
// Get a 32 bit unsigned value, increment by 4
|
183
|
+
uint32_t get_uint32() { return this->get<uint32_t>(); };
|
184
|
+
// Get a 64 bit unsigned value, increment by 8
|
185
|
+
uint64_t get_uint64() { return this->get<uint64_t>(); };
|
186
|
+
// Signed versions of the get functions
|
187
|
+
uint8_t get_int8() { return static_cast<int8_t>(this->get_uint8()); };
|
188
|
+
int16_t get_int16() { return this->get<uint16_t>(); }
|
189
|
+
int32_t get_int32() { return this->get<int32_t>(); }
|
190
|
+
int64_t get_int64() { return this->get<int64_t>(); }
|
191
|
+
// Get a float value, increment by 4
|
192
|
+
float get_float() { return this->get<float>(); }
|
193
|
+
// Get a double value, increment by 8
|
194
|
+
double get_double() { return this->get<double>(); }
|
195
|
+
|
196
|
+
// Get a bool value, increment by 1
|
197
|
+
bool get_bool() { return static_cast<bool>(this->get_uint8()); }
|
198
|
+
|
199
|
+
uint32_t get_int24(size_t offset) {
|
200
|
+
auto value = this->get_uint24(offset);
|
201
|
+
uint32_t mask = (~static_cast<uint32_t>(0)) << 23;
|
202
|
+
if ((value & mask) != 0)
|
203
|
+
value |= mask;
|
204
|
+
return value;
|
205
|
+
}
|
206
|
+
|
207
|
+
uint32_t get_int24() {
|
208
|
+
auto value = this->get_uint24();
|
209
|
+
uint32_t mask = (~static_cast<uint32_t>(0)) << 23;
|
210
|
+
if ((value & mask) != 0)
|
211
|
+
value |= mask;
|
212
|
+
return value;
|
213
|
+
}
|
214
|
+
std::vector<uint8_t> get_vector(size_t length, size_t offset) {
|
215
|
+
auto start = this->data_.begin() + offset;
|
216
|
+
return {start, start + length};
|
217
|
+
}
|
218
|
+
|
219
|
+
std::vector<uint8_t> get_vector(size_t length) {
|
220
|
+
auto result = this->get_vector(length, this->position_);
|
221
|
+
this->position_ += length;
|
222
|
+
return result;
|
223
|
+
}
|
224
|
+
|
225
|
+
// Convenience named functions
|
226
|
+
void put_uint8(uint8_t value) { this->data_[this->position_++] = value; }
|
227
|
+
void put_uint16(uint16_t value) { this->put(value); }
|
228
|
+
void put_uint24(uint32_t value) { this->put_uint32_(value, 3); }
|
229
|
+
void put_uint32(uint32_t value) { this->put(value); }
|
230
|
+
void put_uint64(uint64_t value) { this->put(value); }
|
231
|
+
// Signed versions of the put functions
|
232
|
+
void put_int8(int8_t value) { this->put_uint8(static_cast<uint8_t>(value)); }
|
233
|
+
void put_int16(int16_t value) { this->put(value); }
|
234
|
+
void put_int24(int32_t value) { this->put_uint32_(value, 3); }
|
235
|
+
void put_int32(int32_t value) { this->put(value); }
|
236
|
+
void put_int64(int64_t value) { this->put(value); }
|
237
|
+
// Extra put functions
|
238
|
+
void put_bool(bool value) { this->put_uint8(value); }
|
239
|
+
|
240
|
+
// versions of the above with an offset, these do not update the position
|
241
|
+
|
242
|
+
uint64_t get_uint64(size_t offset) { return this->get<uint64_t>(offset); }
|
243
|
+
uint32_t get_uint24(size_t offset) { return this->get_uint32_(offset, 3); };
|
244
|
+
double get_double(size_t offset) { return get<double>(offset); }
|
245
|
+
|
246
|
+
// Get one byte from the buffer, increment position by 1
|
247
|
+
uint8_t get_uint8(size_t offset) { return this->data_[offset]; }
|
248
|
+
// Get a 16 bit unsigned value, increment by 2
|
249
|
+
uint16_t get_uint16(size_t offset) { return get<uint16_t>(offset); }
|
250
|
+
// Get a 24 bit unsigned value, increment by 3
|
251
|
+
uint32_t get_uint32(size_t offset) { return this->get<uint32_t>(offset); };
|
252
|
+
// Get a 64 bit unsigned value, increment by 8
|
253
|
+
uint8_t get_int8(size_t offset) { return get<int8_t>(offset); }
|
254
|
+
int16_t get_int16(size_t offset) { return get<int16_t>(offset); }
|
255
|
+
int32_t get_int32(size_t offset) { return get<int32_t>(offset); }
|
256
|
+
int64_t get_int64(size_t offset) { return get<int64_t>(offset); }
|
257
|
+
// Get a float value, increment by 4
|
258
|
+
float get_float(size_t offset) { return get<float>(offset); }
|
259
|
+
// Get a double value, increment by 8
|
260
|
+
|
261
|
+
// Get a bool value, increment by 1
|
262
|
+
bool get_bool(size_t offset) { return this->get_uint8(offset); }
|
263
|
+
|
264
|
+
void put_uint8(uint8_t value, size_t offset) { this->data_[offset] = value; }
|
265
|
+
void put_uint16(uint16_t value, size_t offset) { this->put(value, offset); }
|
266
|
+
void put_uint24(uint32_t value, size_t offset) { this->put(value, offset); }
|
267
|
+
void put_uint32(uint32_t value, size_t offset) { this->put(value, offset); }
|
268
|
+
void put_uint64(uint64_t value, size_t offset) { this->put(value, offset); }
|
269
|
+
// Signed versions of the put functions
|
270
|
+
void put_int8(int8_t value, size_t offset) { this->put_uint8(static_cast<uint8_t>(value), offset); }
|
271
|
+
void put_int16(int16_t value, size_t offset) { this->put(value, offset); }
|
272
|
+
void put_int24(int32_t value, size_t offset) { this->put_uint32_(value, offset, 3); }
|
273
|
+
void put_int32(int32_t value, size_t offset) { this->put(value, offset); }
|
274
|
+
void put_int64(int64_t value, size_t offset) { this->put(value, offset); }
|
275
|
+
// Extra put functions
|
276
|
+
void put_float(float value, size_t offset) { this->put(value, offset); }
|
277
|
+
void put_double(double value, size_t offset) { this->put(value, offset); }
|
278
|
+
void put_bool(bool value, size_t offset) { this->put_uint8(value, offset); }
|
279
|
+
void put(const std::vector<uint8_t> &value, size_t offset) {
|
280
|
+
std::copy(value.begin(), value.end(), this->data_.begin() + offset);
|
281
|
+
}
|
282
|
+
void put_vector(const std::vector<uint8_t> &value, size_t offset) { this->put(value, offset); }
|
283
|
+
void put(const std::vector<uint8_t> &value) {
|
284
|
+
this->put_vector(value, this->position_);
|
285
|
+
this->position_ += value.size();
|
286
|
+
}
|
287
|
+
void put_vector(const std::vector<uint8_t> &value) { this->put(value); }
|
288
|
+
|
289
|
+
// Getters
|
290
|
+
|
291
|
+
inline size_t get_capacity() const { return this->data_.size(); }
|
292
|
+
inline size_t get_position() const { return this->position_; }
|
293
|
+
inline size_t get_limit() const { return this->limit_; }
|
294
|
+
inline size_t get_remaining() const { return this->get_limit() - this->get_position(); }
|
295
|
+
inline Endian get_endianness() const { return this->endianness_; }
|
296
|
+
inline void mark() { this->mark_ = this->position_; }
|
297
|
+
inline void big_endian() { this->endianness_ = BIG; }
|
298
|
+
inline void little_endian() { this->endianness_ = LITTLE; }
|
299
|
+
// retrieve a pointer to the underlying data.
|
300
|
+
std::vector<uint8_t> get_data() { return this->data_; };
|
301
|
+
|
302
|
+
void get_bytes(void *dest, size_t length) {
|
303
|
+
std::copy(this->data_.begin() + this->position_, this->data_.begin() + this->position_ + length, (uint8_t *) dest);
|
304
|
+
this->position_ += length;
|
305
|
+
}
|
306
|
+
|
307
|
+
void get_bytes(void *dest, size_t length, size_t offset) {
|
308
|
+
std::copy(this->data_.begin() + offset, this->data_.begin() + offset + length, (uint8_t *) dest);
|
309
|
+
}
|
310
|
+
|
311
|
+
void rewind() { this->position_ = 0; }
|
312
|
+
void reset() { this->position_ = this->mark_; }
|
313
|
+
|
314
|
+
void set_limit(size_t limit) { this->limit_ = limit; }
|
315
|
+
void set_position(size_t position) { this->position_ = position; }
|
316
|
+
void clear() {
|
317
|
+
this->limit_ = this->get_capacity();
|
318
|
+
this->position_ = 0;
|
319
|
+
}
|
320
|
+
void flip() {
|
321
|
+
this->limit_ = this->position_;
|
322
|
+
this->position_ = 0;
|
323
|
+
}
|
324
|
+
|
325
|
+
protected:
|
326
|
+
uint64_t get_uint64_(size_t offset, size_t length) const {
|
327
|
+
uint64_t value = 0;
|
328
|
+
if (this->endianness_ == LITTLE) {
|
329
|
+
offset += length;
|
330
|
+
while (length-- != 0) {
|
331
|
+
value <<= 8;
|
332
|
+
value |= this->data_[--offset];
|
333
|
+
}
|
334
|
+
} else {
|
335
|
+
while (length-- != 0) {
|
336
|
+
value <<= 8;
|
337
|
+
value |= this->data_[offset++];
|
338
|
+
}
|
339
|
+
}
|
340
|
+
return value;
|
341
|
+
}
|
342
|
+
|
343
|
+
uint64_t get_uint64_(size_t length) {
|
344
|
+
auto result = this->get_uint64_(this->position_, length);
|
345
|
+
this->position_ += length;
|
346
|
+
return result;
|
347
|
+
}
|
348
|
+
uint32_t get_uint32_(size_t offset, size_t length) const {
|
349
|
+
uint32_t value = 0;
|
350
|
+
if (this->endianness_ == LITTLE) {
|
351
|
+
offset += length;
|
352
|
+
while (length-- != 0) {
|
353
|
+
value <<= 8;
|
354
|
+
value |= this->data_[--offset];
|
355
|
+
}
|
356
|
+
} else {
|
357
|
+
while (length-- != 0) {
|
358
|
+
value <<= 8;
|
359
|
+
value |= this->data_[offset++];
|
360
|
+
}
|
361
|
+
}
|
362
|
+
return value;
|
363
|
+
}
|
364
|
+
|
365
|
+
uint32_t get_uint32_(size_t length) {
|
366
|
+
auto result = this->get_uint32_(this->position_, length);
|
367
|
+
this->position_ += length;
|
368
|
+
return result;
|
369
|
+
}
|
370
|
+
|
371
|
+
/// Putters
|
372
|
+
|
373
|
+
void put_uint64_(uint64_t value, size_t length) {
|
374
|
+
this->put_uint64_(value, this->position_, length);
|
375
|
+
this->position_ += length;
|
376
|
+
}
|
377
|
+
void put_uint32_(uint32_t value, size_t length) {
|
378
|
+
this->put_uint32_(value, this->position_, length);
|
379
|
+
this->position_ += length;
|
380
|
+
}
|
381
|
+
|
382
|
+
void put_uint64_(uint64_t value, size_t offset, size_t length) {
|
383
|
+
if (this->endianness_ == LITTLE) {
|
384
|
+
while (length-- != 0) {
|
385
|
+
this->data_[offset++] = static_cast<uint8_t>(value);
|
386
|
+
value >>= 8;
|
387
|
+
}
|
388
|
+
} else {
|
389
|
+
offset += length;
|
390
|
+
while (length-- != 0) {
|
391
|
+
this->data_[--offset] = static_cast<uint8_t>(value);
|
392
|
+
value >>= 8;
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
void put_uint32_(uint32_t value, size_t offset, size_t length) {
|
398
|
+
if (this->endianness_ == LITTLE) {
|
399
|
+
while (length-- != 0) {
|
400
|
+
this->data_[offset++] = static_cast<uint8_t>(value);
|
401
|
+
value >>= 8;
|
402
|
+
}
|
403
|
+
} else {
|
404
|
+
offset += length;
|
405
|
+
while (length-- != 0) {
|
406
|
+
this->data_[--offset] = static_cast<uint8_t>(value);
|
407
|
+
value >>= 8;
|
408
|
+
}
|
409
|
+
}
|
410
|
+
}
|
411
|
+
ByteBuffer(std::vector<uint8_t> const &data) : data_(data), limit_(data.size()) {}
|
412
|
+
|
413
|
+
std::vector<uint8_t> data_;
|
414
|
+
Endian endianness_{LITTLE};
|
415
|
+
size_t position_{0};
|
416
|
+
size_t mark_{0};
|
417
|
+
size_t limit_{0};
|
418
|
+
};
|
419
|
+
|
420
|
+
} // namespace bytebuffer
|
421
|
+
} // namespace esphome
|
@@ -119,10 +119,21 @@ visual_temperature = cv.float_with_unit(
|
|
119
119
|
)
|
120
120
|
|
121
121
|
|
122
|
-
|
122
|
+
VISUAL_TEMPERATURE_STEP_SCHEMA = cv.Schema(
|
123
|
+
{
|
124
|
+
cv.Required(CONF_TARGET_TEMPERATURE): visual_temperature,
|
125
|
+
cv.Required(CONF_CURRENT_TEMPERATURE): visual_temperature,
|
126
|
+
}
|
127
|
+
)
|
128
|
+
|
129
|
+
|
130
|
+
def visual_temperature_step(value):
|
131
|
+
|
132
|
+
# Allow defining target/current temperature steps separately
|
123
133
|
if isinstance(value, dict):
|
124
|
-
return value
|
134
|
+
return VISUAL_TEMPERATURE_STEP_SCHEMA(value)
|
125
135
|
|
136
|
+
# Otherwise, use the single value for both properties
|
126
137
|
value = visual_temperature(value)
|
127
138
|
return VISUAL_TEMPERATURE_STEP_SCHEMA(
|
128
139
|
{
|
@@ -141,16 +152,6 @@ ControlTrigger = climate_ns.class_(
|
|
141
152
|
"ControlTrigger", automation.Trigger.template(ClimateCall.operator("ref"))
|
142
153
|
)
|
143
154
|
|
144
|
-
VISUAL_TEMPERATURE_STEP_SCHEMA = cv.Any(
|
145
|
-
single_visual_temperature,
|
146
|
-
cv.Schema(
|
147
|
-
{
|
148
|
-
cv.Required(CONF_TARGET_TEMPERATURE): visual_temperature,
|
149
|
-
cv.Required(CONF_CURRENT_TEMPERATURE): visual_temperature,
|
150
|
-
}
|
151
|
-
),
|
152
|
-
)
|
153
|
-
|
154
155
|
CLIMATE_SCHEMA = (
|
155
156
|
cv.ENTITY_BASE_SCHEMA.extend(web_server.WEBSERVER_SORTING_SCHEMA)
|
156
157
|
.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA)
|
@@ -162,7 +163,7 @@ CLIMATE_SCHEMA = (
|
|
162
163
|
{
|
163
164
|
cv.Optional(CONF_MIN_TEMPERATURE): cv.temperature,
|
164
165
|
cv.Optional(CONF_MAX_TEMPERATURE): cv.temperature,
|
165
|
-
cv.Optional(CONF_TEMPERATURE_STEP):
|
166
|
+
cv.Optional(CONF_TEMPERATURE_STEP): visual_temperature_step,
|
166
167
|
cv.Optional(CONF_MIN_HUMIDITY): cv.percentage_int,
|
167
168
|
cv.Optional(CONF_MAX_HUMIDITY): cv.percentage_int,
|
168
169
|
}
|
@@ -70,8 +70,6 @@ def _validate_time_present(config):
|
|
70
70
|
|
71
71
|
|
72
72
|
_DATETIME_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
|
73
|
-
web_server.WEBSERVER_SORTING_SCHEMA,
|
74
|
-
cv.MQTT_COMMAND_COMPONENT_SCHEMA,
|
75
73
|
cv.Schema(
|
76
74
|
{
|
77
75
|
cv.Optional(CONF_ON_VALUE): automation.validate_automation(
|
@@ -81,7 +79,9 @@ _DATETIME_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
|
|
81
79
|
),
|
82
80
|
cv.Optional(CONF_TIME_ID): cv.use_id(time.RealTimeClock),
|
83
81
|
}
|
84
|
-
)
|
82
|
+
)
|
83
|
+
.extend(web_server.WEBSERVER_SORTING_SCHEMA)
|
84
|
+
.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA)
|
85
85
|
).add_extra(_validate_time_present)
|
86
86
|
|
87
87
|
|
@@ -36,7 +36,8 @@ std::string DebugComponent::get_reset_reason_() {
|
|
36
36
|
break;
|
37
37
|
#if defined(USE_ESP32_VARIANT_ESP32)
|
38
38
|
case SW_RESET:
|
39
|
-
#elif defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) ||
|
39
|
+
#elif defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) || \
|
40
|
+
defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32C6)
|
40
41
|
case RTC_SW_SYS_RESET:
|
41
42
|
#endif
|
42
43
|
reset_reason = "Software Reset Digital Core";
|
@@ -72,14 +73,16 @@ std::string DebugComponent::get_reset_reason_() {
|
|
72
73
|
case TGWDT_CPU_RESET:
|
73
74
|
reset_reason = "Timer Group Reset CPU";
|
74
75
|
break;
|
75
|
-
#elif defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) ||
|
76
|
+
#elif defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) || \
|
77
|
+
defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32C6)
|
76
78
|
case TG0WDT_CPU_RESET:
|
77
79
|
reset_reason = "Timer Group 0 Reset CPU";
|
78
80
|
break;
|
79
81
|
#endif
|
80
82
|
#if defined(USE_ESP32_VARIANT_ESP32)
|
81
83
|
case SW_CPU_RESET:
|
82
|
-
#elif defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) ||
|
84
|
+
#elif defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) || \
|
85
|
+
defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32C6)
|
83
86
|
case RTC_SW_CPU_RESET:
|
84
87
|
#endif
|
85
88
|
reset_reason = "Software Reset CPU";
|
@@ -98,27 +101,32 @@ std::string DebugComponent::get_reset_reason_() {
|
|
98
101
|
case RTCWDT_RTC_RESET:
|
99
102
|
reset_reason = "RTC Watch Dog Reset Digital Core And RTC Module";
|
100
103
|
break;
|
101
|
-
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
|
104
|
+
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3) || \
|
105
|
+
defined(USE_ESP32_VARIANT_ESP32C6)
|
102
106
|
case TG1WDT_CPU_RESET:
|
103
107
|
reset_reason = "Timer Group 1 Reset CPU";
|
104
108
|
break;
|
105
109
|
case SUPER_WDT_RESET:
|
106
110
|
reset_reason = "Super Watchdog Reset Digital Core And RTC Module";
|
107
111
|
break;
|
108
|
-
case GLITCH_RTC_RESET:
|
109
|
-
reset_reason = "Glitch Reset Digital Core And RTC Module";
|
110
|
-
break;
|
111
112
|
case EFUSE_RESET:
|
112
113
|
reset_reason = "eFuse Reset Digital Core";
|
113
114
|
break;
|
114
115
|
#endif
|
115
|
-
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S3)
|
116
|
+
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
|
117
|
+
case GLITCH_RTC_RESET:
|
118
|
+
reset_reason = "Glitch Reset Digital Core And RTC Module";
|
119
|
+
break;
|
120
|
+
#endif
|
121
|
+
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32C6)
|
116
122
|
case USB_UART_CHIP_RESET:
|
117
123
|
reset_reason = "USB UART Reset Digital Core";
|
118
124
|
break;
|
119
125
|
case USB_JTAG_CHIP_RESET:
|
120
126
|
reset_reason = "USB JTAG Reset Digital Core";
|
121
127
|
break;
|
128
|
+
#endif
|
129
|
+
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S3)
|
122
130
|
case POWER_GLITCH_RESET:
|
123
131
|
reset_reason = "Power Glitch Reset Digital Core And RTC Module";
|
124
132
|
break;
|