esphome 2024.11.3__py3-none-any.whl → 2024.12.0b1__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 (178) hide show
  1. esphome/components/adc/adc_sensor.h +7 -8
  2. esphome/components/adc/adc_sensor_common.cpp +24 -0
  3. esphome/components/adc/{adc_sensor.cpp → adc_sensor_esp32.cpp} +10 -179
  4. esphome/components/adc/adc_sensor_esp8266.cpp +58 -0
  5. esphome/components/adc/adc_sensor_rp2040.cpp +93 -0
  6. esphome/components/alarm_control_panel/alarm_control_panel_call.cpp +3 -4
  7. esphome/components/animation/__init__.py +1 -2
  8. esphome/components/apds9306/apds9306.cpp +2 -1
  9. esphome/components/audio/audio.h +1 -1
  10. esphome/components/bk72xx/__init__.py +1 -1
  11. esphome/components/cse7766/cse7766.cpp +1 -1
  12. esphome/components/deep_sleep/deep_sleep_esp32.cpp +2 -2
  13. esphome/components/dht/dht.cpp +2 -1
  14. esphome/components/display/display.cpp +10 -6
  15. esphome/components/display/display.h +14 -0
  16. esphome/components/display_menu_base/__init__.py +0 -2
  17. esphome/components/display_menu_base/display_menu_base.cpp +1 -1
  18. esphome/components/dsmr/dsmr.cpp +1 -1
  19. esphome/components/esp32/__init__.py +94 -12
  20. esphome/components/esp32/boards.py +222 -14
  21. esphome/components/esp32_ble/__init__.py +22 -2
  22. esphome/components/esp32_ble/ble.cpp +13 -5
  23. esphome/components/esp32_ble/ble.h +2 -0
  24. esphome/components/esp32_ble/ble_advertising.cpp +1 -1
  25. esphome/components/esp32_ble/ble_uuid.cpp +9 -10
  26. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +4 -1
  27. esphome/components/esp32_camera_web_server/camera_web_server.h +1 -1
  28. esphome/components/esp32_rmt_led_strip/light.py +3 -3
  29. esphome/components/esp8266/__init__.py +5 -7
  30. esphome/components/ezo/ezo.cpp +14 -26
  31. esphome/components/font/__init__.py +5 -23
  32. esphome/components/font/font.cpp +5 -3
  33. esphome/components/graphical_display_menu/__init__.py +2 -0
  34. esphome/components/haier/hon_climate.cpp +79 -80
  35. esphome/components/hbridge/switch/__init__.py +44 -0
  36. esphome/components/hbridge/switch/hbridge_switch.cpp +95 -0
  37. esphome/components/hbridge/switch/hbridge_switch.h +50 -0
  38. esphome/components/hitachi_ac344/hitachi_ac344.cpp +4 -2
  39. esphome/components/hitachi_ac424/hitachi_ac424.cpp +4 -2
  40. esphome/components/homeassistant/number/homeassistant_number.cpp +3 -0
  41. esphome/components/hx711/hx711.cpp +1 -1
  42. esphome/components/hx711/hx711.h +1 -1
  43. esphome/components/i2c/i2c_bus_esp_idf.cpp +2 -2
  44. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +61 -59
  45. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -17
  46. esphome/components/ili9xxx/display.py +1 -2
  47. esphome/components/ili9xxx/ili9xxx_display.cpp +3 -2
  48. esphome/components/image/__init__.py +1 -2
  49. esphome/components/logger/logger.cpp +1 -1
  50. esphome/components/ltr501/ltr501.cpp +1 -1
  51. esphome/components/lvgl/defines.py +8 -1
  52. esphome/components/lvgl/lv_validation.py +8 -3
  53. esphome/components/lvgl/lvgl_esphome.cpp +1 -1
  54. esphome/components/lvgl/lvgl_esphome.h +16 -0
  55. esphome/components/lvgl/widgets/animimg.py +12 -17
  56. esphome/components/lvgl/widgets/img.py +1 -3
  57. esphome/components/matrix_keypad/__init__.py +15 -3
  58. esphome/components/matrix_keypad/matrix_keypad.cpp +4 -0
  59. esphome/components/matrix_keypad/matrix_keypad.h +5 -0
  60. esphome/components/max31865/max31865.cpp +4 -2
  61. esphome/components/modbus_controller/modbus_controller.cpp +24 -24
  62. esphome/components/modbus_controller/modbus_controller.h +22 -22
  63. esphome/components/modbus_controller/number/modbus_number.cpp +8 -8
  64. esphome/components/modbus_controller/number/modbus_number.h +4 -4
  65. esphome/components/modbus_controller/output/modbus_output.cpp +7 -6
  66. esphome/components/modbus_controller/output/modbus_output.h +5 -5
  67. esphome/components/modbus_controller/select/modbus_select.cpp +4 -3
  68. esphome/components/modbus_controller/select/modbus_select.h +4 -4
  69. esphome/components/modbus_controller/switch/modbus_switch.cpp +5 -5
  70. esphome/components/modbus_controller/switch/modbus_switch.h +2 -2
  71. esphome/components/mqtt/__init__.py +4 -0
  72. esphome/components/mqtt/mqtt_alarm_control_panel.cpp +2 -5
  73. esphome/components/mqtt/mqtt_backend_esp32.cpp +3 -3
  74. esphome/components/mqtt/mqtt_client.cpp +4 -0
  75. esphome/components/mqtt/mqtt_client.h +6 -0
  76. esphome/components/mqtt/mqtt_climate.cpp +13 -3
  77. esphome/components/mqtt/mqtt_sensor.cpp +2 -0
  78. esphome/components/network/ip_address.h +1 -1
  79. esphome/components/nextion/__init__.py +2 -0
  80. esphome/components/nextion/automation.h +76 -0
  81. esphome/components/nextion/base_component.py +1 -0
  82. esphome/components/nextion/binary_sensor/__init__.py +43 -2
  83. esphome/components/nextion/display.py +15 -0
  84. esphome/components/nextion/nextion.cpp +8 -5
  85. esphome/components/nextion/nextion.h +7 -0
  86. esphome/components/nextion/nextion_upload_idf.cpp +2 -2
  87. esphome/components/nextion/sensor/__init__.py +38 -5
  88. esphome/components/nextion/switch/__init__.py +38 -2
  89. esphome/components/nextion/text_sensor/__init__.py +37 -2
  90. esphome/components/nfc/ndef_record.cpp +3 -3
  91. esphome/components/online_image/__init__.py +1 -0
  92. esphome/components/opentherm/opentherm.cpp +3 -3
  93. esphome/components/opentherm/opentherm.h +1 -1
  94. esphome/components/ota/automation.h +1 -1
  95. esphome/components/output/float_output.cpp +1 -1
  96. esphome/components/pca6416a/pca6416a.cpp +5 -3
  97. esphome/components/pca9554/pca9554.cpp +4 -4
  98. esphome/components/pipsolar/pipsolar.cpp +2 -2
  99. esphome/components/pipsolar/switch/pipsolar_switch.cpp +2 -2
  100. esphome/components/pn532/pn532_mifare_ultralight.cpp +2 -2
  101. esphome/components/pn7150/pn7150_mifare_ultralight.cpp +2 -2
  102. esphome/components/pn7160/pn7160_mifare_ultralight.cpp +2 -2
  103. esphome/components/qmc5883l/qmc5883l.cpp +45 -19
  104. esphome/components/qmc5883l/qmc5883l.h +1 -1
  105. esphome/components/qspi_dbi/qspi_dbi.cpp +2 -1
  106. esphome/components/remote_base/raw_protocol.cpp +1 -1
  107. esphome/components/rotary_encoder/rotary_encoder.cpp +3 -1
  108. esphome/components/rp2040/__init__.py +1 -1
  109. esphome/components/rtl87xx/__init__.py +1 -1
  110. esphome/components/safe_mode/automation.h +1 -1
  111. esphome/components/seeed_mr60bha2/__init__.py +41 -0
  112. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +173 -0
  113. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +61 -0
  114. esphome/components/seeed_mr60bha2/sensor.py +57 -0
  115. esphome/components/seeed_mr60fda2/__init__.py +41 -0
  116. esphome/components/seeed_mr60fda2/binary_sensor.py +33 -0
  117. esphome/components/seeed_mr60fda2/button/__init__.py +45 -0
  118. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.cpp +9 -0
  119. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.h +18 -0
  120. esphome/components/seeed_mr60fda2/button/reset_radar_button.cpp +9 -0
  121. esphome/components/seeed_mr60fda2/button/reset_radar_button.h +18 -0
  122. esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp +368 -0
  123. esphome/components/seeed_mr60fda2/seeed_mr60fda2.h +101 -0
  124. esphome/components/seeed_mr60fda2/select/__init__.py +59 -0
  125. esphome/components/seeed_mr60fda2/select/height_threshold_select.cpp +15 -0
  126. esphome/components/seeed_mr60fda2/select/height_threshold_select.h +18 -0
  127. esphome/components/seeed_mr60fda2/select/install_height_select.cpp +15 -0
  128. esphome/components/seeed_mr60fda2/select/install_height_select.h +18 -0
  129. esphome/components/seeed_mr60fda2/select/sensitivity_select.cpp +15 -0
  130. esphome/components/seeed_mr60fda2/select/sensitivity_select.h +18 -0
  131. esphome/components/sen5x/sensor.py +5 -6
  132. esphome/components/shelly_dimmer/shelly_dimmer.cpp +1 -1
  133. esphome/components/sim800l/sim800l.cpp +1 -1
  134. esphome/components/sntp/sntp_component.cpp +14 -20
  135. esphome/components/sntp/sntp_component.h +6 -9
  136. esphome/components/sntp/time.py +4 -7
  137. esphome/components/sprinkler/sprinkler.cpp +2 -2
  138. esphome/components/st7735/st7735.cpp +1 -1
  139. esphome/components/st7789v/st7789v.cpp +1 -1
  140. esphome/components/stepper/stepper.h +0 -1
  141. esphome/components/sun_gtil2/sun_gtil2.cpp +1 -1
  142. esphome/components/switch/binary_sensor/__init__.py +31 -0
  143. esphome/components/switch/binary_sensor/switch_binary_sensor.cpp +17 -0
  144. esphome/components/switch/binary_sensor/switch_binary_sensor.h +22 -0
  145. esphome/components/sx1509/sx1509_gpio_pin.cpp +2 -1
  146. esphome/components/sx1509/sx1509_gpio_pin.h +5 -5
  147. esphome/components/uart/uart.h +1 -1
  148. esphome/components/udp/udp_component.cpp +32 -16
  149. esphome/components/ufire_ec/sensor.py +4 -4
  150. esphome/components/uln2003/uln2003.cpp +4 -1
  151. esphome/components/waveshare_epaper/display.py +8 -0
  152. esphome/components/waveshare_epaper/waveshare_epaper.cpp +191 -0
  153. esphome/components/waveshare_epaper/waveshare_epaper.h +56 -0
  154. esphome/components/wiegand/__init__.py +3 -4
  155. esphome/components/wifi/__init__.py +42 -0
  156. esphome/components/wifi/wifi_component.cpp +2 -2
  157. esphome/components/wifi/wifi_component.h +82 -1
  158. esphome/components/wifi/wifi_component_esp32_arduino.cpp +1 -1
  159. esphome/components/wifi/wifi_component_esp8266.cpp +1 -1
  160. esphome/components/wifi/wifi_component_esp_idf.cpp +1 -1
  161. esphome/components/wifi/wifi_component_libretiny.cpp +1 -1
  162. esphome/components/wifi/wifi_component_pico_w.cpp +1 -1
  163. esphome/components/wireguard/wireguard.cpp +2 -2
  164. esphome/components/xiaomi_ble/xiaomi_ble.cpp +1 -1
  165. esphome/config_validation.py +15 -11
  166. esphome/const.py +7 -1
  167. esphome/core/component.cpp +1 -1
  168. esphome/core/config.py +1 -2
  169. esphome/core/defines.h +3 -1
  170. esphome/core/helpers.cpp +6 -1
  171. esphome/core/helpers.h +2 -1
  172. esphome/core/optional.h +2 -2
  173. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/METADATA +3 -3
  174. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/RECORD +178 -149
  175. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/LICENSE +0 -0
  176. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/WHEEL +0 -0
  177. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/entry_points.txt +0 -0
  178. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/top_level.txt +0 -0
@@ -1,19 +1,19 @@
1
- import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
- from esphome.components import i2c, sensor, sensirion_common
4
1
  from esphome import automation
5
2
  from esphome.automation import maybe_simple_id
6
-
3
+ import esphome.codegen as cg
4
+ from esphome.components import i2c, sensirion_common, sensor
5
+ import esphome.config_validation as cv
7
6
  from esphome.const import (
8
7
  CONF_HUMIDITY,
9
8
  CONF_ID,
10
9
  CONF_OFFSET,
11
10
  CONF_PM_1_0,
12
- CONF_PM_10_0,
13
11
  CONF_PM_2_5,
14
12
  CONF_PM_4_0,
13
+ CONF_PM_10_0,
15
14
  CONF_STORE_BASELINE,
16
15
  CONF_TEMPERATURE,
16
+ CONF_TEMPERATURE_COMPENSATION,
17
17
  DEVICE_CLASS_AQI,
18
18
  DEVICE_CLASS_HUMIDITY,
19
19
  DEVICE_CLASS_PM1,
@@ -51,7 +51,6 @@ CONF_LEARNING_TIME_OFFSET_HOURS = "learning_time_offset_hours"
51
51
  CONF_NORMALIZED_OFFSET_SLOPE = "normalized_offset_slope"
52
52
  CONF_NOX = "nox"
53
53
  CONF_STD_INITIAL = "std_initial"
54
- CONF_TEMPERATURE_COMPENSATION = "temperature_compensation"
55
54
  CONF_TIME_CONSTANT = "time_constant"
56
55
  CONF_VOC = "voc"
57
56
  CONF_VOC_BASELINE = "voc_baseline"
@@ -466,7 +466,7 @@ bool ShellyDimmer::handle_frame_() {
466
466
  }
467
467
  case SHELLY_DIMMER_PROTO_CMD_SWITCH:
468
468
  case SHELLY_DIMMER_PROTO_CMD_SETTINGS: {
469
- return !(payload_len < 1 || payload[0] != 0x01);
469
+ return payload_len >= 1 && payload[0] == 0x01;
470
470
  }
471
471
  default: {
472
472
  return false;
@@ -324,7 +324,7 @@ void Sim800LComponent::parse_cmd_(std::string message) {
324
324
  this->sms_received_callback_.call(this->message_, this->sender_);
325
325
  this->state_ = STATE_RECEIVED_SMS;
326
326
  } else {
327
- if (this->message_.length() > 0)
327
+ if (!this->message_.empty())
328
328
  this->message_ += "\n";
329
329
  this->message_ += message;
330
330
  }
@@ -9,11 +9,6 @@
9
9
  #include "lwip/apps/sntp.h"
10
10
  #endif
11
11
 
12
- // Yes, the server names are leaked, but that's fine.
13
- #ifdef CLANG_TIDY
14
- #define strdup(x) (const_cast<char *>(x))
15
- #endif
16
-
17
12
  namespace esphome {
18
13
  namespace sntp {
19
14
 
@@ -26,30 +21,29 @@ void SNTPComponent::setup() {
26
21
  esp_sntp_stop();
27
22
  }
28
23
  esp_sntp_setoperatingmode(ESP_SNTP_OPMODE_POLL);
24
+ size_t i = 0;
25
+ for (auto &server : this->servers_) {
26
+ esp_sntp_setservername(i++, server.c_str());
27
+ }
28
+ esp_sntp_set_sync_interval(this->get_update_interval());
29
+ esp_sntp_init();
29
30
  #else
30
31
  sntp_stop();
31
32
  sntp_setoperatingmode(SNTP_OPMODE_POLL);
32
- #endif
33
33
 
34
- sntp_setservername(0, strdup(this->server_1_.c_str()));
35
- if (!this->server_2_.empty()) {
36
- sntp_setservername(1, strdup(this->server_2_.c_str()));
37
- }
38
- if (!this->server_3_.empty()) {
39
- sntp_setservername(2, strdup(this->server_3_.c_str()));
34
+ size_t i = 0;
35
+ for (auto &server : this->servers_) {
36
+ sntp_setservername(i++, server.c_str());
40
37
  }
41
- #ifdef USE_ESP_IDF
42
- esp_sntp_set_sync_interval(this->get_update_interval());
43
- #endif
44
-
45
38
  sntp_init();
39
+ #endif
46
40
  }
47
41
  void SNTPComponent::dump_config() {
48
42
  ESP_LOGCONFIG(TAG, "SNTP Time:");
49
- ESP_LOGCONFIG(TAG, " Server 1: '%s'", this->server_1_.c_str());
50
- ESP_LOGCONFIG(TAG, " Server 2: '%s'", this->server_2_.c_str());
51
- ESP_LOGCONFIG(TAG, " Server 3: '%s'", this->server_3_.c_str());
52
- ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
43
+ size_t i = 0;
44
+ for (auto &server : this->servers_) {
45
+ ESP_LOGCONFIG(TAG, " Server %zu: '%s'", i++, server.c_str());
46
+ }
53
47
  }
54
48
  void SNTPComponent::update() {
55
49
  #if !defined(USE_ESP_IDF)
@@ -14,23 +14,20 @@ namespace sntp {
14
14
  /// \see https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
15
15
  class SNTPComponent : public time::RealTimeClock {
16
16
  public:
17
+ SNTPComponent(const std::vector<std::string> &servers) : servers_(servers) {}
18
+
19
+ // Note: set_servers() has been removed and replaced by a constructor - calling set_servers after setup would
20
+ // have had no effect anyway, and making the strings immutable avoids the need to strdup their contents.
21
+
17
22
  void setup() override;
18
23
  void dump_config() override;
19
- /// Change the servers used by SNTP for timekeeping
20
- void set_servers(const std::string &server_1, const std::string &server_2, const std::string &server_3) {
21
- this->server_1_ = server_1;
22
- this->server_2_ = server_2;
23
- this->server_3_ = server_3;
24
- }
25
24
  float get_setup_priority() const override { return setup_priority::BEFORE_CONNECTION; }
26
25
 
27
26
  void update() override;
28
27
  void loop() override;
29
28
 
30
29
  protected:
31
- std::string server_1_;
32
- std::string server_2_;
33
- std::string server_3_;
30
+ std::vector<std::string> servers_;
34
31
  bool has_time_{false};
35
32
  };
36
33
 
@@ -1,16 +1,16 @@
1
+ import esphome.codegen as cg
1
2
  from esphome.components import time as time_
2
3
  import esphome.config_validation as cv
3
- import esphome.codegen as cg
4
- from esphome.core import CORE
5
4
  from esphome.const import (
6
5
  CONF_ID,
7
6
  CONF_SERVERS,
7
+ PLATFORM_BK72XX,
8
8
  PLATFORM_ESP32,
9
9
  PLATFORM_ESP8266,
10
10
  PLATFORM_RP2040,
11
11
  PLATFORM_RTL87XX,
12
- PLATFORM_BK72XX,
13
12
  )
13
+ from esphome.core import CORE
14
14
 
15
15
  DEPENDENCIES = ["network"]
16
16
  sntp_ns = cg.esphome_ns.namespace("sntp")
@@ -40,11 +40,8 @@ CONFIG_SCHEMA = cv.All(
40
40
 
41
41
 
42
42
  async def to_code(config):
43
- var = cg.new_Pvariable(config[CONF_ID])
44
-
45
43
  servers = config[CONF_SERVERS]
46
- servers += [""] * (3 - len(servers))
47
- cg.add(var.set_servers(*servers))
44
+ var = cg.new_Pvariable(config[CONF_ID], servers)
48
45
 
49
46
  await cg.register_component(var, config)
50
47
  await time_.register_time(var, config)
@@ -419,7 +419,7 @@ void Sprinkler::add_valve(SprinklerControllerSwitch *valve_sw, SprinklerControll
419
419
  SprinklerValve *new_valve = &this->valve_[new_valve_number];
420
420
 
421
421
  new_valve->controller_switch = valve_sw;
422
- new_valve->controller_switch->set_state_lambda([=]() -> optional<bool> {
422
+ new_valve->controller_switch->set_state_lambda([this, new_valve_number]() -> optional<bool> {
423
423
  if (this->valve_pump_switch(new_valve_number) != nullptr) {
424
424
  return this->valve_switch(new_valve_number)->state() && this->valve_pump_switch(new_valve_number)->state();
425
425
  }
@@ -445,7 +445,7 @@ void Sprinkler::add_controller(Sprinkler *other_controller) { this->other_contro
445
445
 
446
446
  void Sprinkler::set_controller_main_switch(SprinklerControllerSwitch *controller_switch) {
447
447
  this->controller_sw_ = controller_switch;
448
- controller_switch->set_state_lambda([=]() -> optional<bool> {
448
+ controller_switch->set_state_lambda([this]() -> optional<bool> {
449
449
  for (size_t valve_number = 0; valve_number < this->number_of_valves(); valve_number++) {
450
450
  if (this->valve_[valve_number].controller_switch->state) {
451
451
  return true;
@@ -483,7 +483,7 @@ void ST7735::spi_master_write_color_(uint16_t color, uint16_t size) {
483
483
  }
484
484
 
485
485
  this->dc_pin_->digital_write(true);
486
- return write_array(byte, size * 2);
486
+ write_array(byte, size * 2);
487
487
  }
488
488
 
489
489
  } // namespace st7735
@@ -252,7 +252,7 @@ void ST7789V::write_color_(uint16_t color, uint16_t size) {
252
252
  }
253
253
 
254
254
  this->dc_pin_->digital_write(true);
255
- return write_array(byte, size * 2);
255
+ write_array(byte, size * 2);
256
256
  }
257
257
 
258
258
  size_t ST7789V::get_buffer_length_() {
@@ -2,7 +2,6 @@
2
2
 
3
3
  #include "esphome/core/component.h"
4
4
  #include "esphome/core/automation.h"
5
- #include "esphome/components/stepper/stepper.h"
6
5
 
7
6
  namespace esphome {
8
7
  namespace stepper {
@@ -83,7 +83,7 @@ void SunGTIL2::handle_char_(uint8_t c) {
83
83
  memcpy(&msg, this->rx_message_.data(), MESSAGE_SIZE);
84
84
  this->rx_message_.clear();
85
85
 
86
- if (!((msg.end[0] == 0) && (msg.end[38] == 0x08)))
86
+ if ((msg.end[0] != 0) || (msg.end[38] != 0x08))
87
87
  return;
88
88
 
89
89
  ESP_LOGVV(TAG, "Frequency raw value: %02x", msg.frequency);
@@ -0,0 +1,31 @@
1
+ import esphome.codegen as cg
2
+ from esphome.components import binary_sensor
3
+ import esphome.config_validation as cv
4
+ from esphome.const import CONF_SOURCE_ID
5
+
6
+ from .. import Switch, switch_ns
7
+
8
+ CODEOWNERS = ["@ssieb"]
9
+
10
+ SwitchBinarySensor = switch_ns.class_(
11
+ "SwitchBinarySensor", binary_sensor.BinarySensor, cg.Component
12
+ )
13
+
14
+
15
+ CONFIG_SCHEMA = (
16
+ binary_sensor.binary_sensor_schema(SwitchBinarySensor)
17
+ .extend(
18
+ {
19
+ cv.Required(CONF_SOURCE_ID): cv.use_id(Switch),
20
+ }
21
+ )
22
+ .extend(cv.COMPONENT_SCHEMA)
23
+ )
24
+
25
+
26
+ async def to_code(config):
27
+ var = await binary_sensor.new_binary_sensor(config)
28
+ await cg.register_component(var, config)
29
+
30
+ source = await cg.get_variable(config[CONF_SOURCE_ID])
31
+ cg.add(var.set_source(source))
@@ -0,0 +1,17 @@
1
+ #include "switch_binary_sensor.h"
2
+ #include "esphome/core/log.h"
3
+
4
+ namespace esphome {
5
+ namespace switch_ {
6
+
7
+ static const char *const TAG = "switch.binary_sensor";
8
+
9
+ void SwitchBinarySensor::setup() {
10
+ source_->add_on_state_callback([this](bool value) { this->publish_state(value); });
11
+ this->publish_state(source_->state);
12
+ }
13
+
14
+ void SwitchBinarySensor::dump_config() { LOG_BINARY_SENSOR("", "Switch Binary Sensor", this); }
15
+
16
+ } // namespace switch_
17
+ } // namespace esphome
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #include "../switch.h"
4
+ #include "esphome/core/component.h"
5
+ #include "esphome/components/binary_sensor/binary_sensor.h"
6
+
7
+ namespace esphome {
8
+ namespace switch_ {
9
+
10
+ class SwitchBinarySensor : public binary_sensor::BinarySensor, public Component {
11
+ public:
12
+ void set_source(Switch *source) { source_ = source; }
13
+ void setup() override;
14
+ void dump_config() override;
15
+ float get_setup_priority() const override { return setup_priority::DATA; }
16
+
17
+ protected:
18
+ Switch *source_;
19
+ };
20
+
21
+ } // namespace switch_
22
+ } // namespace esphome
@@ -1,5 +1,6 @@
1
1
  #include "esphome/core/helpers.h"
2
2
  #include "esphome/core/log.h"
3
+ #include "sx1509.h"
3
4
  #include "sx1509_gpio_pin.h"
4
5
 
5
6
  namespace esphome {
@@ -13,7 +14,7 @@ bool SX1509GPIOPin::digital_read() { return this->parent_->digital_read(this->pi
13
14
  void SX1509GPIOPin::digital_write(bool value) { this->parent_->digital_write(this->pin_, value != this->inverted_); }
14
15
  std::string SX1509GPIOPin::dump_summary() const {
15
16
  char buffer[32];
16
- snprintf(buffer, sizeof(buffer), "%u via sx1509", pin_);
17
+ snprintf(buffer, sizeof(buffer), "%u via sx1509", this->pin_);
17
18
  return buffer;
18
19
  }
19
20
 
@@ -1,6 +1,6 @@
1
1
  #pragma once
2
2
 
3
- #include "sx1509.h"
3
+ #include "esphome/core/gpio.h"
4
4
 
5
5
  namespace esphome {
6
6
  namespace sx1509 {
@@ -15,10 +15,10 @@ class SX1509GPIOPin : public GPIOPin {
15
15
  void digital_write(bool value) override;
16
16
  std::string dump_summary() const override;
17
17
 
18
- void set_parent(SX1509Component *parent) { parent_ = parent; }
19
- void set_pin(uint8_t pin) { pin_ = pin; }
20
- void set_inverted(bool inverted) { inverted_ = inverted; }
21
- void set_flags(gpio::Flags flags) { flags_ = flags; }
18
+ void set_parent(SX1509Component *parent) { this->parent_ = parent; }
19
+ void set_pin(uint8_t pin) { this->pin_ = pin; }
20
+ void set_inverted(bool inverted) { this->inverted_ = inverted; }
21
+ void set_flags(gpio::Flags flags) { this->flags_ = flags; }
22
22
 
23
23
  protected:
24
24
  SX1509Component *parent_;
@@ -40,7 +40,7 @@ class UARTDevice {
40
40
 
41
41
  int available() { return this->parent_->available(); }
42
42
 
43
- void flush() { return this->parent_->flush(); }
43
+ void flush() { this->parent_->flush(); }
44
44
 
45
45
  // Compat APIs
46
46
  int read() {
@@ -434,7 +434,8 @@ static bool process_rolling_code(Provider &provider, uint8_t *&buf, const uint8_
434
434
  void UDPComponent::process_(uint8_t *buf, const size_t len) {
435
435
  auto ping_key_seen = !this->ping_pong_enable_;
436
436
  if (len < 8) {
437
- return ESP_LOGV(TAG, "Bad length %zu", len);
437
+ ESP_LOGV(TAG, "Bad length %zu", len);
438
+ return;
438
439
  }
439
440
  char namebuf[256]{};
440
441
  uint8_t byte;
@@ -442,31 +443,40 @@ void UDPComponent::process_(uint8_t *buf, const size_t len) {
442
443
  const uint8_t *end = buf + len;
443
444
  FuData rdata{};
444
445
  auto magic = get_uint16(buf);
445
- if (magic != MAGIC_NUMBER && magic != MAGIC_PING)
446
- return ESP_LOGV(TAG, "Bad magic %X", magic);
446
+ if (magic != MAGIC_NUMBER && magic != MAGIC_PING) {
447
+ ESP_LOGV(TAG, "Bad magic %X", magic);
448
+ return;
449
+ }
447
450
 
448
451
  auto hlen = *buf++;
449
452
  if (hlen > len - 3) {
450
- return ESP_LOGV(TAG, "Bad hostname length %u > %zu", hlen, len - 3);
453
+ ESP_LOGV(TAG, "Bad hostname length %u > %zu", hlen, len - 3);
454
+ return;
451
455
  }
452
456
  memcpy(namebuf, buf, hlen);
453
457
  if (strcmp(this->name_, namebuf) == 0) {
454
- return ESP_LOGV(TAG, "Ignoring our own data");
458
+ ESP_LOGV(TAG, "Ignoring our own data");
459
+ return;
455
460
  }
456
461
  buf += hlen;
457
- if (magic == MAGIC_PING)
458
- return this->process_ping_request_(namebuf, buf, end - buf);
462
+ if (magic == MAGIC_PING) {
463
+ this->process_ping_request_(namebuf, buf, end - buf);
464
+ return;
465
+ }
459
466
  if (round4(len) != len) {
460
- return ESP_LOGW(TAG, "Bad length %zu", len);
467
+ ESP_LOGW(TAG, "Bad length %zu", len);
468
+ return;
461
469
  }
462
470
  hlen = round4(hlen + 3);
463
471
  buf = start_ptr + hlen;
464
472
  if (buf == end) {
465
- return ESP_LOGV(TAG, "No data after header");
473
+ ESP_LOGV(TAG, "No data after header");
474
+ return;
466
475
  }
467
476
 
468
477
  if (this->providers_.count(namebuf) == 0) {
469
- return ESP_LOGVV(TAG, "Unknown hostname %s", namebuf);
478
+ ESP_LOGVV(TAG, "Unknown hostname %s", namebuf);
479
+ return;
470
480
  }
471
481
  auto &provider = this->providers_[namebuf];
472
482
  // if encryption not used with this host, ping check is pointless since it would be easily spoofed.
@@ -489,7 +499,8 @@ void UDPComponent::process_(uint8_t *buf, const size_t len) {
489
499
  if (!process_rolling_code(provider, buf, end))
490
500
  return;
491
501
  } else if (byte != DATA_KEY) {
492
- return ESP_LOGV(TAG, "Expected rolling_key or data_key, got %X", byte);
502
+ ESP_LOGV(TAG, "Expected rolling_key or data_key, got %X", byte);
503
+ return;
493
504
  }
494
505
  while (buf < end) {
495
506
  byte = *buf++;
@@ -497,7 +508,8 @@ void UDPComponent::process_(uint8_t *buf, const size_t len) {
497
508
  continue;
498
509
  if (byte == PING_KEY) {
499
510
  if (end - buf < 4) {
500
- return ESP_LOGV(TAG, "PING_KEY requires 4 more bytes");
511
+ ESP_LOGV(TAG, "PING_KEY requires 4 more bytes");
512
+ return;
501
513
  }
502
514
  auto key = get_uint32(buf);
503
515
  if (key == this->ping_key_) {
@@ -515,21 +527,25 @@ void UDPComponent::process_(uint8_t *buf, const size_t len) {
515
527
  }
516
528
  if (byte == BINARY_SENSOR_KEY) {
517
529
  if (end - buf < 3) {
518
- return ESP_LOGV(TAG, "Binary sensor key requires at least 3 more bytes");
530
+ ESP_LOGV(TAG, "Binary sensor key requires at least 3 more bytes");
531
+ return;
519
532
  }
520
533
  rdata.u32 = *buf++;
521
534
  } else if (byte == SENSOR_KEY) {
522
535
  if (end - buf < 6) {
523
- return ESP_LOGV(TAG, "Sensor key requires at least 6 more bytes");
536
+ ESP_LOGV(TAG, "Sensor key requires at least 6 more bytes");
537
+ return;
524
538
  }
525
539
  rdata.u32 = get_uint32(buf);
526
540
  } else {
527
- return ESP_LOGW(TAG, "Unknown key byte %X", byte);
541
+ ESP_LOGW(TAG, "Unknown key byte %X", byte);
542
+ return;
528
543
  }
529
544
 
530
545
  hlen = *buf++;
531
546
  if (end - buf < hlen) {
532
- return ESP_LOGV(TAG, "Name length of %u not available", hlen);
547
+ ESP_LOGV(TAG, "Name length of %u not available", hlen);
548
+ return;
533
549
  }
534
550
  memset(namebuf, 0, sizeof namebuf);
535
551
  memcpy(namebuf, buf, hlen);
@@ -1,11 +1,12 @@
1
- import esphome.codegen as cg
2
1
  from esphome import automation
3
- import esphome.config_validation as cv
2
+ import esphome.codegen as cg
4
3
  from esphome.components import i2c, sensor
4
+ import esphome.config_validation as cv
5
5
  from esphome.const import (
6
- CONF_ID,
7
6
  CONF_EC,
7
+ CONF_ID,
8
8
  CONF_TEMPERATURE,
9
+ CONF_TEMPERATURE_COMPENSATION,
9
10
  DEVICE_CLASS_EMPTY,
10
11
  DEVICE_CLASS_TEMPERATURE,
11
12
  ICON_EMPTY,
@@ -18,7 +19,6 @@ DEPENDENCIES = ["i2c"]
18
19
 
19
20
  CONF_SOLUTION = "solution"
20
21
  CONF_TEMPERATURE_SENSOR = "temperature_sensor"
21
- CONF_TEMPERATURE_COMPENSATION = "temperature_compensation"
22
22
  CONF_TEMPERATURE_COEFFICIENT = "temperature_coefficient"
23
23
 
24
24
  ufire_ec_ns = cg.esphome_ns.namespace("ufire_ec")
@@ -40,7 +40,7 @@ void ULN2003::dump_config() {
40
40
  LOG_PIN(" Pin C: ", this->pin_c_);
41
41
  LOG_PIN(" Pin D: ", this->pin_d_);
42
42
  ESP_LOGCONFIG(TAG, " Sleep when done: %s", YESNO(this->sleep_when_done_));
43
- const char *step_mode_s = "";
43
+ const char *step_mode_s;
44
44
  switch (this->step_mode_) {
45
45
  case ULN2003_STEP_MODE_FULL_STEP:
46
46
  step_mode_s = "FULL STEP";
@@ -51,6 +51,9 @@ void ULN2003::dump_config() {
51
51
  case ULN2003_STEP_MODE_WAVE_DRIVE:
52
52
  step_mode_s = "WAVE DRIVE";
53
53
  break;
54
+ default:
55
+ step_mode_s = "UNKNOWN";
56
+ break;
54
57
  }
55
58
  ESP_LOGCONFIG(TAG, " Step Mode: %s", step_mode_s);
56
59
  }
@@ -27,6 +27,9 @@ WaveshareEPaperBWR = waveshare_epaper_ns.class_(
27
27
  WaveshareEPaperTypeA = waveshare_epaper_ns.class_(
28
28
  "WaveshareEPaperTypeA", WaveshareEPaper
29
29
  )
30
+ WaveshareEpaper1P54INBV2 = waveshare_epaper_ns.class_(
31
+ "WaveshareEPaper1P54InBV2", WaveshareEPaperBWR
32
+ )
30
33
  WaveshareEPaper2P7In = waveshare_epaper_ns.class_(
31
34
  "WaveshareEPaper2P7In", WaveshareEPaper
32
35
  )
@@ -76,6 +79,9 @@ WaveshareEPaper7P5InBV2 = waveshare_epaper_ns.class_(
76
79
  WaveshareEPaper7P5InBV3 = waveshare_epaper_ns.class_(
77
80
  "WaveshareEPaper7P5InBV3", WaveshareEPaper
78
81
  )
82
+ WaveshareEPaper7P5InBV3BWR = waveshare_epaper_ns.class_(
83
+ "WaveshareEPaper7P5InBV3BWR", WaveshareEPaperBWR
84
+ )
79
85
  WaveshareEPaper7P5InV2 = waveshare_epaper_ns.class_(
80
86
  "WaveshareEPaper7P5InV2", WaveshareEPaper
81
87
  )
@@ -105,6 +111,7 @@ WaveshareEPaperTypeBModel = waveshare_epaper_ns.enum("WaveshareEPaperTypeBModel"
105
111
  MODELS = {
106
112
  "1.54in": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_1_54_IN),
107
113
  "1.54inv2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_1_54_IN_V2),
114
+ "1.54inv2-b": ("b", WaveshareEpaper1P54INBV2),
108
115
  "2.13in": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_13_IN),
109
116
  "2.13inv2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_13_IN_V2),
110
117
  "2.13in-ttgo": ("a", WaveshareEPaperTypeAModel.TTGO_EPAPER_2_13_IN),
@@ -129,6 +136,7 @@ MODELS = {
129
136
  "7.50in": ("b", WaveshareEPaper7P5In),
130
137
  "7.50in-bv2": ("b", WaveshareEPaper7P5InBV2),
131
138
  "7.50in-bv3": ("b", WaveshareEPaper7P5InBV3),
139
+ "7.50in-bv3-bwr": ("b", WaveshareEPaper7P5InBV3BWR),
132
140
  "7.50in-bc": ("b", WaveshareEPaper7P5InBC),
133
141
  "7.50inv2": ("b", WaveshareEPaper7P5InV2),
134
142
  "7.50inv2alt": ("b", WaveshareEPaper7P5InV2alt),