esphome 2024.11.2__py3-none-any.whl → 2024.12.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.
Files changed (192) hide show
  1. esphome/__main__.py +1 -1
  2. esphome/components/adc/adc_sensor.h +7 -8
  3. esphome/components/adc/adc_sensor_common.cpp +24 -0
  4. esphome/components/adc/{adc_sensor.cpp → adc_sensor_esp32.cpp} +10 -179
  5. esphome/components/adc/adc_sensor_esp8266.cpp +58 -0
  6. esphome/components/adc/adc_sensor_libretiny.cpp +48 -0
  7. esphome/components/adc/adc_sensor_rp2040.cpp +93 -0
  8. esphome/components/alarm_control_panel/alarm_control_panel_call.cpp +3 -4
  9. esphome/components/animation/__init__.py +1 -2
  10. esphome/components/apds9306/apds9306.cpp +2 -1
  11. esphome/components/audio/audio.h +1 -1
  12. esphome/components/bk72xx/__init__.py +1 -1
  13. esphome/components/cse7766/cse7766.cpp +1 -1
  14. esphome/components/datetime/datetime_entity.cpp +1 -3
  15. esphome/components/deep_sleep/deep_sleep_esp32.cpp +2 -2
  16. esphome/components/dht/dht.cpp +2 -1
  17. esphome/components/display/display.cpp +10 -6
  18. esphome/components/display/display.h +14 -0
  19. esphome/components/display_menu_base/__init__.py +0 -2
  20. esphome/components/display_menu_base/display_menu_base.cpp +1 -1
  21. esphome/components/dsmr/dsmr.cpp +1 -1
  22. esphome/components/esp32/__init__.py +100 -22
  23. esphome/components/esp32/boards.py +222 -14
  24. esphome/components/esp32_ble/__init__.py +22 -2
  25. esphome/components/esp32_ble/ble.cpp +39 -12
  26. esphome/components/esp32_ble/ble.h +2 -0
  27. esphome/components/esp32_ble/ble_advertising.cpp +1 -1
  28. esphome/components/esp32_ble/ble_uuid.cpp +9 -10
  29. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +4 -1
  30. esphome/components/esp32_camera_web_server/camera_web_server.h +1 -1
  31. esphome/components/esp32_rmt_led_strip/light.py +3 -3
  32. esphome/components/esp8266/__init__.py +5 -7
  33. esphome/components/ezo/ezo.cpp +14 -26
  34. esphome/components/font/__init__.py +10 -25
  35. esphome/components/font/font.cpp +5 -3
  36. esphome/components/graphical_display_menu/__init__.py +2 -0
  37. esphome/components/haier/hon_climate.cpp +79 -80
  38. esphome/components/hbridge/switch/__init__.py +44 -0
  39. esphome/components/hbridge/switch/hbridge_switch.cpp +95 -0
  40. esphome/components/hbridge/switch/hbridge_switch.h +50 -0
  41. esphome/components/hitachi_ac344/hitachi_ac344.cpp +4 -2
  42. esphome/components/hitachi_ac424/hitachi_ac424.cpp +4 -2
  43. esphome/components/homeassistant/number/homeassistant_number.cpp +3 -0
  44. esphome/components/hx711/hx711.cpp +1 -1
  45. esphome/components/hx711/hx711.h +1 -1
  46. esphome/components/i2c/i2c_bus_esp_idf.cpp +2 -2
  47. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +61 -59
  48. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -17
  49. esphome/components/ili9xxx/display.py +1 -2
  50. esphome/components/ili9xxx/ili9xxx_display.cpp +3 -2
  51. esphome/components/image/__init__.py +1 -2
  52. esphome/components/logger/logger.cpp +1 -1
  53. esphome/components/ltr501/ltr501.cpp +1 -1
  54. esphome/components/lvgl/defines.py +9 -2
  55. esphome/components/lvgl/lv_validation.py +8 -3
  56. esphome/components/lvgl/lvgl_esphome.cpp +1 -1
  57. esphome/components/lvgl/lvgl_esphome.h +19 -0
  58. esphome/components/lvgl/widgets/animimg.py +12 -17
  59. esphome/components/lvgl/widgets/img.py +1 -3
  60. esphome/components/lvgl/widgets/line.py +6 -0
  61. esphome/components/lvgl/widgets/msgbox.py +2 -1
  62. esphome/components/matrix_keypad/__init__.py +15 -3
  63. esphome/components/matrix_keypad/matrix_keypad.cpp +4 -0
  64. esphome/components/matrix_keypad/matrix_keypad.h +5 -0
  65. esphome/components/max31865/max31865.cpp +4 -2
  66. esphome/components/modbus_controller/modbus_controller.cpp +24 -24
  67. esphome/components/modbus_controller/modbus_controller.h +22 -22
  68. esphome/components/modbus_controller/number/modbus_number.cpp +8 -8
  69. esphome/components/modbus_controller/number/modbus_number.h +4 -4
  70. esphome/components/modbus_controller/output/modbus_output.cpp +7 -6
  71. esphome/components/modbus_controller/output/modbus_output.h +5 -5
  72. esphome/components/modbus_controller/select/modbus_select.cpp +4 -3
  73. esphome/components/modbus_controller/select/modbus_select.h +4 -4
  74. esphome/components/modbus_controller/switch/modbus_switch.cpp +5 -5
  75. esphome/components/modbus_controller/switch/modbus_switch.h +2 -2
  76. esphome/components/mqtt/__init__.py +4 -0
  77. esphome/components/mqtt/mqtt_alarm_control_panel.cpp +2 -5
  78. esphome/components/mqtt/mqtt_backend_esp32.cpp +3 -3
  79. esphome/components/mqtt/mqtt_client.cpp +4 -0
  80. esphome/components/mqtt/mqtt_client.h +6 -0
  81. esphome/components/mqtt/mqtt_climate.cpp +13 -3
  82. esphome/components/mqtt/mqtt_sensor.cpp +2 -0
  83. esphome/components/network/ip_address.h +1 -1
  84. esphome/components/nextion/__init__.py +2 -0
  85. esphome/components/nextion/automation.h +76 -0
  86. esphome/components/nextion/base_component.py +1 -0
  87. esphome/components/nextion/binary_sensor/__init__.py +43 -2
  88. esphome/components/nextion/display.py +15 -0
  89. esphome/components/nextion/nextion.cpp +8 -5
  90. esphome/components/nextion/nextion.h +7 -0
  91. esphome/components/nextion/nextion_upload_idf.cpp +2 -2
  92. esphome/components/nextion/sensor/__init__.py +38 -5
  93. esphome/components/nextion/switch/__init__.py +38 -2
  94. esphome/components/nextion/text_sensor/__init__.py +37 -2
  95. esphome/components/nfc/ndef_record.cpp +3 -3
  96. esphome/components/online_image/__init__.py +1 -0
  97. esphome/components/online_image/png_image.cpp +4 -0
  98. esphome/components/opentherm/hub.cpp +6 -7
  99. esphome/components/opentherm/opentherm.cpp +18 -34
  100. esphome/components/opentherm/opentherm.h +4 -5
  101. esphome/components/ota/automation.h +1 -1
  102. esphome/components/output/float_output.cpp +1 -1
  103. esphome/components/pca6416a/pca6416a.cpp +5 -3
  104. esphome/components/pca9554/pca9554.cpp +4 -4
  105. esphome/components/pipsolar/pipsolar.cpp +2 -2
  106. esphome/components/pipsolar/switch/pipsolar_switch.cpp +2 -2
  107. esphome/components/pn532/pn532_mifare_ultralight.cpp +2 -2
  108. esphome/components/pn7150/pn7150_mifare_ultralight.cpp +2 -2
  109. esphome/components/pn7160/pn7160_mifare_ultralight.cpp +2 -2
  110. esphome/components/qmc5883l/qmc5883l.cpp +45 -19
  111. esphome/components/qmc5883l/qmc5883l.h +1 -1
  112. esphome/components/qspi_dbi/qspi_dbi.cpp +2 -1
  113. esphome/components/remote_base/raw_protocol.cpp +1 -1
  114. esphome/components/remote_receiver/__init__.py +5 -6
  115. esphome/components/rotary_encoder/rotary_encoder.cpp +3 -1
  116. esphome/components/rp2040/__init__.py +1 -1
  117. esphome/components/rtl87xx/__init__.py +1 -1
  118. esphome/components/safe_mode/automation.h +1 -1
  119. esphome/components/seeed_mr60bha2/__init__.py +41 -0
  120. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +173 -0
  121. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +61 -0
  122. esphome/components/seeed_mr60bha2/sensor.py +57 -0
  123. esphome/components/seeed_mr60fda2/__init__.py +41 -0
  124. esphome/components/seeed_mr60fda2/binary_sensor.py +33 -0
  125. esphome/components/seeed_mr60fda2/button/__init__.py +45 -0
  126. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.cpp +9 -0
  127. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.h +18 -0
  128. esphome/components/seeed_mr60fda2/button/reset_radar_button.cpp +9 -0
  129. esphome/components/seeed_mr60fda2/button/reset_radar_button.h +18 -0
  130. esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp +368 -0
  131. esphome/components/seeed_mr60fda2/seeed_mr60fda2.h +101 -0
  132. esphome/components/seeed_mr60fda2/select/__init__.py +59 -0
  133. esphome/components/seeed_mr60fda2/select/height_threshold_select.cpp +15 -0
  134. esphome/components/seeed_mr60fda2/select/height_threshold_select.h +18 -0
  135. esphome/components/seeed_mr60fda2/select/install_height_select.cpp +15 -0
  136. esphome/components/seeed_mr60fda2/select/install_height_select.h +18 -0
  137. esphome/components/seeed_mr60fda2/select/sensitivity_select.cpp +15 -0
  138. esphome/components/seeed_mr60fda2/select/sensitivity_select.h +18 -0
  139. esphome/components/sen5x/sensor.py +5 -6
  140. esphome/components/sgp30/sensor.py +8 -9
  141. esphome/components/sgp30/sgp30.cpp +2 -6
  142. esphome/components/shelly_dimmer/shelly_dimmer.cpp +1 -1
  143. esphome/components/sim800l/sim800l.cpp +1 -1
  144. esphome/components/sntp/sntp_component.cpp +14 -20
  145. esphome/components/sntp/sntp_component.h +6 -9
  146. esphome/components/sntp/time.py +4 -7
  147. esphome/components/sprinkler/sprinkler.cpp +2 -2
  148. esphome/components/st7735/st7735.cpp +1 -1
  149. esphome/components/st7789v/st7789v.cpp +1 -1
  150. esphome/components/st7920/st7920.cpp +2 -3
  151. esphome/components/stepper/stepper.h +0 -1
  152. esphome/components/sun_gtil2/sun_gtil2.cpp +1 -1
  153. esphome/components/switch/binary_sensor/__init__.py +31 -0
  154. esphome/components/switch/binary_sensor/switch_binary_sensor.cpp +17 -0
  155. esphome/components/switch/binary_sensor/switch_binary_sensor.h +22 -0
  156. esphome/components/sx1509/sx1509_gpio_pin.cpp +2 -1
  157. esphome/components/sx1509/sx1509_gpio_pin.h +5 -5
  158. esphome/components/uart/uart.h +1 -1
  159. esphome/components/udp/udp_component.cpp +32 -16
  160. esphome/components/ufire_ec/sensor.py +4 -4
  161. esphome/components/uln2003/uln2003.cpp +4 -1
  162. esphome/components/waveshare_epaper/display.py +8 -0
  163. esphome/components/waveshare_epaper/waveshare_epaper.cpp +191 -0
  164. esphome/components/waveshare_epaper/waveshare_epaper.h +56 -0
  165. esphome/components/wiegand/__init__.py +3 -4
  166. esphome/components/wifi/__init__.py +42 -0
  167. esphome/components/wifi/wifi_component.cpp +2 -2
  168. esphome/components/wifi/wifi_component.h +82 -1
  169. esphome/components/wifi/wifi_component_esp32_arduino.cpp +1 -1
  170. esphome/components/wifi/wifi_component_esp8266.cpp +1 -1
  171. esphome/components/wifi/wifi_component_esp_idf.cpp +1 -1
  172. esphome/components/wifi/wifi_component_libretiny.cpp +1 -1
  173. esphome/components/wifi/wifi_component_pico_w.cpp +1 -1
  174. esphome/components/wireguard/wireguard.cpp +2 -2
  175. esphome/components/xiaomi_ble/xiaomi_ble.cpp +1 -1
  176. esphome/config_validation.py +15 -11
  177. esphome/const.py +11 -1
  178. esphome/core/component.cpp +1 -1
  179. esphome/core/config.py +1 -2
  180. esphome/core/defines.h +3 -1
  181. esphome/core/helpers.cpp +20 -2
  182. esphome/core/helpers.h +10 -1
  183. esphome/core/optional.h +2 -2
  184. esphome/core/time.cpp +19 -15
  185. esphome/core/time.h +1 -3
  186. esphome/dashboard/web_server.py +6 -0
  187. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/METADATA +4 -4
  188. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/RECORD +192 -162
  189. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/LICENSE +0 -0
  190. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/WHEEL +0 -0
  191. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/entry_points.txt +0 -0
  192. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,10 @@
1
+ from esphome import automation
1
2
  from esphome.components import text_sensor
2
3
  import esphome.config_validation as cv
3
4
  import esphome.codegen as cg
4
- from esphome.const import CONF_ID
5
+ from esphome.const import CONF_ID, CONF_STATE
5
6
 
6
- from .. import nextion_ns, CONF_NEXTION_ID
7
+ from .. import nextion_ns, CONF_NEXTION_ID, CONF_PUBLISH_STATE, CONF_SEND_TO_NEXTION
7
8
 
8
9
  from ..base_component import (
9
10
  setup_component_core_,
@@ -16,6 +17,10 @@ NextionTextSensor = nextion_ns.class_(
16
17
  "NextionTextSensor", text_sensor.TextSensor, cg.PollingComponent
17
18
  )
18
19
 
20
+ NextionPublishTextAction = nextion_ns.class_(
21
+ "NextionPublishTextAction", automation.Action
22
+ )
23
+
19
24
  CONFIG_SCHEMA = (
20
25
  text_sensor.text_sensor_schema(NextionTextSensor)
21
26
  .extend(CONFIG_TEXT_COMPONENT_SCHEMA)
@@ -32,3 +37,33 @@ async def to_code(config):
32
37
  cg.add(hub.register_textsensor_component(var))
33
38
 
34
39
  await setup_component_core_(var, config, ".txt")
40
+
41
+
42
+ @automation.register_action(
43
+ "text_sensor.nextion.publish",
44
+ NextionPublishTextAction,
45
+ cv.Schema(
46
+ {
47
+ cv.Required(CONF_ID): cv.use_id(NextionTextSensor),
48
+ cv.Required(CONF_STATE): cv.templatable(cv.string_strict),
49
+ cv.Optional(CONF_PUBLISH_STATE, default="true"): cv.templatable(cv.boolean),
50
+ cv.Optional(CONF_SEND_TO_NEXTION, default="true"): cv.templatable(
51
+ cv.boolean
52
+ ),
53
+ }
54
+ ),
55
+ )
56
+ async def sensor_nextion_publish_to_code(config, action_id, template_arg, args):
57
+ paren = await cg.get_variable(config[CONF_ID])
58
+ var = cg.new_Pvariable(action_id, template_arg, paren)
59
+
60
+ template_ = await cg.templatable(config[CONF_STATE], args, cg.const_char_ptr)
61
+ cg.add(var.set_state(template_))
62
+
63
+ template_ = await cg.templatable(config[CONF_PUBLISH_STATE], args, cg.bool_)
64
+ cg.add(var.set_publish_state(template_))
65
+
66
+ template_ = await cg.templatable(config[CONF_SEND_TO_NEXTION], args, cg.bool_)
67
+ cg.add(var.set_send_to_nextion(template_))
68
+
69
+ return var
@@ -30,13 +30,13 @@ std::vector<uint8_t> NdefRecord::encode(bool first, bool last) {
30
30
  data.push_back(payload_length & 0xFF);
31
31
  }
32
32
 
33
- if (this->id_.length()) {
33
+ if (!this->id_.empty()) {
34
34
  data.push_back(this->id_.length());
35
35
  }
36
36
 
37
37
  data.insert(data.end(), this->type_.begin(), this->type_.end());
38
38
 
39
- if (this->id_.length()) {
39
+ if (!this->id_.empty()) {
40
40
  data.insert(data.end(), this->id_.begin(), this->id_.end());
41
41
  }
42
42
 
@@ -55,7 +55,7 @@ uint8_t NdefRecord::create_flag_byte(bool first, bool last, size_t payload_size)
55
55
  if (payload_size <= 255) {
56
56
  value = value | 0x10; // Set SR bit
57
57
  }
58
- if (this->id_.length()) {
58
+ if (!this->id_.empty()) {
59
59
  value = value | 0x08; // Set IL bit
60
60
  }
61
61
  return value;
@@ -98,6 +98,7 @@ CONFIG_SCHEMA = cv.Schema(
98
98
  # esp8266_arduino=cv.Version(2, 7, 0),
99
99
  esp32_arduino=cv.Version(0, 0, 0),
100
100
  esp_idf=cv.Version(4, 0, 0),
101
+ rp2040_arduino=cv.Version(0, 0, 0),
101
102
  ),
102
103
  )
103
104
  )
@@ -49,6 +49,10 @@ void PngDecoder::prepare(uint32_t download_size) {
49
49
  }
50
50
 
51
51
  int HOT PngDecoder::decode(uint8_t *buffer, size_t size) {
52
+ if (!this->pngle_) {
53
+ ESP_LOGE(TAG, "PNG decoder engine not initialized!");
54
+ return -1;
55
+ }
52
56
  if (size < 256 && size < this->download_size_ - this->decoded_bytes_) {
53
57
  ESP_LOGD(TAG, "Waiting for data");
54
58
  return 0;
@@ -138,7 +138,7 @@ OpenthermHub::OpenthermHub() : Component(), in_pin_{}, out_pin_{} {}
138
138
  void OpenthermHub::process_response(OpenthermData &data) {
139
139
  ESP_LOGD(TAG, "Received OpenTherm response with id %d (%s)", data.id,
140
140
  this->opentherm_->message_id_to_str((MessageId) data.id));
141
- ESP_LOGD(TAG, "%s", this->opentherm_->debug_data(data).c_str());
141
+ this->opentherm_->debug_data(data);
142
142
 
143
143
  switch (data.id) {
144
144
  OPENTHERM_SENSOR_MESSAGE_HANDLERS(OPENTHERM_MESSAGE_RESPONSE_MESSAGE, OPENTHERM_MESSAGE_RESPONSE_ENTITY, ,
@@ -315,7 +315,7 @@ void OpenthermHub::start_conversation_() {
315
315
 
316
316
  ESP_LOGD(TAG, "Sending request with id %d (%s)", request.id,
317
317
  this->opentherm_->message_id_to_str((MessageId) request.id));
318
- ESP_LOGD(TAG, "%s", this->opentherm_->debug_data(request).c_str());
318
+ this->opentherm_->debug_data(request);
319
319
  // Send the request
320
320
  this->last_conversation_start_ = millis();
321
321
  this->opentherm_->send(request);
@@ -340,19 +340,18 @@ void OpenthermHub::stop_opentherm_() {
340
340
  this->opentherm_->stop();
341
341
  this->last_conversation_end_ = millis();
342
342
  }
343
-
344
343
  void OpenthermHub::handle_protocol_write_error_() {
345
344
  ESP_LOGW(TAG, "Error while sending request: %s",
346
345
  this->opentherm_->operation_mode_to_str(this->opentherm_->get_mode()));
347
- ESP_LOGW(TAG, "%s", this->opentherm_->debug_data(this->last_request_).c_str());
346
+ this->opentherm_->debug_data(this->last_request_);
348
347
  }
349
-
350
348
  void OpenthermHub::handle_protocol_read_error_() {
351
349
  OpenThermError error;
352
350
  this->opentherm_->get_protocol_error(error);
353
- ESP_LOGW(TAG, "Protocol error occured while receiving response: %s", this->opentherm_->debug_error(error).c_str());
351
+ ESP_LOGW(TAG, "Protocol error occured while receiving response: %s",
352
+ this->opentherm_->protocol_error_to_to_str(error.error_type));
353
+ this->opentherm_->debug_error(error);
354
354
  }
355
-
356
355
  void OpenthermHub::handle_timeout_error_() {
357
356
  ESP_LOGW(TAG, "Receive response timed out at a protocol level");
358
357
  this->stop_opentherm_();
@@ -15,21 +15,17 @@
15
15
  #include "Arduino.h"
16
16
  #endif
17
17
  #include <string>
18
- #include <sstream>
19
- #include <bitset>
20
18
 
21
19
  namespace esphome {
22
20
  namespace opentherm {
23
21
 
24
22
  using std::string;
25
- using std::bitset;
26
- using std::stringstream;
27
23
  using std::to_string;
28
24
 
29
25
  static const char *const TAG = "opentherm";
30
26
 
31
27
  #ifdef ESP8266
32
- OpenTherm *OpenTherm::instance_ = nullptr;
28
+ OpenTherm *OpenTherm::instance = nullptr;
33
29
  #endif
34
30
 
35
31
  OpenTherm::OpenTherm(InternalGPIOPin *in_pin, InternalGPIOPin *out_pin, int32_t device_timeout)
@@ -53,7 +49,7 @@ OpenTherm::OpenTherm(InternalGPIOPin *in_pin, InternalGPIOPin *out_pin, int32_t
53
49
 
54
50
  bool OpenTherm::initialize() {
55
51
  #ifdef ESP8266
56
- OpenTherm::instance_ = this;
52
+ OpenTherm::instance = this;
57
53
  #endif
58
54
  this->in_pin_->pin_mode(gpio::FLAG_INPUT);
59
55
  this->out_pin_->pin_mode(gpio::FLAG_OUTPUT);
@@ -216,7 +212,7 @@ bool IRAM_ATTR OpenTherm::timer_isr(OpenTherm *arg) {
216
212
  }
217
213
 
218
214
  #ifdef ESP8266
219
- void IRAM_ATTR OpenTherm::esp8266_timer_isr() { OpenTherm::timer_isr(OpenTherm::instance_); }
215
+ void IRAM_ATTR OpenTherm::esp8266_timer_isr() { OpenTherm::timer_isr(OpenTherm::instance); }
220
216
  #endif
221
217
 
222
218
  void IRAM_ATTR OpenTherm::bit_read_(uint8_t value) {
@@ -224,7 +220,7 @@ void IRAM_ATTR OpenTherm::bit_read_(uint8_t value) {
224
220
  this->bit_pos_++;
225
221
  }
226
222
 
227
- ProtocolErrorType OpenTherm::verify_stop_bit_(uint8_t value) {
223
+ ProtocolErrorType IRAM_ATTR OpenTherm::verify_stop_bit_(uint8_t value) {
228
224
  if (value) { // stop bit detected
229
225
  return check_parity_(this->data_) ? ProtocolErrorType::NO_ERROR : ProtocolErrorType::PARITY_ERROR;
230
226
  } else { // no stop bit detected, error
@@ -369,7 +365,7 @@ void IRAM_ATTR OpenTherm::stop_timer_() {
369
365
 
370
366
  #ifdef ESP8266
371
367
  // 5 kHz timer_
372
- void OpenTherm::start_read_timer_() {
368
+ void IRAM_ATTR OpenTherm::start_read_timer_() {
373
369
  InterruptLock const lock;
374
370
  timer1_attachInterrupt(OpenTherm::esp8266_timer_isr);
375
371
  timer1_enable(TIM_DIV16, TIM_EDGE, TIM_LOOP); // 5MHz (5 ticks/us - 1677721.4 us max)
@@ -377,14 +373,14 @@ void OpenTherm::start_read_timer_() {
377
373
  }
378
374
 
379
375
  // 2 kHz timer_
380
- void OpenTherm::start_write_timer_() {
376
+ void IRAM_ATTR OpenTherm::start_write_timer_() {
381
377
  InterruptLock const lock;
382
378
  timer1_attachInterrupt(OpenTherm::esp8266_timer_isr);
383
379
  timer1_enable(TIM_DIV16, TIM_EDGE, TIM_LOOP); // 5MHz (5 ticks/us - 1677721.4 us max)
384
380
  timer1_write(2500); // 2kHz
385
381
  }
386
382
 
387
- void OpenTherm::stop_timer_() {
383
+ void IRAM_ATTR OpenTherm::stop_timer_() {
388
384
  InterruptLock const lock;
389
385
  timer1_disable();
390
386
  timer1_detachInterrupt();
@@ -393,7 +389,7 @@ void OpenTherm::stop_timer_() {
393
389
  #endif // END ESP8266
394
390
 
395
391
  // https://stackoverflow.com/questions/21617970/how-to-check-if-value-has-even-parity-of-bits-or-odd
396
- bool OpenTherm::check_parity_(uint32_t val) {
392
+ bool IRAM_ATTR OpenTherm::check_parity_(uint32_t val) {
397
393
  val ^= val >> 16;
398
394
  val ^= val >> 8;
399
395
  val ^= val >> 4;
@@ -545,29 +541,17 @@ const char *OpenTherm::message_id_to_str(MessageId id) {
545
541
  }
546
542
  }
547
543
 
548
- string OpenTherm::debug_data(OpenthermData &data) {
549
- stringstream result;
550
- result << bitset<8>(data.type) << " " << bitset<8>(data.id) << " " << bitset<8>(data.valueHB) << " "
551
- << bitset<8>(data.valueLB) << "\n";
552
- result << "type: " << this->message_type_to_str((MessageType) data.type) << "; ";
553
- result << "id: " << to_string(data.id) << "; ";
554
- result << "HB: " << to_string(data.valueHB) << "; ";
555
- result << "LB: " << to_string(data.valueLB) << "; ";
556
- result << "uint_16: " << to_string(data.u16()) << "; ";
557
- result << "float: " << to_string(data.f88());
558
-
559
- return result.str();
544
+ void OpenTherm::debug_data(OpenthermData &data) {
545
+ ESP_LOGD(TAG, "%s %s %s %s", format_bin(data.type).c_str(), format_bin(data.id).c_str(),
546
+ format_bin(data.valueHB).c_str(), format_bin(data.valueLB).c_str());
547
+ ESP_LOGD(TAG, "type: %s; id: %s; HB: %s; LB: %s; uint_16: %s; float: %s",
548
+ this->message_type_to_str((MessageType) data.type), to_string(data.id).c_str(),
549
+ to_string(data.valueHB).c_str(), to_string(data.valueLB).c_str(), to_string(data.u16()).c_str(),
550
+ to_string(data.f88()).c_str());
560
551
  }
561
- std::string OpenTherm::debug_error(OpenThermError &error) {
562
- stringstream result;
563
- result << "type: " << this->protocol_error_to_to_str(error.error_type) << "; ";
564
- result << "data: ";
565
- result << format_hex(error.data);
566
- result << "; clock: " << to_string(clock_);
567
- result << "; capture: " << bitset<32>(error.capture);
568
- result << "; bit_pos: " << to_string(error.bit_pos);
569
-
570
- return result.str();
552
+ void OpenTherm::debug_error(OpenThermError &error) const {
553
+ ESP_LOGD(TAG, "data: %s; clock: %s; capture: %s; bit_pos: %s", format_hex(error.data).c_str(),
554
+ to_string(clock_).c_str(), format_bin(error.capture).c_str(), to_string(error.bit_pos).c_str());
571
555
  }
572
556
 
573
557
  float OpenthermData::f88() { return ((float) this->s16()) / 256.0; }
@@ -8,10 +8,9 @@
8
8
  #pragma once
9
9
 
10
10
  #include <string>
11
- #include <sstream>
12
- #include <iomanip>
13
11
  #include "esphome/core/hal.h"
14
12
  #include "esphome/core/log.h"
13
+ #include "esphome/core/helpers.h"
15
14
 
16
15
  #if defined(ESP32) || defined(USE_ESP_IDF)
17
16
  #include "driver/timer.h"
@@ -318,8 +317,8 @@ class OpenTherm {
318
317
 
319
318
  OperationMode get_mode() { return mode_; }
320
319
 
321
- std::string debug_data(OpenthermData &data);
322
- std::string debug_error(OpenThermError &error);
320
+ void debug_data(OpenthermData &data);
321
+ void debug_error(OpenThermError &error) const;
323
322
 
324
323
  const char *protocol_error_to_to_str(ProtocolErrorType error_type);
325
324
  const char *message_type_to_str(MessageType message_type);
@@ -371,7 +370,7 @@ class OpenTherm {
371
370
 
372
371
  #ifdef ESP8266
373
372
  // ESP8266 timer can accept callback with no parameters, so we have this hack to save a static instance of OpenTherm
374
- static OpenTherm *instance_;
373
+ static OpenTherm *instance; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
375
374
  #endif
376
375
  };
377
376
 
@@ -12,7 +12,7 @@ class OTAStateChangeTrigger : public Trigger<OTAState> {
12
12
  explicit OTAStateChangeTrigger(OTAComponent *parent) {
13
13
  parent->add_on_state_callback([this, parent](OTAState state, float progress, uint8_t error) {
14
14
  if (!parent->is_failed()) {
15
- return trigger(state);
15
+ trigger(state);
16
16
  }
17
17
  });
18
18
  }
@@ -32,7 +32,7 @@ void FloatOutput::set_level(float state) {
32
32
  }
33
33
  #endif
34
34
 
35
- if (!(state == 0.0f && this->zero_means_zero_)) // regardless of min_power_, 0.0 means off
35
+ if (state != 0.0f || !this->zero_means_zero_) // regardless of min_power_, 0.0 means off
36
36
  state = (state * (this->max_power_ - this->min_power_)) + this->min_power_;
37
37
 
38
38
  if (this->is_inverted())
@@ -34,7 +34,7 @@ void PCA6416AComponent::setup() {
34
34
  }
35
35
 
36
36
  // Test to see if the device supports pull-up resistors
37
- if (this->read_register(PCAL6416A_PULL_EN0, &value, 1, true) == esphome::i2c::ERROR_OK) {
37
+ if (this->read_register(PCAL6416A_PULL_EN0, &value, 1, true) == i2c::ERROR_OK) {
38
38
  this->has_pullup_ = true;
39
39
  }
40
40
 
@@ -106,7 +106,8 @@ bool PCA6416AComponent::read_register_(uint8_t reg, uint8_t *value) {
106
106
  return false;
107
107
  }
108
108
 
109
- if ((this->last_error_ = this->read_register(reg, value, 1, true)) != esphome::i2c::ERROR_OK) {
109
+ this->last_error_ = this->read_register(reg, value, 1, true);
110
+ if (this->last_error_ != i2c::ERROR_OK) {
110
111
  this->status_set_warning();
111
112
  ESP_LOGE(TAG, "read_register_(): I2C I/O error: %d", (int) this->last_error_);
112
113
  return false;
@@ -122,7 +123,8 @@ bool PCA6416AComponent::write_register_(uint8_t reg, uint8_t value) {
122
123
  return false;
123
124
  }
124
125
 
125
- if ((this->last_error_ = this->write_register(reg, &value, 1, true)) != esphome::i2c::ERROR_OK) {
126
+ this->last_error_ = this->write_register(reg, &value, 1, true);
127
+ if (this->last_error_ != i2c::ERROR_OK) {
126
128
  this->status_set_warning();
127
129
  ESP_LOGE(TAG, "write_register_(): I2C I/O error: %d", (int) this->last_error_);
128
130
  return false;
@@ -95,8 +95,8 @@ bool PCA9554Component::read_inputs_() {
95
95
  return false;
96
96
  }
97
97
 
98
- if ((this->last_error_ = this->read_register(INPUT_REG * this->reg_width_, inputs, this->reg_width_, true)) !=
99
- esphome::i2c::ERROR_OK) {
98
+ this->last_error_ = this->read_register(INPUT_REG * this->reg_width_, inputs, this->reg_width_, true);
99
+ if (this->last_error_ != i2c::ERROR_OK) {
100
100
  this->status_set_warning();
101
101
  ESP_LOGE(TAG, "read_register_(): I2C I/O error: %d", (int) this->last_error_);
102
102
  return false;
@@ -113,8 +113,8 @@ bool PCA9554Component::write_register_(uint8_t reg, uint16_t value) {
113
113
  uint8_t outputs[2];
114
114
  outputs[0] = (uint8_t) value;
115
115
  outputs[1] = (uint8_t) (value >> 8);
116
- if ((this->last_error_ = this->write_register(reg * this->reg_width_, outputs, this->reg_width_, true)) !=
117
- esphome::i2c::ERROR_OK) {
116
+ this->last_error_ = this->write_register(reg * this->reg_width_, outputs, this->reg_width_, true);
117
+ if (this->last_error_ != i2c::ERROR_OK) {
118
118
  this->status_set_warning();
119
119
  ESP_LOGE(TAG, "write_register_(): I2C I/O error: %d", (int) this->last_error_);
120
120
  return false;
@@ -790,7 +790,7 @@ uint8_t Pipsolar::check_incoming_crc_() {
790
790
  // send next command used
791
791
  uint8_t Pipsolar::send_next_command_() {
792
792
  uint16_t crc16;
793
- if (this->command_queue_[this->command_queue_position_].length() != 0) {
793
+ if (!this->command_queue_[this->command_queue_position_].empty()) {
794
794
  const char *command = this->command_queue_[this->command_queue_position_].c_str();
795
795
  uint8_t byte_command[16];
796
796
  uint8_t length = this->command_queue_[this->command_queue_position_].length();
@@ -846,7 +846,7 @@ void Pipsolar::queue_command_(const char *command, uint8_t length) {
846
846
  uint8_t next_position = command_queue_position_;
847
847
  for (uint8_t i = 0; i < COMMAND_QUEUE_LENGTH; i++) {
848
848
  uint8_t testposition = (next_position + i) % COMMAND_QUEUE_LENGTH;
849
- if (command_queue_[testposition].length() == 0) {
849
+ if (command_queue_[testposition].empty()) {
850
850
  command_queue_[testposition] = command;
851
851
  ESP_LOGD(TAG, "Command queued successfully: %s with length %u at position %d", command,
852
852
  command_queue_[testposition].length(), testposition);
@@ -10,11 +10,11 @@ static const char *const TAG = "pipsolar.switch";
10
10
  void PipsolarSwitch::dump_config() { LOG_SWITCH("", "Pipsolar Switch", this); }
11
11
  void PipsolarSwitch::write_state(bool state) {
12
12
  if (state) {
13
- if (this->on_command_.length() > 0) {
13
+ if (!this->on_command_.empty()) {
14
14
  this->parent_->switch_command(this->on_command_);
15
15
  }
16
16
  } else {
17
- if (this->off_command_.length() > 0) {
17
+ if (!this->off_command_.empty()) {
18
18
  this->parent_->switch_command(this->off_command_);
19
19
  }
20
20
  }
@@ -80,8 +80,8 @@ bool PN532::is_mifare_ultralight_formatted_(const std::vector<uint8_t> &page_3_t
80
80
  const uint8_t p4_offset = nfc::MIFARE_ULTRALIGHT_PAGE_SIZE; // page 4 will begin 4 bytes into the vector
81
81
 
82
82
  return (page_3_to_6.size() > p4_offset + 3) &&
83
- !((page_3_to_6[p4_offset + 0] == 0xFF) && (page_3_to_6[p4_offset + 1] == 0xFF) &&
84
- (page_3_to_6[p4_offset + 2] == 0xFF) && (page_3_to_6[p4_offset + 3] == 0xFF));
83
+ ((page_3_to_6[p4_offset + 0] != 0xFF) || (page_3_to_6[p4_offset + 1] != 0xFF) ||
84
+ (page_3_to_6[p4_offset + 2] != 0xFF) || (page_3_to_6[p4_offset + 3] != 0xFF));
85
85
  }
86
86
 
87
87
  uint16_t PN532::read_mifare_ultralight_capacity_() {
@@ -81,8 +81,8 @@ bool PN7150::is_mifare_ultralight_formatted_(const std::vector<uint8_t> &page_3_
81
81
  const uint8_t p4_offset = nfc::MIFARE_ULTRALIGHT_PAGE_SIZE; // page 4 will begin 4 bytes into the vector
82
82
 
83
83
  return (page_3_to_6.size() > p4_offset + 3) &&
84
- !((page_3_to_6[p4_offset + 0] == 0xFF) && (page_3_to_6[p4_offset + 1] == 0xFF) &&
85
- (page_3_to_6[p4_offset + 2] == 0xFF) && (page_3_to_6[p4_offset + 3] == 0xFF));
84
+ ((page_3_to_6[p4_offset + 0] != 0xFF) || (page_3_to_6[p4_offset + 1] != 0xFF) ||
85
+ (page_3_to_6[p4_offset + 2] != 0xFF) || (page_3_to_6[p4_offset + 3] != 0xFF));
86
86
  }
87
87
 
88
88
  uint16_t PN7150::read_mifare_ultralight_capacity_() {
@@ -81,8 +81,8 @@ bool PN7160::is_mifare_ultralight_formatted_(const std::vector<uint8_t> &page_3_
81
81
  const uint8_t p4_offset = nfc::MIFARE_ULTRALIGHT_PAGE_SIZE; // page 4 will begin 4 bytes into the vector
82
82
 
83
83
  return (page_3_to_6.size() > p4_offset + 3) &&
84
- !((page_3_to_6[p4_offset + 0] == 0xFF) && (page_3_to_6[p4_offset + 1] == 0xFF) &&
85
- (page_3_to_6[p4_offset + 2] == 0xFF) && (page_3_to_6[p4_offset + 3] == 0xFF));
84
+ ((page_3_to_6[p4_offset + 0] != 0xFF) || (page_3_to_6[p4_offset + 1] != 0xFF) ||
85
+ (page_3_to_6[p4_offset + 2] != 0xFF) || (page_3_to_6[p4_offset + 3] != 0xFF));
86
86
  }
87
87
 
88
88
  uint16_t PN7160::read_mifare_ultralight_capacity_() {
@@ -81,16 +81,39 @@ void QMC5883LComponent::dump_config() {
81
81
  }
82
82
  float QMC5883LComponent::get_setup_priority() const { return setup_priority::DATA; }
83
83
  void QMC5883LComponent::update() {
84
+ i2c::ErrorCode err;
84
85
  uint8_t status = false;
85
- this->read_byte(QMC5883L_REGISTER_STATUS, &status);
86
-
87
- // Always request X,Y,Z regardless if there are sensors for them
88
- // to avoid https://github.com/esphome/issues/issues/5731
89
- uint16_t raw_x, raw_y, raw_z;
90
- if (!this->read_byte_16_(QMC5883L_REGISTER_DATA_X_LSB, &raw_x) ||
91
- !this->read_byte_16_(QMC5883L_REGISTER_DATA_Y_LSB, &raw_y) ||
92
- !this->read_byte_16_(QMC5883L_REGISTER_DATA_Z_LSB, &raw_z)) {
93
- this->status_set_warning();
86
+ // Status byte gets cleared when data is read, so we have to read this first.
87
+ // If status and two axes are desired, it's possible to save one byte of traffic by enabling
88
+ // ROL_PNT in setup and reading 7 bytes starting at the status register.
89
+ // If status and all three axes are desired, using ROL_PNT saves you 3 bytes.
90
+ // But simply not reading status saves you 4 bytes always and is much simpler.
91
+ if (ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG) {
92
+ err = this->read_register(QMC5883L_REGISTER_STATUS, &status, 1);
93
+ if (err != i2c::ERROR_OK) {
94
+ this->status_set_warning(str_sprintf("status read failed (%d)", err).c_str());
95
+ return;
96
+ }
97
+ }
98
+
99
+ uint16_t raw[3] = {0};
100
+ // Z must always be requested, otherwise the data registers will remain locked against updates.
101
+ // Skipping the Y axis if X and Z are needed actually requires an additional byte of comms.
102
+ // Starting partway through the axes does save you traffic.
103
+ uint8_t start, dest;
104
+ if (this->heading_sensor_ != nullptr || this->x_sensor_ != nullptr) {
105
+ start = QMC5883L_REGISTER_DATA_X_LSB;
106
+ dest = 0;
107
+ } else if (this->y_sensor_ != nullptr) {
108
+ start = QMC5883L_REGISTER_DATA_Y_LSB;
109
+ dest = 1;
110
+ } else {
111
+ start = QMC5883L_REGISTER_DATA_Z_LSB;
112
+ dest = 2;
113
+ }
114
+ err = this->read_bytes_16_le_(start, &raw[dest], 3 - dest);
115
+ if (err != i2c::ERROR_OK) {
116
+ this->status_set_warning(str_sprintf("mag read failed (%d)", err).c_str());
94
117
  return;
95
118
  }
96
119
 
@@ -107,17 +130,18 @@ void QMC5883LComponent::update() {
107
130
  }
108
131
 
109
132
  // in µT
110
- const float x = int16_t(raw_x) * mg_per_bit * 0.1f;
111
- const float y = int16_t(raw_y) * mg_per_bit * 0.1f;
112
- const float z = int16_t(raw_z) * mg_per_bit * 0.1f;
133
+ const float x = int16_t(raw[0]) * mg_per_bit * 0.1f;
134
+ const float y = int16_t(raw[1]) * mg_per_bit * 0.1f;
135
+ const float z = int16_t(raw[2]) * mg_per_bit * 0.1f;
113
136
 
114
137
  float heading = atan2f(0.0f - x, y) * 180.0f / M_PI;
115
138
 
116
139
  float temp = NAN;
117
140
  if (this->temperature_sensor_ != nullptr) {
118
141
  uint16_t raw_temp;
119
- if (!this->read_byte_16_(QMC5883L_REGISTER_TEMPERATURE_LSB, &raw_temp)) {
120
- this->status_set_warning();
142
+ err = this->read_bytes_16_le_(QMC5883L_REGISTER_TEMPERATURE_LSB, &raw_temp);
143
+ if (err != i2c::ERROR_OK) {
144
+ this->status_set_warning(str_sprintf("temp read failed (%d)", err).c_str());
121
145
  return;
122
146
  }
123
147
  temp = int16_t(raw_temp) * 0.01f;
@@ -138,11 +162,13 @@ void QMC5883LComponent::update() {
138
162
  this->temperature_sensor_->publish_state(temp);
139
163
  }
140
164
 
141
- bool QMC5883LComponent::read_byte_16_(uint8_t a_register, uint16_t *data) {
142
- if (!this->read_byte_16(a_register, data))
143
- return false;
144
- *data = (*data & 0x00FF) << 8 | (*data & 0xFF00) >> 8; // Flip Byte order, LSB first;
145
- return true;
165
+ i2c::ErrorCode QMC5883LComponent::read_bytes_16_le_(uint8_t a_register, uint16_t *data, uint8_t len) {
166
+ i2c::ErrorCode err = this->read_register(a_register, reinterpret_cast<uint8_t *>(data), len * 2);
167
+ if (err != i2c::ERROR_OK)
168
+ return err;
169
+ for (size_t i = 0; i < len; i++)
170
+ data[i] = convert_little_endian(data[i]);
171
+ return err;
146
172
  }
147
173
 
148
174
  } // namespace qmc5883l
@@ -55,7 +55,7 @@ class QMC5883LComponent : public PollingComponent, public i2c::I2CDevice {
55
55
  NONE = 0,
56
56
  COMMUNICATION_FAILED,
57
57
  } error_code_;
58
- bool read_byte_16_(uint8_t a_register, uint16_t *data);
58
+ i2c::ErrorCode read_bytes_16_le_(uint8_t a_register, uint16_t *data, uint8_t len = 1);
59
59
  HighFrequencyLoopRequester high_freq_;
60
60
  };
61
61
 
@@ -146,7 +146,8 @@ void QspiDbi::draw_pixels_at(int x_start, int y_start, int w, int h, const uint8
146
146
  return;
147
147
  if (bitness != display::COLOR_BITNESS_565 || order != this->color_mode_ ||
148
148
  big_endian != (this->bit_order_ == spi::BIT_ORDER_MSB_FIRST)) {
149
- return Display::draw_pixels_at(x_start, y_start, w, h, ptr, order, bitness, big_endian, x_offset, y_offset, x_pad);
149
+ Display::draw_pixels_at(x_start, y_start, w, h, ptr, order, bitness, big_endian, x_offset, y_offset, x_pad);
150
+ return;
150
151
  } else if (this->draw_from_origin_) {
151
152
  auto stride = x_offset + w + x_pad;
152
153
  for (int y = 0; y != h; y++) {
@@ -28,7 +28,7 @@ bool RawDumper::dump(RemoteReceiveData src) {
28
28
  ESP_LOGI(TAG, "%s", buffer);
29
29
  buffer_offset = 0;
30
30
  written = sprintf(buffer, " ");
31
- if (i + 1 < src.size()) {
31
+ if (i + 1 < src.size() - 1) {
32
32
  written += sprintf(buffer + written, "%" PRId32 ", ", value);
33
33
  } else {
34
34
  written += sprintf(buffer + written, "%" PRId32, value);
@@ -1,24 +1,23 @@
1
+ from esphome import pins
1
2
  import esphome.codegen as cg
3
+ from esphome.components import esp32_rmt, remote_base
2
4
  import esphome.config_validation as cv
3
- from esphome import pins
4
- from esphome.components import remote_base, esp32_rmt
5
5
  from esphome.const import (
6
6
  CONF_BUFFER_SIZE,
7
+ CONF_CLOCK_DIVIDER,
7
8
  CONF_DUMP,
8
9
  CONF_FILTER,
9
10
  CONF_ID,
10
11
  CONF_IDLE,
12
+ CONF_MEMORY_BLOCKS,
11
13
  CONF_PIN,
14
+ CONF_RMT_CHANNEL,
12
15
  CONF_TOLERANCE,
13
16
  CONF_TYPE,
14
- CONF_MEMORY_BLOCKS,
15
- CONF_RMT_CHANNEL,
16
17
  CONF_VALUE,
17
18
  )
18
19
  from esphome.core import CORE, TimePeriod
19
20
 
20
- CONF_CLOCK_DIVIDER = "clock_divider"
21
-
22
21
  AUTO_LOAD = ["remote_base"]
23
22
  remote_receiver_ns = cg.esphome_ns.namespace("remote_receiver")
24
23
  remote_base_ns = cg.esphome_ns.namespace("remote_base")
@@ -162,7 +162,7 @@ void RotaryEncoderSensor::dump_config() {
162
162
  LOG_PIN(" Pin B: ", this->pin_b_);
163
163
  LOG_PIN(" Pin I: ", this->pin_i_);
164
164
 
165
- const LogString *restore_mode = LOG_STR("");
165
+ const LogString *restore_mode;
166
166
  switch (this->restore_mode_) {
167
167
  case ROTARY_ENCODER_RESTORE_DEFAULT_ZERO:
168
168
  restore_mode = LOG_STR("Restore (Defaults to zero)");
@@ -170,6 +170,8 @@ void RotaryEncoderSensor::dump_config() {
170
170
  case ROTARY_ENCODER_ALWAYS_ZERO:
171
171
  restore_mode = LOG_STR("Always zero");
172
172
  break;
173
+ default:
174
+ restore_mode = LOG_STR("");
173
175
  }
174
176
  ESP_LOGCONFIG(TAG, " Restore Mode: %s", LOG_STR_ARG(restore_mode));
175
177
 
@@ -17,7 +17,7 @@ from esphome.const import (
17
17
  PLATFORM_RP2040,
18
18
  )
19
19
  from esphome.core import CORE, EsphomeError, coroutine_with_priority
20
- from esphome.helpers import copy_file_if_changed, mkdir_p, write_file, read_file
20
+ from esphome.helpers import copy_file_if_changed, mkdir_p, read_file, write_file
21
21
 
22
22
  from .const import KEY_BOARD, KEY_PIO_FILES, KEY_RP2040, rp2040_ns
23
23
 
@@ -15,7 +15,7 @@ from esphome.components.libretiny.const import (
15
15
  )
16
16
  from esphome.core import CORE
17
17
 
18
- from .boards import RTL87XX_BOARDS, RTL87XX_BOARD_PINS
18
+ from .boards import RTL87XX_BOARD_PINS, RTL87XX_BOARDS
19
19
 
20
20
  CODEOWNERS = ["@kuba2k2"]
21
21
  AUTO_LOAD = ["libretiny"]
@@ -9,7 +9,7 @@ namespace safe_mode {
9
9
  class SafeModeTrigger : public Trigger<> {
10
10
  public:
11
11
  explicit SafeModeTrigger(SafeModeComponent *parent) {
12
- parent->add_on_safe_mode_callback([this, parent]() { trigger(); });
12
+ parent->add_on_safe_mode_callback([this]() { trigger(); });
13
13
  }
14
14
  };
15
15