esphome 2024.8.2__py3-none-any.whl → 2024.9.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 +6 -2
- esphome/components/api/api_connection.cpp +53 -0
- esphome/components/api/api_connection.h +4 -0
- esphome/components/api/api_pb2.cpp +280 -0
- esphome/components/api/api_pb2.h +91 -0
- esphome/components/api/api_pb2_service.cpp +85 -0
- esphome/components/api/api_pb2_service.h +28 -0
- esphome/components/async_tcp/__init__.py +3 -3
- esphome/components/atm90e26/sensor.py +10 -10
- esphome/components/atm90e32/sensor.py +1 -1
- esphome/components/bl0906/__init__.py +1 -0
- esphome/components/bl0906/bl0906.cpp +238 -0
- esphome/components/bl0906/bl0906.h +96 -0
- esphome/components/bl0906/const.py +4 -0
- esphome/components/bl0906/constants.h +122 -0
- esphome/components/bl0906/sensor.py +184 -0
- esphome/components/bl0942/__init__.py +1 -1
- esphome/components/bl0942/bl0942.cpp +127 -34
- esphome/components/bl0942/bl0942.h +87 -3
- esphome/components/bl0942/sensor.py +46 -8
- esphome/components/ble_client/__init__.py +1 -3
- esphome/components/ble_presence/binary_sensor.py +2 -2
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
- esphome/components/bmp280/sensor.py +2 -93
- esphome/components/bmp280_base/__init__.py +88 -0
- esphome/components/{bmp280/bmp280.cpp → bmp280_base/bmp280_base.cpp} +11 -4
- esphome/components/{bmp280/bmp280.h → bmp280_base/bmp280_base.h} +9 -5
- esphome/components/bmp280_i2c/__init__.py +0 -0
- esphome/components/bmp280_i2c/bmp280_i2c.cpp +27 -0
- esphome/components/bmp280_i2c/bmp280_i2c.h +22 -0
- esphome/components/bmp280_i2c/sensor.py +22 -0
- esphome/components/bmp280_spi/__init__.py +0 -0
- esphome/components/bmp280_spi/bmp280_spi.cpp +65 -0
- esphome/components/bmp280_spi/bmp280_spi.h +20 -0
- esphome/components/bmp280_spi/sensor.py +22 -0
- esphome/components/captive_portal/captive_portal.cpp +2 -0
- esphome/components/captive_portal/captive_portal.h +3 -1
- esphome/components/ch422g/__init__.py +67 -0
- esphome/components/ch422g/ch422g.cpp +122 -0
- esphome/components/ch422g/ch422g.h +70 -0
- esphome/components/debug/debug_esp32.cpp +3 -1
- esphome/components/display/__init__.py +5 -4
- esphome/components/dsmr/dsmr.cpp +6 -0
- esphome/components/dsmr/dsmr.h +6 -0
- esphome/components/dsmr/text_sensor.py +7 -2
- esphome/components/e131/e131.cpp +2 -0
- esphome/components/e131/e131.h +3 -1
- esphome/components/e131/e131_addressable_light_effect.cpp +2 -0
- esphome/components/e131/e131_addressable_light_effect.h +2 -1
- esphome/components/e131/e131_packet.cpp +2 -0
- esphome/components/esp32_ble/ble_uuid.cpp +7 -0
- esphome/components/esp32_ble/ble_uuid.h +1 -0
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -9
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +3 -3
- esphome/components/esp32_camera/__init__.py +4 -0
- esphome/components/esp32_camera/esp32_camera.cpp +9 -1
- esphome/components/esp32_camera/esp32_camera.h +3 -0
- esphome/components/esp32_can/canbus.py +18 -7
- esphome/components/esp32_can/esp32_can.cpp +8 -0
- esphome/components/esp32_can/esp32_can.h +4 -0
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +14 -2
- esphome/components/esp32_rmt_led_strip/led_strip.h +3 -2
- esphome/components/esp32_rmt_led_strip/light.py +21 -4
- esphome/components/esphome/ota/ota_esphome.cpp +2 -1
- esphome/components/esphome/ota/ota_esphome.h +2 -0
- esphome/components/font/__init__.py +11 -22
- esphome/components/font/font.cpp +3 -2
- esphome/components/font/font.h +12 -3
- esphome/components/gree/climate.py +2 -1
- esphome/components/gree/gree.cpp +54 -3
- esphome/components/gree/gree.h +10 -2
- esphome/components/gt911/touchscreen/__init__.py +6 -4
- esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +17 -0
- esphome/components/gt911/touchscreen/gt911_touchscreen.h +2 -0
- esphome/components/hmac_md5/__init__.py +2 -0
- esphome/components/hmac_md5/hmac_md5.cpp +56 -0
- esphome/components/hmac_md5/hmac_md5.h +48 -0
- esphome/components/homeassistant/__init__.py +13 -0
- esphome/components/homeassistant/switch/__init__.py +15 -2
- esphome/components/homeassistant/switch/homeassistant_switch.cpp +2 -2
- esphome/components/i2s_audio/__init__.py +88 -9
- esphome/components/i2s_audio/i2s_audio.h +20 -2
- esphome/components/i2s_audio/media_player/__init__.py +8 -4
- esphome/components/i2s_audio/media_player/i2s_audio_media_player.h +1 -1
- esphome/components/i2s_audio/microphone/__init__.py +19 -51
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +18 -15
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.h +0 -12
- esphome/components/i2s_audio/speaker/__init__.py +39 -27
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +49 -37
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +3 -4
- esphome/components/ili9xxx/display.py +16 -17
- esphome/components/ili9xxx/ili9xxx_display.cpp +1 -1
- esphome/components/ili9xxx/ili9xxx_display.h +18 -18
- esphome/components/ili9xxx/ili9xxx_init.h +0 -3
- esphome/components/improv_serial/improv_serial_component.cpp +2 -1
- esphome/components/improv_serial/improv_serial_component.h +2 -1
- esphome/components/ledc/ledc_output.cpp +11 -7
- esphome/components/libretiny/__init__.py +8 -13
- esphome/components/ltr501/__init__.py +1 -0
- esphome/components/ltr501/ltr501.cpp +542 -0
- esphome/components/ltr501/ltr501.h +184 -0
- esphome/components/ltr501/ltr_definitions_501.h +260 -0
- esphome/components/ltr501/sensor.py +274 -0
- esphome/components/ltr_als_ps/sensor.py +2 -2
- esphome/components/lvgl/__init__.py +19 -16
- esphome/components/lvgl/automation.py +90 -9
- esphome/components/lvgl/defines.py +29 -2
- esphome/components/lvgl/gradient.py +61 -0
- esphome/components/lvgl/lv_validation.py +45 -27
- esphome/components/lvgl/lvcode.py +8 -3
- esphome/components/lvgl/lvgl_esphome.cpp +54 -0
- esphome/components/lvgl/lvgl_esphome.h +9 -3
- esphome/components/lvgl/number/__init__.py +1 -0
- esphome/components/lvgl/number/lvgl_number.h +3 -1
- esphome/components/lvgl/schemas.py +16 -11
- esphome/components/lvgl/select/__init__.py +1 -0
- esphome/components/lvgl/select/lvgl_select.h +3 -1
- esphome/components/lvgl/switch/__init__.py +2 -1
- esphome/components/lvgl/switch/lvgl_switch.h +3 -1
- esphome/components/lvgl/text/__init__.py +1 -0
- esphome/components/lvgl/text/lvgl_text.h +3 -1
- esphome/components/lvgl/trigger.py +3 -2
- esphome/components/lvgl/types.py +2 -1
- esphome/components/lvgl/widgets/__init__.py +23 -8
- esphome/components/lvgl/widgets/arc.py +5 -1
- esphome/components/lvgl/widgets/buttonmatrix.py +5 -1
- esphome/components/lvgl/widgets/checkbox.py +8 -3
- esphome/components/lvgl/widgets/meter.py +8 -1
- esphome/components/lvgl/widgets/msgbox.py +26 -15
- esphome/components/lvgl/widgets/page.py +51 -7
- esphome/components/lvgl/widgets/tileview.py +2 -8
- esphome/components/max31856/max31856.cpp +12 -1
- esphome/components/max31856/max31856.h +5 -2
- esphome/components/max31856/sensor.py +20 -0
- esphome/components/mcp9600/sensor.py +2 -2
- esphome/components/mdns/__init__.py +6 -6
- esphome/components/media_player/media_player.h +16 -0
- esphome/components/micro_wake_word/__init__.py +2 -25
- esphome/components/microphone/microphone.h +1 -1
- esphome/components/mics_4514/mics_4514.cpp +26 -36
- esphome/components/modbus_controller/__init__.py +6 -0
- esphome/components/modbus_controller/const.py +2 -0
- esphome/components/modbus_controller/modbus_controller.cpp +30 -27
- esphome/components/modbus_controller/modbus_controller.h +22 -4
- esphome/components/network/__init__.py +11 -8
- esphome/components/pipsolar/pipsolar.cpp +3 -0
- esphome/components/pipsolar/pipsolar.h +1 -0
- esphome/components/pipsolar/switch/__init__.py +2 -0
- esphome/components/prometheus/prometheus_handler.cpp +2 -0
- esphome/components/prometheus/prometheus_handler.h +3 -1
- esphome/components/rp2040/__init__.py +7 -8
- esphome/components/rpi_dpi_rgb/display.py +20 -17
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.cpp +36 -6
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.h +4 -0
- esphome/components/socket/socket.cpp +2 -0
- esphome/components/socket/socket.h +2 -0
- esphome/components/speaker/speaker.h +1 -1
- esphome/components/st7701s/display.py +35 -37
- esphome/components/st7701s/st7701s.cpp +11 -6
- esphome/components/st7701s/st7701s.h +1 -0
- esphome/components/statsd/__init__.py +65 -0
- esphome/components/statsd/statsd.cpp +156 -0
- esphome/components/statsd/statsd.h +86 -0
- esphome/components/tuya/__init__.py +1 -0
- esphome/components/tuya/number/__init__.py +39 -2
- esphome/components/tuya/number/tuya_number.cpp +58 -2
- esphome/components/tuya/number/tuya_number.h +12 -3
- esphome/components/udp/__init__.py +158 -0
- esphome/components/udp/binary_sensor.py +27 -0
- esphome/components/udp/sensor.py +27 -0
- esphome/components/udp/udp_component.cpp +616 -0
- esphome/components/udp/udp_component.h +158 -0
- esphome/components/uponor_smatrix/uponor_smatrix.cpp +4 -6
- esphome/components/uponor_smatrix/uponor_smatrix.h +0 -1
- esphome/components/veml7700/sensor.py +2 -2
- esphome/components/voice_assistant/__init__.py +6 -0
- esphome/components/voice_assistant/voice_assistant.cpp +24 -2
- esphome/components/voice_assistant/voice_assistant.h +20 -0
- esphome/components/web_server/__init__.py +11 -11
- esphome/components/web_server/list_entities.cpp +2 -0
- esphome/components/web_server/list_entities.h +3 -1
- esphome/components/web_server/web_server.cpp +2 -1
- esphome/components/web_server/web_server.h +2 -0
- esphome/components/web_server_base/web_server_base.cpp +2 -0
- esphome/components/web_server_base/web_server_base.h +3 -1
- esphome/components/wifi/wifi_component_libretiny.cpp +15 -1
- esphome/components/wireguard/__init__.py +9 -6
- esphome/components/wireguard/wireguard.cpp +2 -1
- esphome/components/wireguard/wireguard.h +3 -1
- esphome/config_validation.py +8 -0
- esphome/const.py +8 -1
- esphome/core/bytebuffer.cpp +117 -84
- esphome/core/bytebuffer.h +69 -21
- esphome/core/config.py +0 -3
- esphome/core/defines.h +2 -0
- esphome/core/ring_buffer.cpp +13 -2
- esphome/core/ring_buffer.h +56 -0
- esphome/external_files.py +5 -3
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/METADATA +1 -1
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/RECORD +204 -169
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/LICENSE +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/WHEEL +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/top_level.txt +0 -0
@@ -18,11 +18,11 @@ void ModbusController::setup() { this->create_register_ranges_(); }
|
|
18
18
|
bool ModbusController::send_next_command_() {
|
19
19
|
uint32_t last_send = millis() - this->last_command_timestamp_;
|
20
20
|
|
21
|
-
if ((last_send > this->command_throttle_) && !waiting_for_response() && !command_queue_.empty()) {
|
22
|
-
auto &command = command_queue_.front();
|
21
|
+
if ((last_send > this->command_throttle_) && !waiting_for_response() && !this->command_queue_.empty()) {
|
22
|
+
auto &command = this->command_queue_.front();
|
23
23
|
|
24
24
|
// remove from queue if command was sent too often
|
25
|
-
if (command->
|
25
|
+
if (!command->should_retry(this->max_cmd_retries_)) {
|
26
26
|
if (!this->module_offline_) {
|
27
27
|
ESP_LOGW(TAG, "Modbus device=%d set offline", this->address_);
|
28
28
|
|
@@ -34,11 +34,9 @@ bool ModbusController::send_next_command_() {
|
|
34
34
|
}
|
35
35
|
}
|
36
36
|
this->module_offline_ = true;
|
37
|
-
ESP_LOGD(
|
38
|
-
|
39
|
-
|
40
|
-
this->address_, command->register_address, command->send_countdown);
|
41
|
-
command_queue_.pop_front();
|
37
|
+
ESP_LOGD(TAG, "Modbus command to device=%d register=0x%02X no response received - removed from send queue",
|
38
|
+
this->address_, command->register_address);
|
39
|
+
this->command_queue_.pop_front();
|
42
40
|
} else {
|
43
41
|
ESP_LOGV(TAG, "Sending next modbus command to device %d register 0x%02X count %d", this->address_,
|
44
42
|
command->register_address, command->register_count);
|
@@ -50,11 +48,11 @@ bool ModbusController::send_next_command_() {
|
|
50
48
|
|
51
49
|
// remove from queue if no handler is defined
|
52
50
|
if (!command->on_data_func) {
|
53
|
-
command_queue_.pop_front();
|
51
|
+
this->command_queue_.pop_front();
|
54
52
|
}
|
55
53
|
}
|
56
54
|
}
|
57
|
-
return (!command_queue_.empty());
|
55
|
+
return (!this->command_queue_.empty());
|
58
56
|
}
|
59
57
|
|
60
58
|
// Queue incoming response
|
@@ -77,7 +75,7 @@ void ModbusController::on_modbus_data(const std::vector<uint8_t> &data) {
|
|
77
75
|
current_command->payload = data;
|
78
76
|
this->incoming_queue_.push(std::move(current_command));
|
79
77
|
ESP_LOGV(TAG, "Modbus response queued");
|
80
|
-
command_queue_.pop_front();
|
78
|
+
this->command_queue_.pop_front();
|
81
79
|
}
|
82
80
|
}
|
83
81
|
|
@@ -99,7 +97,7 @@ void ModbusController::on_modbus_error(uint8_t function_code, uint8_t exception_
|
|
99
97
|
"payload size=%zu",
|
100
98
|
function_code, current_command->register_address, current_command->register_count,
|
101
99
|
current_command->payload.size());
|
102
|
-
command_queue_.pop_front();
|
100
|
+
this->command_queue_.pop_front();
|
103
101
|
}
|
104
102
|
}
|
105
103
|
|
@@ -175,19 +173,21 @@ void ModbusController::on_register_data(ModbusRegisterType register_type, uint16
|
|
175
173
|
}
|
176
174
|
|
177
175
|
void ModbusController::queue_command(const ModbusCommandItem &command) {
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
176
|
+
if (!this->allow_duplicate_commands_) {
|
177
|
+
// check if this command is already qeued.
|
178
|
+
// not very effective but the queue is never really large
|
179
|
+
for (auto &item : this->command_queue_) {
|
180
|
+
if (item->is_equal(command)) {
|
181
|
+
ESP_LOGW(TAG, "Duplicate modbus command found: type=0x%x address=%u count=%u",
|
182
|
+
static_cast<uint8_t>(command.register_type), command.register_address, command.register_count);
|
183
|
+
// update the payload of the queued command
|
184
|
+
// replaces a previous command
|
185
|
+
item->payload = command.payload;
|
186
|
+
return;
|
187
|
+
}
|
188
188
|
}
|
189
189
|
}
|
190
|
-
command_queue_.push_back(make_unique<ModbusCommandItem>(command));
|
190
|
+
this->command_queue_.push_back(make_unique<ModbusCommandItem>(command));
|
191
191
|
}
|
192
192
|
|
193
193
|
void ModbusController::update_range_(RegisterRange &r) {
|
@@ -222,8 +222,8 @@ void ModbusController::update_range_(RegisterRange &r) {
|
|
222
222
|
// Once we get a response to the command it is removed from the queue and the next command is send
|
223
223
|
//
|
224
224
|
void ModbusController::update() {
|
225
|
-
if (!command_queue_.empty()) {
|
226
|
-
ESP_LOGV(TAG, "%zu modbus commands already in queue", command_queue_.size());
|
225
|
+
if (!this->command_queue_.empty()) {
|
226
|
+
ESP_LOGV(TAG, "%zu modbus commands already in queue", this->command_queue_.size());
|
227
227
|
} else {
|
228
228
|
ESP_LOGV(TAG, "Updating modbus component");
|
229
229
|
}
|
@@ -344,6 +344,8 @@ size_t ModbusController::create_register_ranges_() {
|
|
344
344
|
void ModbusController::dump_config() {
|
345
345
|
ESP_LOGCONFIG(TAG, "ModbusController:");
|
346
346
|
ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->address_);
|
347
|
+
ESP_LOGCONFIG(TAG, " Max Command Retries: %d", this->max_cmd_retries_);
|
348
|
+
ESP_LOGCONFIG(TAG, " Offline Skip Updates: %d", this->offline_skip_updates_);
|
347
349
|
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
|
348
350
|
ESP_LOGCONFIG(TAG, "sensormap");
|
349
351
|
for (auto &it : sensorset_) {
|
@@ -558,8 +560,9 @@ bool ModbusCommandItem::send() {
|
|
558
560
|
} else {
|
559
561
|
modbusdevice->send_raw(this->payload);
|
560
562
|
}
|
561
|
-
|
562
|
-
|
563
|
+
this->send_count_++;
|
564
|
+
ESP_LOGV(TAG, "Command sent %d 0x%X %d send_count: %d", uint8_t(this->function_code), this->register_address,
|
565
|
+
this->register_count, this->send_count_);
|
563
566
|
return true;
|
564
567
|
}
|
565
568
|
|
@@ -312,7 +312,6 @@ struct RegisterRange {
|
|
312
312
|
class ModbusCommandItem {
|
313
313
|
public:
|
314
314
|
static const size_t MAX_PAYLOAD_BYTES = 240;
|
315
|
-
static const uint8_t MAX_SEND_REPEATS = 5;
|
316
315
|
ModbusController *modbusdevice;
|
317
316
|
uint16_t register_address;
|
318
317
|
uint16_t register_count;
|
@@ -322,9 +321,9 @@ class ModbusCommandItem {
|
|
322
321
|
on_data_func;
|
323
322
|
std::vector<uint8_t> payload = {};
|
324
323
|
bool send();
|
325
|
-
|
326
|
-
|
327
|
-
|
324
|
+
/// Check if the command should be retried based on the max_retries parameter
|
325
|
+
bool should_retry(uint8_t max_retries) { return this->send_count_ <= max_retries; };
|
326
|
+
|
328
327
|
/// factory methods
|
329
328
|
/** Create modbus read command
|
330
329
|
* Function code 02-04
|
@@ -413,6 +412,11 @@ class ModbusCommandItem {
|
|
413
412
|
&&handler = nullptr);
|
414
413
|
|
415
414
|
bool is_equal(const ModbusCommandItem &other);
|
415
|
+
|
416
|
+
protected:
|
417
|
+
// wrong commands (esp. custom commands) can block the send queue, limit the number of repeats.
|
418
|
+
/// How many times this command has been sent
|
419
|
+
uint8_t send_count_{0};
|
416
420
|
};
|
417
421
|
|
418
422
|
/** Modbus controller class.
|
@@ -448,6 +452,12 @@ class ModbusController : public PollingComponent, public modbus::ModbusDevice {
|
|
448
452
|
/// incoming queue
|
449
453
|
void on_write_register_response(ModbusRegisterType register_type, uint16_t start_address,
|
450
454
|
const std::vector<uint8_t> &data);
|
455
|
+
/// Allow a duplicate command to be sent
|
456
|
+
void set_allow_duplicate_commands(bool allow_duplicate_commands) {
|
457
|
+
this->allow_duplicate_commands_ = allow_duplicate_commands;
|
458
|
+
}
|
459
|
+
/// get if a duplicate command can be sent
|
460
|
+
bool get_allow_duplicate_commands() { return this->allow_duplicate_commands_; }
|
451
461
|
/// called by esphome generated code to set the command_throttle period
|
452
462
|
void set_command_throttle(uint16_t command_throttle) { this->command_throttle_ = command_throttle; }
|
453
463
|
/// called by esphome generated code to set the offline_skip_updates
|
@@ -458,6 +468,10 @@ class ModbusController : public PollingComponent, public modbus::ModbusDevice {
|
|
458
468
|
bool get_module_offline() { return module_offline_; }
|
459
469
|
/// Set callback for commands
|
460
470
|
void add_on_command_sent_callback(std::function<void(int, int)> &&callback);
|
471
|
+
/// called by esphome generated code to set the max_cmd_retries.
|
472
|
+
void set_max_cmd_retries(uint8_t max_cmd_retries) { this->max_cmd_retries_ = max_cmd_retries; }
|
473
|
+
/// get how many times a command will be (re)sent if no response is received
|
474
|
+
uint8_t get_max_cmd_retries() { return this->max_cmd_retries_; }
|
461
475
|
|
462
476
|
protected:
|
463
477
|
/// parse sensormap_ and create range of sequential addresses
|
@@ -482,6 +496,8 @@ class ModbusController : public PollingComponent, public modbus::ModbusDevice {
|
|
482
496
|
std::list<std::unique_ptr<ModbusCommandItem>> command_queue_;
|
483
497
|
/// modbus response data waiting to get processed
|
484
498
|
std::queue<std::unique_ptr<ModbusCommandItem>> incoming_queue_;
|
499
|
+
/// if duplicate commands can be sent
|
500
|
+
bool allow_duplicate_commands_;
|
485
501
|
/// when was the last send operation
|
486
502
|
uint32_t last_command_timestamp_;
|
487
503
|
/// min time in ms between sending modbus commands
|
@@ -490,6 +506,8 @@ class ModbusController : public PollingComponent, public modbus::ModbusDevice {
|
|
490
506
|
bool module_offline_;
|
491
507
|
/// how many updates to skip if module is offline
|
492
508
|
uint16_t offline_skip_updates_;
|
509
|
+
/// How many times we will retry a command if we get no response
|
510
|
+
uint8_t max_cmd_retries_{4};
|
493
511
|
CallbackManager<void(int, int)> command_sent_callback_{};
|
494
512
|
};
|
495
513
|
|
@@ -1,13 +1,7 @@
|
|
1
1
|
import esphome.codegen as cg
|
2
2
|
from esphome.components.esp32 import add_idf_sdkconfig_option
|
3
3
|
import esphome.config_validation as cv
|
4
|
-
from esphome.const import
|
5
|
-
CONF_ENABLE_IPV6,
|
6
|
-
CONF_MIN_IPV6_ADDR_COUNT,
|
7
|
-
PLATFORM_ESP32,
|
8
|
-
PLATFORM_ESP8266,
|
9
|
-
PLATFORM_RP2040,
|
10
|
-
)
|
4
|
+
from esphome.const import CONF_ENABLE_IPV6, CONF_MIN_IPV6_ADDR_COUNT
|
11
5
|
from esphome.core import CORE
|
12
6
|
|
13
7
|
CODEOWNERS = ["@esphome/core"]
|
@@ -23,10 +17,17 @@ CONFIG_SCHEMA = cv.Schema(
|
|
23
17
|
esp8266=False,
|
24
18
|
esp32=False,
|
25
19
|
rp2040=False,
|
20
|
+
bk72xx=False,
|
26
21
|
): cv.All(
|
27
22
|
cv.boolean,
|
28
23
|
cv.Any(
|
29
|
-
cv.
|
24
|
+
cv.require_framework_version(
|
25
|
+
esp_idf=cv.Version(0, 0, 0),
|
26
|
+
esp32_arduino=cv.Version(0, 0, 0),
|
27
|
+
esp8266_arduino=cv.Version(0, 0, 0),
|
28
|
+
rp2040_arduino=cv.Version(0, 0, 0),
|
29
|
+
bk72xx_libretiny=cv.Version(1, 7, 0),
|
30
|
+
),
|
30
31
|
cv.boolean_false,
|
31
32
|
),
|
32
33
|
),
|
@@ -53,3 +54,5 @@ async def to_code(config):
|
|
53
54
|
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6")
|
54
55
|
if CORE.is_esp8266:
|
55
56
|
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY")
|
57
|
+
if CORE.is_bk72xx:
|
58
|
+
cg.add_build_flag("-DCONFIG_IPV6")
|
@@ -136,6 +136,9 @@ void Pipsolar::loop() {
|
|
136
136
|
if (this->output_source_priority_battery_switch_) {
|
137
137
|
this->output_source_priority_battery_switch_->publish_state(value_output_source_priority_ == 2);
|
138
138
|
}
|
139
|
+
if (this->output_source_priority_hybrid_switch_) {
|
140
|
+
this->output_source_priority_hybrid_switch_->publish_state(value_output_source_priority_ == 3);
|
141
|
+
}
|
139
142
|
if (this->charger_source_priority_) {
|
140
143
|
this->charger_source_priority_->publish_state(value_charger_source_priority_);
|
141
144
|
}
|
@@ -174,6 +174,7 @@ class Pipsolar : public uart::UARTDevice, public PollingComponent {
|
|
174
174
|
PIPSOLAR_SWITCH(output_source_priority_utility_switch, QPIRI)
|
175
175
|
PIPSOLAR_SWITCH(output_source_priority_solar_switch, QPIRI)
|
176
176
|
PIPSOLAR_SWITCH(output_source_priority_battery_switch, QPIRI)
|
177
|
+
PIPSOLAR_SWITCH(output_source_priority_hybrid_switch, QPIRI)
|
177
178
|
PIPSOLAR_SWITCH(input_voltage_range_switch, QPIRI)
|
178
179
|
PIPSOLAR_SWITCH(pv_ok_condition_for_parallel_switch, QPIRI)
|
179
180
|
PIPSOLAR_SWITCH(pv_power_balance_switch, QPIRI)
|
@@ -9,6 +9,7 @@ DEPENDENCIES = ["uart"]
|
|
9
9
|
CONF_OUTPUT_SOURCE_PRIORITY_UTILITY = "output_source_priority_utility"
|
10
10
|
CONF_OUTPUT_SOURCE_PRIORITY_SOLAR = "output_source_priority_solar"
|
11
11
|
CONF_OUTPUT_SOURCE_PRIORITY_BATTERY = "output_source_priority_battery"
|
12
|
+
CONF_OUTPUT_SOURCE_PRIORITY_HYBRID = "output_source_priority_hybrid"
|
12
13
|
CONF_INPUT_VOLTAGE_RANGE = "input_voltage_range"
|
13
14
|
CONF_PV_OK_CONDITION_FOR_PARALLEL = "pv_ok_condition_for_parallel"
|
14
15
|
CONF_PV_POWER_BALANCE = "pv_power_balance"
|
@@ -17,6 +18,7 @@ TYPES = {
|
|
17
18
|
CONF_OUTPUT_SOURCE_PRIORITY_UTILITY: ("POP00", None),
|
18
19
|
CONF_OUTPUT_SOURCE_PRIORITY_SOLAR: ("POP01", None),
|
19
20
|
CONF_OUTPUT_SOURCE_PRIORITY_BATTERY: ("POP02", None),
|
21
|
+
CONF_OUTPUT_SOURCE_PRIORITY_HYBRID: ("POP03", None),
|
20
22
|
CONF_INPUT_VOLTAGE_RANGE: ("PGR01", "PGR00"),
|
21
23
|
CONF_PV_OK_CONDITION_FOR_PARALLEL: ("PPVOKC1", "PPVOKC0"),
|
22
24
|
CONF_PV_POWER_BALANCE: ("PSPB1", "PSPB0"),
|
@@ -1,4 +1,5 @@
|
|
1
1
|
#include "prometheus_handler.h"
|
2
|
+
#ifdef USE_NETWORK
|
2
3
|
#include "esphome/core/application.h"
|
3
4
|
|
4
5
|
namespace esphome {
|
@@ -350,3 +351,4 @@ void PrometheusHandler::lock_row_(AsyncResponseStream *stream, lock::Lock *obj)
|
|
350
351
|
|
351
352
|
} // namespace prometheus
|
352
353
|
} // namespace esphome
|
354
|
+
#endif
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#pragma once
|
2
|
-
|
2
|
+
#include "esphome/core/defines.h"
|
3
|
+
#ifdef USE_NETWORK
|
3
4
|
#include <map>
|
4
5
|
#include <utility>
|
5
6
|
|
@@ -117,3 +118,4 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
|
|
117
118
|
|
118
119
|
} // namespace prometheus
|
119
120
|
} // namespace esphome
|
121
|
+
#endif
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import logging
|
2
2
|
import os
|
3
|
-
|
4
3
|
from string import ascii_letters, digits
|
5
4
|
|
6
5
|
import esphome.codegen as cg
|
@@ -8,6 +7,7 @@ import esphome.config_validation as cv
|
|
8
7
|
from esphome.const import (
|
9
8
|
CONF_BOARD,
|
10
9
|
CONF_FRAMEWORK,
|
10
|
+
CONF_PLATFORM_VERSION,
|
11
11
|
CONF_SOURCE,
|
12
12
|
CONF_VERSION,
|
13
13
|
KEY_CORE,
|
@@ -15,10 +15,9 @@ from esphome.const import (
|
|
15
15
|
KEY_TARGET_FRAMEWORK,
|
16
16
|
KEY_TARGET_PLATFORM,
|
17
17
|
PLATFORM_RP2040,
|
18
|
-
CONF_PLATFORM_VERSION,
|
19
18
|
)
|
20
|
-
from esphome.core import CORE,
|
21
|
-
from esphome.helpers import mkdir_p, write_file
|
19
|
+
from esphome.core import CORE, EsphomeError, coroutine_with_priority
|
20
|
+
from esphome.helpers import copy_file_if_changed, mkdir_p, write_file
|
22
21
|
|
23
22
|
from .const import KEY_BOARD, KEY_PIO_FILES, KEY_RP2040, rp2040_ns
|
24
23
|
|
@@ -81,19 +80,19 @@ def _format_framework_arduino_version(ver: cv.Version) -> str:
|
|
81
80
|
# The default/recommended arduino framework version
|
82
81
|
# - https://github.com/earlephilhower/arduino-pico/releases
|
83
82
|
# - https://api.registry.platformio.org/v3/packages/earlephilhower/tool/framework-arduinopico
|
84
|
-
RECOMMENDED_ARDUINO_FRAMEWORK_VERSION = cv.Version(3,
|
83
|
+
RECOMMENDED_ARDUINO_FRAMEWORK_VERSION = cv.Version(3, 9, 4)
|
85
84
|
|
86
85
|
# The platformio/raspberrypi version to use for arduino frameworks
|
87
86
|
# - https://github.com/platformio/platform-raspberrypi/releases
|
88
87
|
# - https://api.registry.platformio.org/v3/packages/platformio/platform/raspberrypi
|
89
|
-
ARDUINO_PLATFORM_VERSION = cv.Version(1,
|
88
|
+
ARDUINO_PLATFORM_VERSION = cv.Version(1, 13, 0)
|
90
89
|
|
91
90
|
|
92
91
|
def _arduino_check_versions(value):
|
93
92
|
value = value.copy()
|
94
93
|
lookups = {
|
95
|
-
"dev": (cv.Version(3,
|
96
|
-
"latest": (cv.Version(3,
|
94
|
+
"dev": (cv.Version(3, 9, 4), "https://github.com/earlephilhower/arduino-pico"),
|
95
|
+
"latest": (cv.Version(3, 9, 4), None),
|
97
96
|
"recommended": (RECOMMENDED_ARDUINO_FRAMEWORK_VERSION, None),
|
98
97
|
}
|
99
98
|
|
@@ -1,30 +1,28 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
1
|
from esphome import pins
|
2
|
+
import esphome.codegen as cg
|
4
3
|
from esphome.components import display
|
4
|
+
from esphome.components.esp32 import const, only_on_variant
|
5
|
+
import esphome.config_validation as cv
|
5
6
|
from esphome.const import (
|
6
|
-
|
7
|
-
|
7
|
+
CONF_BLUE,
|
8
|
+
CONF_COLOR_ORDER,
|
8
9
|
CONF_DATA_PINS,
|
9
|
-
CONF_ID,
|
10
|
-
CONF_IGNORE_STRAPPING_WARNING,
|
11
10
|
CONF_DIMENSIONS,
|
12
|
-
|
13
|
-
|
11
|
+
CONF_ENABLE_PIN,
|
12
|
+
CONF_GREEN,
|
14
13
|
CONF_HEIGHT,
|
14
|
+
CONF_HSYNC_PIN,
|
15
|
+
CONF_ID,
|
16
|
+
CONF_IGNORE_STRAPPING_WARNING,
|
17
|
+
CONF_INVERT_COLORS,
|
15
18
|
CONF_LAMBDA,
|
16
|
-
CONF_COLOR_ORDER,
|
17
|
-
CONF_RED,
|
18
|
-
CONF_GREEN,
|
19
|
-
CONF_BLUE,
|
20
19
|
CONF_NUMBER,
|
21
20
|
CONF_OFFSET_HEIGHT,
|
22
21
|
CONF_OFFSET_WIDTH,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
const,
|
22
|
+
CONF_RED,
|
23
|
+
CONF_RESET_PIN,
|
24
|
+
CONF_VSYNC_PIN,
|
25
|
+
CONF_WIDTH,
|
28
26
|
)
|
29
27
|
|
30
28
|
DEPENDENCIES = ["esp32"]
|
@@ -112,6 +110,7 @@ CONFIG_SCHEMA = cv.All(
|
|
112
110
|
cv.Required(CONF_PCLK_PIN): pins.internal_gpio_output_pin_schema,
|
113
111
|
cv.Required(CONF_HSYNC_PIN): pins.internal_gpio_output_pin_schema,
|
114
112
|
cv.Required(CONF_VSYNC_PIN): pins.internal_gpio_output_pin_schema,
|
113
|
+
cv.Optional(CONF_ENABLE_PIN): pins.gpio_output_pin_schema,
|
115
114
|
cv.Optional(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
116
115
|
cv.Optional(CONF_HSYNC_PULSE_WIDTH, default=10): cv.int_,
|
117
116
|
cv.Optional(CONF_HSYNC_BACK_PORCH, default=10): cv.int_,
|
@@ -164,6 +163,10 @@ async def to_code(config):
|
|
164
163
|
cg.add(var.add_data_pin(data_pin, index))
|
165
164
|
index += 1
|
166
165
|
|
166
|
+
if enable_pin := config.get(CONF_ENABLE_PIN):
|
167
|
+
enable = await cg.gpio_pin_expression(enable_pin)
|
168
|
+
cg.add(var.set_enable_pin(enable))
|
169
|
+
|
167
170
|
if reset_pin := config.get(CONF_RESET_PIN):
|
168
171
|
reset = await cg.gpio_pin_expression(reset_pin)
|
169
172
|
cg.add(var.set_reset_pin(reset))
|
@@ -6,9 +6,14 @@ namespace esphome {
|
|
6
6
|
namespace rpi_dpi_rgb {
|
7
7
|
|
8
8
|
void RpiDpiRgb::setup() {
|
9
|
-
|
9
|
+
ESP_LOGCONFIG(TAG, "Setting up RPI_DPI_RGB");
|
10
|
+
this->reset_display_();
|
10
11
|
esp_lcd_rgb_panel_config_t config{};
|
11
12
|
config.flags.fb_in_psram = 1;
|
13
|
+
#if ESP_IDF_VERSION_MAJOR >= 5
|
14
|
+
config.bounce_buffer_size_px = this->width_ * 10;
|
15
|
+
config.num_fbs = 1;
|
16
|
+
#endif // ESP_IDF_VERSION_MAJOR
|
12
17
|
config.timings.h_res = this->width_;
|
13
18
|
config.timings.v_res = this->height_;
|
14
19
|
config.timings.hsync_pulse_width = this->hsync_pulse_width_;
|
@@ -20,7 +25,6 @@ void RpiDpiRgb::setup() {
|
|
20
25
|
config.timings.flags.pclk_active_neg = this->pclk_inverted_;
|
21
26
|
config.timings.pclk_hz = this->pclk_frequency_;
|
22
27
|
config.clk_src = LCD_CLK_SRC_PLL160M;
|
23
|
-
config.sram_trans_align = 64;
|
24
28
|
config.psram_trans_align = 64;
|
25
29
|
size_t data_pin_count = sizeof(this->data_pins_) / sizeof(this->data_pins_[0]);
|
26
30
|
for (size_t i = 0; i != data_pin_count; i++) {
|
@@ -34,11 +38,19 @@ void RpiDpiRgb::setup() {
|
|
34
38
|
config.pclk_gpio_num = this->pclk_pin_->get_pin();
|
35
39
|
esp_err_t err = esp_lcd_new_rgb_panel(&config, &this->handle_);
|
36
40
|
if (err != ESP_OK) {
|
37
|
-
|
41
|
+
ESP_LOGE(TAG, "lcd_new_rgb_panel failed: %s", esp_err_to_name(err));
|
42
|
+
this->mark_failed();
|
43
|
+
return;
|
38
44
|
}
|
39
45
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(this->handle_));
|
40
46
|
ESP_ERROR_CHECK(esp_lcd_panel_init(this->handle_));
|
41
|
-
|
47
|
+
ESP_LOGCONFIG(TAG, "RPI_DPI_RGB setup complete");
|
48
|
+
}
|
49
|
+
void RpiDpiRgb::loop() {
|
50
|
+
#if ESP_IDF_VERSION_MAJOR >= 5
|
51
|
+
if (this->handle_ != nullptr)
|
52
|
+
esp_lcd_rgb_panel_restart(this->handle_);
|
53
|
+
#endif // ESP_IDF_VERSION_MAJOR
|
42
54
|
}
|
43
55
|
|
44
56
|
void RpiDpiRgb::draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
@@ -53,7 +65,7 @@ void RpiDpiRgb::draw_pixels_at(int x_start, int y_start, int w, int h, const uin
|
|
53
65
|
}
|
54
66
|
x_start += this->offset_x_;
|
55
67
|
y_start += this->offset_y_;
|
56
|
-
esp_err_t err;
|
68
|
+
esp_err_t err = ESP_OK;
|
57
69
|
// x_ and y_offset are offsets into the source buffer, unrelated to our own offsets into the display.
|
58
70
|
if (x_offset == 0 && x_pad == 0 && y_offset == 0) {
|
59
71
|
// we could deal here with a non-zero y_offset, but if x_offset is zero, y_offset probably will be so don't bother
|
@@ -69,7 +81,7 @@ void RpiDpiRgb::draw_pixels_at(int x_start, int y_start, int w, int h, const uin
|
|
69
81
|
}
|
70
82
|
}
|
71
83
|
if (err != ESP_OK)
|
72
|
-
|
84
|
+
ESP_LOGE(TAG, "lcd_lcd_panel_draw_bitmap failed: %s", esp_err_to_name(err));
|
73
85
|
}
|
74
86
|
|
75
87
|
void RpiDpiRgb::draw_pixel_at(int x, int y, Color color) {
|
@@ -104,12 +116,30 @@ void RpiDpiRgb::dump_config() {
|
|
104
116
|
ESP_LOGCONFIG(TAG, " Height: %u", this->height_);
|
105
117
|
ESP_LOGCONFIG(TAG, " Width: %u", this->width_);
|
106
118
|
LOG_PIN(" DE Pin: ", this->de_pin_);
|
119
|
+
LOG_PIN(" Enable Pin: ", this->enable_pin_);
|
107
120
|
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
108
121
|
size_t data_pin_count = sizeof(this->data_pins_) / sizeof(this->data_pins_[0]);
|
109
122
|
for (size_t i = 0; i != data_pin_count; i++)
|
110
123
|
ESP_LOGCONFIG(TAG, " Data pin %d: %s", i, (this->data_pins_[i])->dump_summary().c_str());
|
111
124
|
}
|
112
125
|
|
126
|
+
void RpiDpiRgb::reset_display_() const {
|
127
|
+
if (this->reset_pin_ != nullptr) {
|
128
|
+
this->reset_pin_->setup();
|
129
|
+
this->reset_pin_->digital_write(false);
|
130
|
+
if (this->enable_pin_ != nullptr) {
|
131
|
+
this->enable_pin_->setup();
|
132
|
+
this->enable_pin_->digital_write(false);
|
133
|
+
}
|
134
|
+
delay(1);
|
135
|
+
this->reset_pin_->digital_write(true);
|
136
|
+
if (this->enable_pin_ != nullptr) {
|
137
|
+
delay(11);
|
138
|
+
this->enable_pin_->digital_write(true);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
113
143
|
} // namespace rpi_dpi_rgb
|
114
144
|
} // namespace esphome
|
115
145
|
|
@@ -23,6 +23,7 @@ class RpiDpiRgb : public display::Display {
|
|
23
23
|
public:
|
24
24
|
void update() override { this->do_update_(); }
|
25
25
|
void setup() override;
|
26
|
+
void loop() override;
|
26
27
|
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
27
28
|
display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override;
|
28
29
|
void draw_pixel_at(int x, int y, Color color) override;
|
@@ -36,6 +37,7 @@ class RpiDpiRgb : public display::Display {
|
|
36
37
|
void set_pclk_pin(InternalGPIOPin *pclk_pin) { this->pclk_pin_ = pclk_pin; }
|
37
38
|
void set_vsync_pin(InternalGPIOPin *vsync_pin) { this->vsync_pin_ = vsync_pin; }
|
38
39
|
void set_hsync_pin(InternalGPIOPin *hsync_pin) { this->hsync_pin_ = hsync_pin; }
|
40
|
+
void set_enable_pin(GPIOPin *enable_pin) { this->enable_pin_ = enable_pin; }
|
39
41
|
void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
|
40
42
|
void set_width(uint16_t width) { this->width_ = width; }
|
41
43
|
void set_dimensions(uint16_t width, uint16_t height) {
|
@@ -62,10 +64,12 @@ class RpiDpiRgb : public display::Display {
|
|
62
64
|
protected:
|
63
65
|
int get_width_internal() override { return this->width_; }
|
64
66
|
int get_height_internal() override { return this->height_; }
|
67
|
+
void reset_display_() const;
|
65
68
|
InternalGPIOPin *de_pin_{nullptr};
|
66
69
|
InternalGPIOPin *pclk_pin_{nullptr};
|
67
70
|
InternalGPIOPin *hsync_pin_{nullptr};
|
68
71
|
InternalGPIOPin *vsync_pin_{nullptr};
|
72
|
+
GPIOPin *enable_pin_{nullptr};
|
69
73
|
GPIOPin *reset_pin_{nullptr};
|
70
74
|
InternalGPIOPin *data_pins_[16] = {};
|
71
75
|
uint16_t hsync_front_porch_ = 8;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
#include "socket.h"
|
2
|
+
#if defined(USE_SOCKET_IMPL_LWIP_TCP) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)
|
2
3
|
#include <cerrno>
|
3
4
|
#include <cstring>
|
4
5
|
#include <string>
|
@@ -74,3 +75,4 @@ socklen_t set_sockaddr_any(struct sockaddr *addr, socklen_t addrlen, uint16_t po
|
|
74
75
|
}
|
75
76
|
} // namespace socket
|
76
77
|
} // namespace esphome
|
78
|
+
#endif
|
@@ -5,6 +5,7 @@
|
|
5
5
|
#include "esphome/core/optional.h"
|
6
6
|
#include "headers.h"
|
7
7
|
|
8
|
+
#if defined(USE_SOCKET_IMPL_LWIP_TCP) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)
|
8
9
|
namespace esphome {
|
9
10
|
namespace socket {
|
10
11
|
|
@@ -57,3 +58,4 @@ socklen_t set_sockaddr_any(struct sockaddr *addr, socklen_t addrlen, uint16_t po
|
|
57
58
|
|
58
59
|
} // namespace socket
|
59
60
|
} // namespace esphome
|
61
|
+
#endif
|