esphome 2024.12.4__py3-none-any.whl → 2025.2.0b2__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 (358) hide show
  1. esphome/__main__.py +16 -3
  2. esphome/components/adc/__init__.py +17 -11
  3. esphome/components/adc/adc_sensor.h +17 -0
  4. esphome/components/adc/adc_sensor_common.cpp +55 -0
  5. esphome/components/adc/adc_sensor_esp32.cpp +8 -5
  6. esphome/components/adc/adc_sensor_esp8266.cpp +10 -6
  7. esphome/components/adc/adc_sensor_libretiny.cpp +11 -6
  8. esphome/components/adc/adc_sensor_rp2040.cpp +13 -10
  9. esphome/components/adc/sensor.py +9 -3
  10. esphome/components/ads1115/ads1115.cpp +56 -7
  11. esphome/components/ads1115/ads1115.h +13 -1
  12. esphome/components/ads1115/sensor/__init__.py +16 -0
  13. esphome/components/ads1115/sensor/ads1115_sensor.cpp +2 -1
  14. esphome/components/ads1115/sensor/ads1115_sensor.h +2 -0
  15. esphome/components/animation/__init__.py +23 -261
  16. esphome/components/animation/animation.cpp +2 -2
  17. esphome/components/animation/animation.h +2 -1
  18. esphome/components/api/api_pb2.cpp +14 -0
  19. esphome/components/api/api_pb2.h +1 -0
  20. esphome/components/audio/__init__.py +112 -0
  21. esphome/components/audio/audio.cpp +67 -0
  22. esphome/components/audio/audio.h +125 -7
  23. esphome/components/audio/audio_decoder.cpp +361 -0
  24. esphome/components/audio/audio_decoder.h +135 -0
  25. esphome/components/audio/audio_reader.cpp +308 -0
  26. esphome/components/audio/audio_reader.h +85 -0
  27. esphome/components/audio/audio_resampler.cpp +159 -0
  28. esphome/components/audio/audio_resampler.h +101 -0
  29. esphome/components/audio/audio_transfer_buffer.cpp +165 -0
  30. esphome/components/audio/audio_transfer_buffer.h +139 -0
  31. esphome/components/audio_adc/__init__.py +41 -0
  32. esphome/components/audio_adc/audio_adc.h +17 -0
  33. esphome/components/audio_adc/automation.h +23 -0
  34. esphome/components/bk72xx/__init__.py +1 -0
  35. esphome/components/ble_client/ble_client.cpp +1 -2
  36. esphome/components/ble_client/sensor/__init__.py +1 -1
  37. esphome/components/ble_client/text_sensor/__init__.py +1 -1
  38. esphome/components/bluetooth_proxy/bluetooth_connection.cpp +5 -0
  39. esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -0
  40. esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
  41. esphome/components/ch422g/ch422g.h +2 -0
  42. esphome/components/climate/__init__.py +1 -1
  43. esphome/components/climate_ir/climate_ir.cpp +2 -1
  44. esphome/components/coolix/coolix.cpp +2 -1
  45. esphome/components/cse7766/cse7766.cpp +8 -16
  46. esphome/components/custom/__init__.py +0 -3
  47. esphome/components/custom/binary_sensor/__init__.py +2 -28
  48. esphome/components/custom/climate/__init__.py +2 -27
  49. esphome/components/custom/cover/__init__.py +2 -27
  50. esphome/components/custom/light/__init__.py +2 -27
  51. esphome/components/custom/output/__init__.py +2 -58
  52. esphome/components/custom/sensor/__init__.py +2 -24
  53. esphome/components/custom/switch/__init__.py +2 -24
  54. esphome/components/custom/text_sensor/__init__.py +2 -29
  55. esphome/components/custom_component/__init__.py +3 -27
  56. esphome/components/daly_bms/daly_bms.cpp +6 -0
  57. esphome/components/daly_bms/daly_bms.h +2 -0
  58. esphome/components/daly_bms/sensor.py +6 -0
  59. esphome/components/debug/debug_component.cpp +4 -0
  60. esphome/components/debug/debug_component.h +14 -0
  61. esphome/components/debug/debug_esp32.cpp +154 -74
  62. esphome/components/dfplayer/dfplayer.cpp +15 -2
  63. esphome/components/dfrobot_sen0395/dfrobot_sen0395.cpp +2 -1
  64. esphome/components/dht/dht.cpp +2 -1
  65. esphome/components/display/__init__.py +18 -5
  66. esphome/components/display/display.cpp +2 -1
  67. esphome/components/display/rect.cpp +2 -1
  68. esphome/components/es7210/__init__.py +0 -0
  69. esphome/components/es7210/audio_adc.py +51 -0
  70. esphome/components/es7210/es7210.cpp +228 -0
  71. esphome/components/es7210/es7210.h +62 -0
  72. esphome/components/es7210/es7210_const.h +129 -0
  73. esphome/components/es7243e/__init__.py +0 -0
  74. esphome/components/es7243e/audio_adc.py +34 -0
  75. esphome/components/es7243e/es7243e.cpp +125 -0
  76. esphome/components/es7243e/es7243e.h +37 -0
  77. esphome/components/es7243e/es7243e_const.h +54 -0
  78. esphome/components/es8156/__init__.py +0 -0
  79. esphome/components/es8156/audio_dac.py +27 -0
  80. esphome/components/es8156/es8156.cpp +87 -0
  81. esphome/components/es8156/es8156.h +51 -0
  82. esphome/components/es8156/es8156_const.h +68 -0
  83. esphome/components/es8311/audio_dac.py +1 -2
  84. esphome/components/esp32/__init__.py +1 -0
  85. esphome/components/esp32/core.cpp +5 -1
  86. esphome/components/esp32/gpio.h +2 -0
  87. esphome/components/esp32_ble/__init__.py +39 -0
  88. esphome/components/esp32_ble/queue.h +4 -4
  89. esphome/components/esp32_ble_client/ble_client_base.cpp +46 -0
  90. esphome/components/esp32_ble_client/ble_client_base.h +2 -0
  91. esphome/components/esp32_ble_server/__init__.py +582 -12
  92. esphome/components/esp32_ble_server/ble_characteristic.cpp +48 -60
  93. esphome/components/esp32_ble_server/ble_characteristic.h +24 -17
  94. esphome/components/esp32_ble_server/ble_descriptor.cpp +21 -9
  95. esphome/components/esp32_ble_server/ble_descriptor.h +17 -6
  96. esphome/components/esp32_ble_server/ble_server.cpp +62 -67
  97. esphome/components/esp32_ble_server/ble_server.h +28 -32
  98. esphome/components/esp32_ble_server/ble_server_automations.cpp +77 -0
  99. esphome/components/esp32_ble_server/ble_server_automations.h +115 -0
  100. esphome/components/esp32_ble_server/ble_service.cpp +17 -15
  101. esphome/components/esp32_ble_server/ble_service.h +10 -14
  102. esphome/components/esp32_ble_tracker/__init__.py +6 -39
  103. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +33 -10
  104. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +8 -4
  105. esphome/components/esp32_improv/__init__.py +2 -8
  106. esphome/components/esp32_improv/esp32_improv_component.cpp +21 -20
  107. esphome/components/esp32_improv/esp32_improv_component.h +3 -4
  108. esphome/components/esp32_rmt/__init__.py +28 -3
  109. esphome/components/esp32_rmt_led_strip/led_strip.cpp +73 -6
  110. esphome/components/esp32_rmt_led_strip/led_strip.h +21 -3
  111. esphome/components/esp32_rmt_led_strip/light.py +72 -7
  112. esphome/components/esp32_touch/esp32_touch.cpp +5 -0
  113. esphome/components/esp8266/__init__.py +1 -0
  114. esphome/components/esp8266/gpio.h +1 -0
  115. esphome/components/ethernet/__init__.py +10 -10
  116. esphome/components/event/event.cpp +4 -2
  117. esphome/components/event/event.h +2 -0
  118. esphome/components/event_emitter/__init__.py +5 -0
  119. esphome/components/event_emitter/event_emitter.cpp +14 -0
  120. esphome/components/event_emitter/event_emitter.h +63 -0
  121. esphome/components/gcja5/gcja5.cpp +2 -1
  122. esphome/components/graph/graph.cpp +4 -9
  123. esphome/components/haier/haier_base.cpp +2 -1
  124. esphome/components/haier/hon_climate.cpp +2 -1
  125. esphome/components/heatpumpir/heatpumpir.cpp +2 -1
  126. esphome/components/host/__init__.py +1 -0
  127. esphome/components/host/gpio.h +1 -0
  128. esphome/components/http_request/http_request.h +2 -2
  129. esphome/components/http_request/http_request_arduino.cpp +1 -1
  130. esphome/components/http_request/http_request_idf.cpp +1 -1
  131. esphome/components/i2c/i2c_bus_esp_idf.cpp +4 -0
  132. esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +7 -5
  133. esphome/components/i2s_audio/speaker/__init__.py +53 -6
  134. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +92 -46
  135. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -0
  136. esphome/components/ili9xxx/display.py +29 -11
  137. esphome/components/ili9xxx/ili9xxx_display.cpp +2 -5
  138. esphome/components/ili9xxx/ili9xxx_display.h +2 -1
  139. esphome/components/image/__init__.py +443 -255
  140. esphome/components/image/image.cpp +115 -61
  141. esphome/components/image/image.h +15 -24
  142. esphome/components/json/json_util.cpp +8 -34
  143. esphome/components/libretiny/__init__.py +1 -0
  144. esphome/components/libretiny/gpio_arduino.h +1 -0
  145. esphome/components/light/light_color_values.h +1 -1
  146. esphome/components/logger/__init__.py +43 -7
  147. esphome/components/logger/logger.cpp +16 -11
  148. esphome/components/logger/logger.h +11 -7
  149. esphome/components/logger/select/__init__.py +29 -0
  150. esphome/components/logger/select/logger_level_select.cpp +27 -0
  151. esphome/components/logger/select/logger_level_select.h +15 -0
  152. esphome/components/lvgl/__init__.py +96 -73
  153. esphome/components/lvgl/automation.py +39 -7
  154. esphome/components/lvgl/defines.py +8 -2
  155. esphome/components/lvgl/lvgl_esphome.cpp +8 -15
  156. esphome/components/lvgl/lvgl_esphome.h +20 -5
  157. esphome/components/lvgl/schemas.py +25 -14
  158. esphome/components/lvgl/trigger.py +27 -3
  159. esphome/components/lvgl/widgets/dropdown.py +1 -1
  160. esphome/components/lvgl/widgets/keyboard.py +8 -1
  161. esphome/components/lvgl/widgets/meter.py +2 -1
  162. esphome/components/lvgl/widgets/msgbox.py +1 -1
  163. esphome/components/lvgl/widgets/obj.py +1 -12
  164. esphome/components/lvgl/widgets/page.py +37 -2
  165. esphome/components/lvgl/widgets/tabview.py +1 -1
  166. esphome/components/max6956/max6956.h +2 -0
  167. esphome/components/mcp23016/mcp23016.h +2 -0
  168. esphome/components/mcp23xxx_base/mcp23xxx_base.h +2 -0
  169. esphome/components/mdns/__init__.py +1 -1
  170. esphome/components/media_player/__init__.py +37 -8
  171. esphome/components/media_player/automation.h +11 -2
  172. esphome/components/media_player/media_player.cpp +8 -0
  173. esphome/components/media_player/media_player.h +8 -4
  174. esphome/components/micronova/switch/micronova_switch.cpp +4 -2
  175. esphome/components/midea/ac_automations.h +3 -1
  176. esphome/components/midea/air_conditioner.cpp +7 -5
  177. esphome/components/midea/air_conditioner.h +1 -1
  178. esphome/components/midea/climate.py +4 -2
  179. esphome/components/midea/ir_transmitter.h +36 -5
  180. esphome/components/mixer/__init__.py +0 -0
  181. esphome/components/mixer/speaker/__init__.py +172 -0
  182. esphome/components/mixer/speaker/automation.h +19 -0
  183. esphome/components/mixer/speaker/mixer_speaker.cpp +624 -0
  184. esphome/components/mixer/speaker/mixer_speaker.h +207 -0
  185. esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp +7 -13
  186. esphome/components/mpr121/mpr121.h +2 -0
  187. esphome/components/mqtt/__init__.py +1 -1
  188. esphome/components/mqtt/mqtt_client.cpp +7 -1
  189. esphome/components/mqtt/mqtt_client.h +1 -1
  190. esphome/components/mqtt/mqtt_climate.cpp +2 -2
  191. esphome/components/network/ip_address.h +2 -0
  192. esphome/components/nextion/automation.h +17 -0
  193. esphome/components/nextion/display.py +42 -17
  194. esphome/components/nextion/nextion.cpp +4 -10
  195. esphome/components/nextion/nextion.h +89 -82
  196. esphome/components/nextion/nextion_commands.cpp +10 -10
  197. esphome/components/ntc/sensor.py +2 -4
  198. esphome/components/online_image/__init__.py +98 -46
  199. esphome/components/online_image/bmp_image.cpp +101 -0
  200. esphome/components/online_image/bmp_image.h +40 -0
  201. esphome/components/online_image/image_decoder.cpp +28 -2
  202. esphome/components/online_image/image_decoder.h +24 -15
  203. esphome/components/online_image/jpeg_image.cpp +90 -0
  204. esphome/components/online_image/jpeg_image.h +34 -0
  205. esphome/components/online_image/online_image.cpp +112 -53
  206. esphome/components/online_image/online_image.h +24 -7
  207. esphome/components/online_image/png_image.cpp +7 -3
  208. esphome/components/online_image/png_image.h +2 -1
  209. esphome/components/opentherm/__init__.py +73 -7
  210. esphome/components/opentherm/automation.h +25 -0
  211. esphome/components/opentherm/const.py +1 -0
  212. esphome/components/opentherm/generate.py +39 -6
  213. esphome/components/opentherm/hub.cpp +117 -79
  214. esphome/components/opentherm/hub.h +31 -15
  215. esphome/components/opentherm/opentherm.cpp +47 -23
  216. esphome/components/opentherm/opentherm.h +27 -6
  217. esphome/components/opentherm/opentherm_macros.h +11 -0
  218. esphome/components/opentherm/schema.py +78 -1
  219. esphome/components/opentherm/validate.py +7 -2
  220. esphome/components/pca6416a/pca6416a.h +2 -0
  221. esphome/components/pca9554/pca9554.h +2 -0
  222. esphome/components/pcf8574/pcf8574.h +2 -0
  223. esphome/components/preferences/__init__.py +2 -4
  224. esphome/components/preferences/syncer.h +10 -3
  225. esphome/components/prometheus/prometheus_handler.cpp +313 -0
  226. esphome/components/prometheus/prometheus_handler.h +48 -7
  227. esphome/components/psram/psram.cpp +8 -1
  228. esphome/components/pulse_counter/pulse_counter_sensor.cpp +14 -9
  229. esphome/components/pulse_counter/pulse_counter_sensor.h +4 -4
  230. esphome/components/pulse_meter/pulse_meter_sensor.cpp +2 -0
  231. esphome/components/qspi_dbi/__init__.py +3 -0
  232. esphome/components/qspi_dbi/display.py +74 -47
  233. esphome/components/qspi_dbi/models.py +245 -2
  234. esphome/components/qspi_dbi/qspi_dbi.cpp +9 -16
  235. esphome/components/qspi_dbi/qspi_dbi.h +2 -2
  236. esphome/components/remote_base/__init__.py +77 -25
  237. esphome/components/remote_base/remote_base.cpp +1 -1
  238. esphome/components/remote_base/remote_base.h +20 -2
  239. esphome/components/remote_base/toto_protocol.cpp +100 -0
  240. esphome/components/remote_base/toto_protocol.h +45 -0
  241. esphome/components/remote_receiver/__init__.py +55 -10
  242. esphome/components/remote_receiver/remote_receiver.h +36 -3
  243. esphome/components/remote_receiver/remote_receiver_esp32.cpp +145 -6
  244. esphome/components/remote_transmitter/__init__.py +62 -4
  245. esphome/components/remote_transmitter/remote_transmitter.h +21 -2
  246. esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +140 -4
  247. esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +3 -3
  248. esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +3 -3
  249. esphome/components/resampler/__init__.py +0 -0
  250. esphome/components/resampler/speaker/__init__.py +103 -0
  251. esphome/components/resampler/speaker/resampler_speaker.cpp +318 -0
  252. esphome/components/resampler/speaker/resampler_speaker.h +107 -0
  253. esphome/components/resistance/resistance_sensor.h +2 -3
  254. esphome/components/resistance/sensor.py +2 -9
  255. esphome/components/rotary_encoder/rotary_encoder.cpp +8 -4
  256. esphome/components/rp2040/__init__.py +1 -0
  257. esphome/components/rp2040/gpio.h +1 -0
  258. esphome/components/rtl87xx/__init__.py +2 -0
  259. esphome/components/sdl/binary_sensor.py +270 -0
  260. esphome/components/sdl/sdl_esphome.cpp +16 -0
  261. esphome/components/sdl/sdl_esphome.h +9 -0
  262. esphome/components/seeed_mr60bha2/binary_sensor.py +25 -0
  263. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +26 -2
  264. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +9 -20
  265. esphome/components/seeed_mr60bha2/sensor.py +9 -1
  266. esphome/components/sn74hc165/sn74hc165.h +3 -0
  267. esphome/components/sn74hc595/sn74hc595.h +3 -0
  268. esphome/components/speaker/__init__.py +5 -4
  269. esphome/components/speaker/media_player/__init__.py +458 -0
  270. esphome/components/speaker/media_player/audio_pipeline.cpp +568 -0
  271. esphome/components/speaker/media_player/audio_pipeline.h +159 -0
  272. esphome/components/speaker/media_player/automation.h +26 -0
  273. esphome/components/speaker/media_player/speaker_media_player.cpp +577 -0
  274. esphome/components/speaker/media_player/speaker_media_player.h +160 -0
  275. esphome/components/speaker/speaker.h +20 -0
  276. esphome/components/spi/__init__.py +1 -5
  277. esphome/components/spi/spi.cpp +7 -1
  278. esphome/components/spi/spi.h +21 -2
  279. esphome/components/spi_led_strip/light.py +3 -5
  280. esphome/components/spi_led_strip/spi_led_strip.cpp +67 -0
  281. esphome/components/spi_led_strip/spi_led_strip.h +8 -60
  282. esphome/components/sprinkler/sprinkler.cpp +3 -1
  283. esphome/components/sx1509/sx1509_gpio_pin.h +2 -0
  284. esphome/components/tca9555/tca9555.h +2 -0
  285. esphome/components/toshiba/toshiba.cpp +2 -1
  286. esphome/components/tuya/light/tuya_light.cpp +4 -2
  287. esphome/components/uart/uart_component_esp32_arduino.cpp +2 -2
  288. esphome/components/uart/uart_component_esp_idf.cpp +2 -2
  289. esphome/components/udp/__init__.py +8 -2
  290. esphome/components/udp/udp_component.cpp +25 -56
  291. esphome/components/udp/udp_component.h +3 -0
  292. esphome/components/uponor_smatrix/sensor/__init__.py +14 -4
  293. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.cpp +5 -0
  294. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.h +1 -0
  295. esphome/components/uptime/text_sensor/__init__.py +19 -0
  296. esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +63 -0
  297. esphome/components/uptime/text_sensor/uptime_text_sensor.h +25 -0
  298. esphome/components/voice_assistant/voice_assistant.cpp +24 -14
  299. esphome/components/voice_assistant/voice_assistant.h +8 -0
  300. esphome/components/waveshare_epaper/display.py +22 -1
  301. esphome/components/waveshare_epaper/waveshare_213v3.cpp +9 -3
  302. esphome/components/waveshare_epaper/waveshare_epaper.cpp +1155 -44
  303. esphome/components/waveshare_epaper/waveshare_epaper.h +208 -7
  304. esphome/components/web_server/web_server.cpp +28 -6
  305. esphome/components/weikai/weikai.h +2 -0
  306. esphome/components/wifi/__init__.py +6 -6
  307. esphome/components/wifi/wifi_component.cpp +1 -1
  308. esphome/components/wifi/wifi_component_esp32_arduino.cpp +30 -1
  309. esphome/components/wireguard/__init__.py +2 -2
  310. esphome/components/xl9535/xl9535.h +2 -0
  311. esphome/components/xxtea/__init__.py +3 -0
  312. esphome/components/xxtea/xxtea.cpp +46 -0
  313. esphome/components/xxtea/xxtea.h +26 -0
  314. esphome/components/yashima/yashima.cpp +2 -1
  315. esphome/config.py +9 -5
  316. esphome/config_validation.py +55 -17
  317. esphome/const.py +7 -10
  318. esphome/core/__init__.py +6 -13
  319. esphome/core/base_automation.h +1 -0
  320. esphome/core/config.py +59 -72
  321. esphome/core/defines.h +9 -1
  322. esphome/core/gpio.h +7 -0
  323. esphome/core/helpers.cpp +19 -15
  324. esphome/core/helpers.h +57 -8
  325. esphome/core/log.h +9 -7
  326. esphome/cpp_generator.py +2 -2
  327. esphome/espota2.py +3 -2
  328. esphome/loader.py +12 -4
  329. esphome/log.py +5 -7
  330. esphome/yaml_util.py +2 -2
  331. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/METADATA +12 -7
  332. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/RECORD +341 -292
  333. esphome/components/custom/binary_sensor/custom_binary_sensor.cpp +0 -16
  334. esphome/components/custom/binary_sensor/custom_binary_sensor.h +0 -26
  335. esphome/components/custom/climate/custom_climate.h +0 -22
  336. esphome/components/custom/cover/custom_cover.h +0 -21
  337. esphome/components/custom/light/custom_light_output.h +0 -24
  338. esphome/components/custom/output/custom_output.h +0 -37
  339. esphome/components/custom/sensor/custom_sensor.cpp +0 -16
  340. esphome/components/custom/sensor/custom_sensor.h +0 -24
  341. esphome/components/custom/switch/custom_switch.cpp +0 -16
  342. esphome/components/custom/switch/custom_switch.h +0 -24
  343. esphome/components/custom/text_sensor/custom_text_sensor.cpp +0 -16
  344. esphome/components/custom/text_sensor/custom_text_sensor.h +0 -26
  345. esphome/components/custom_component/custom_component.h +0 -28
  346. esphome/components/esp32_ble_server/ble_2901.cpp +0 -18
  347. esphome/components/esp32_ble_server/ble_2901.h +0 -19
  348. esphome/components/resistance_sampler/__init__.py +0 -6
  349. esphome/components/resistance_sampler/resistance_sampler.h +0 -10
  350. esphome/components/uptime/{sensor.py → sensor/__init__.py} +3 -3
  351. /esphome/components/uptime/{uptime_seconds_sensor.cpp → sensor/uptime_seconds_sensor.cpp} +0 -0
  352. /esphome/components/uptime/{uptime_seconds_sensor.h → sensor/uptime_seconds_sensor.h} +0 -0
  353. /esphome/components/uptime/{uptime_timestamp_sensor.cpp → sensor/uptime_timestamp_sensor.cpp} +0 -0
  354. /esphome/components/uptime/{uptime_timestamp_sensor.h → sensor/uptime_timestamp_sensor.h} +0 -0
  355. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/LICENSE +0 -0
  356. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/WHEEL +0 -0
  357. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/entry_points.txt +0 -0
  358. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/top_level.txt +0 -0
@@ -59,6 +59,36 @@ void PrometheusHandler::handleRequest(AsyncWebServerRequest *req) {
59
59
  this->text_sensor_row_(stream, obj, area, node, friendly_name);
60
60
  #endif
61
61
 
62
+ #ifdef USE_NUMBER
63
+ this->number_type_(stream);
64
+ for (auto *obj : App.get_numbers())
65
+ this->number_row_(stream, obj, area, node, friendly_name);
66
+ #endif
67
+
68
+ #ifdef USE_SELECT
69
+ this->select_type_(stream);
70
+ for (auto *obj : App.get_selects())
71
+ this->select_row_(stream, obj, area, node, friendly_name);
72
+ #endif
73
+
74
+ #ifdef USE_MEDIA_PLAYER
75
+ this->media_player_type_(stream);
76
+ for (auto *obj : App.get_media_players())
77
+ this->media_player_row_(stream, obj, area, node, friendly_name);
78
+ #endif
79
+
80
+ #ifdef USE_UPDATE
81
+ this->update_entity_type_(stream);
82
+ for (auto *obj : App.get_updates())
83
+ this->update_entity_row_(stream, obj, area, node, friendly_name);
84
+ #endif
85
+
86
+ #ifdef USE_VALVE
87
+ this->valve_type_(stream);
88
+ for (auto *obj : App.get_valves())
89
+ this->valve_row_(stream, obj, area, node, friendly_name);
90
+ #endif
91
+
62
92
  req->send(stream);
63
93
  }
64
94
 
@@ -511,6 +541,289 @@ void PrometheusHandler::text_sensor_row_(AsyncResponseStream *stream, text_senso
511
541
  }
512
542
  #endif
513
543
 
544
+ // Type-specific implementation
545
+ #ifdef USE_NUMBER
546
+ void PrometheusHandler::number_type_(AsyncResponseStream *stream) {
547
+ stream->print(F("#TYPE esphome_number_value gauge\n"));
548
+ stream->print(F("#TYPE esphome_number_failed gauge\n"));
549
+ }
550
+ void PrometheusHandler::number_row_(AsyncResponseStream *stream, number::Number *obj, std::string &area,
551
+ std::string &node, std::string &friendly_name) {
552
+ if (obj->is_internal() && !this->include_internal_)
553
+ return;
554
+ if (!std::isnan(obj->state)) {
555
+ // We have a valid value, output this value
556
+ stream->print(F("esphome_number_failed{id=\""));
557
+ stream->print(relabel_id_(obj).c_str());
558
+ add_area_label_(stream, area);
559
+ add_node_label_(stream, node);
560
+ add_friendly_name_label_(stream, friendly_name);
561
+ stream->print(F("\",name=\""));
562
+ stream->print(relabel_name_(obj).c_str());
563
+ stream->print(F("\"} 0\n"));
564
+ // Data itself
565
+ stream->print(F("esphome_number_value{id=\""));
566
+ stream->print(relabel_id_(obj).c_str());
567
+ add_area_label_(stream, area);
568
+ add_node_label_(stream, node);
569
+ add_friendly_name_label_(stream, friendly_name);
570
+ stream->print(F("\",name=\""));
571
+ stream->print(relabel_name_(obj).c_str());
572
+ stream->print(F("\"} "));
573
+ stream->print(obj->state);
574
+ stream->print(F("\n"));
575
+ } else {
576
+ // Invalid state
577
+ stream->print(F("esphome_number_failed{id=\""));
578
+ stream->print(relabel_id_(obj).c_str());
579
+ add_area_label_(stream, area);
580
+ add_node_label_(stream, node);
581
+ add_friendly_name_label_(stream, friendly_name);
582
+ stream->print(F("\",name=\""));
583
+ stream->print(relabel_name_(obj).c_str());
584
+ stream->print(F("\"} 1\n"));
585
+ }
586
+ }
587
+ #endif
588
+
589
+ #ifdef USE_SELECT
590
+ void PrometheusHandler::select_type_(AsyncResponseStream *stream) {
591
+ stream->print(F("#TYPE esphome_select_value gauge\n"));
592
+ stream->print(F("#TYPE esphome_select_failed gauge\n"));
593
+ }
594
+ void PrometheusHandler::select_row_(AsyncResponseStream *stream, select::Select *obj, std::string &area,
595
+ std::string &node, std::string &friendly_name) {
596
+ if (obj->is_internal() && !this->include_internal_)
597
+ return;
598
+ if (obj->has_state()) {
599
+ // We have a valid value, output this value
600
+ stream->print(F("esphome_select_failed{id=\""));
601
+ stream->print(relabel_id_(obj).c_str());
602
+ add_area_label_(stream, area);
603
+ add_node_label_(stream, node);
604
+ add_friendly_name_label_(stream, friendly_name);
605
+ stream->print(F("\",name=\""));
606
+ stream->print(relabel_name_(obj).c_str());
607
+ stream->print(F("\"} 0\n"));
608
+ // Data itself
609
+ stream->print(F("esphome_select_value{id=\""));
610
+ stream->print(relabel_id_(obj).c_str());
611
+ add_area_label_(stream, area);
612
+ add_node_label_(stream, node);
613
+ add_friendly_name_label_(stream, friendly_name);
614
+ stream->print(F("\",name=\""));
615
+ stream->print(relabel_name_(obj).c_str());
616
+ stream->print(F("\",value=\""));
617
+ stream->print(obj->state.c_str());
618
+ stream->print(F("\"} "));
619
+ stream->print(F("1.0"));
620
+ stream->print(F("\n"));
621
+ } else {
622
+ // Invalid state
623
+ stream->print(F("esphome_select_failed{id=\""));
624
+ stream->print(relabel_id_(obj).c_str());
625
+ add_area_label_(stream, area);
626
+ add_node_label_(stream, node);
627
+ add_friendly_name_label_(stream, friendly_name);
628
+ stream->print(F("\",name=\""));
629
+ stream->print(relabel_name_(obj).c_str());
630
+ stream->print(F("\"} 1\n"));
631
+ }
632
+ }
633
+ #endif
634
+
635
+ #ifdef USE_MEDIA_PLAYER
636
+ void PrometheusHandler::media_player_type_(AsyncResponseStream *stream) {
637
+ stream->print(F("#TYPE esphome_media_player_state_value gauge\n"));
638
+ stream->print(F("#TYPE esphome_media_player_volume gauge\n"));
639
+ stream->print(F("#TYPE esphome_media_player_is_muted gauge\n"));
640
+ stream->print(F("#TYPE esphome_media_player_failed gauge\n"));
641
+ }
642
+ void PrometheusHandler::media_player_row_(AsyncResponseStream *stream, media_player::MediaPlayer *obj,
643
+ std::string &area, std::string &node, std::string &friendly_name) {
644
+ if (obj->is_internal() && !this->include_internal_)
645
+ return;
646
+ stream->print(F("esphome_media_player_failed{id=\""));
647
+ stream->print(relabel_id_(obj).c_str());
648
+ add_area_label_(stream, area);
649
+ add_node_label_(stream, node);
650
+ add_friendly_name_label_(stream, friendly_name);
651
+ stream->print(F("\",name=\""));
652
+ stream->print(relabel_name_(obj).c_str());
653
+ stream->print(F("\"} 0\n"));
654
+ // Data itself
655
+ stream->print(F("esphome_media_player_state_value{id=\""));
656
+ stream->print(relabel_id_(obj).c_str());
657
+ add_area_label_(stream, area);
658
+ add_node_label_(stream, node);
659
+ add_friendly_name_label_(stream, friendly_name);
660
+ stream->print(F("\",name=\""));
661
+ stream->print(relabel_name_(obj).c_str());
662
+ stream->print(F("\",value=\""));
663
+ stream->print(media_player::media_player_state_to_string(obj->state));
664
+ stream->print(F("\"} "));
665
+ stream->print(F("1.0"));
666
+ stream->print(F("\n"));
667
+ stream->print(F("esphome_media_player_volume{id=\""));
668
+ stream->print(relabel_id_(obj).c_str());
669
+ add_area_label_(stream, area);
670
+ add_node_label_(stream, node);
671
+ add_friendly_name_label_(stream, friendly_name);
672
+ stream->print(F("\",name=\""));
673
+ stream->print(relabel_name_(obj).c_str());
674
+ stream->print(F("\"} "));
675
+ stream->print(obj->volume);
676
+ stream->print(F("\n"));
677
+ stream->print(F("esphome_media_player_is_muted{id=\""));
678
+ stream->print(relabel_id_(obj).c_str());
679
+ add_area_label_(stream, area);
680
+ add_node_label_(stream, node);
681
+ add_friendly_name_label_(stream, friendly_name);
682
+ stream->print(F("\",name=\""));
683
+ stream->print(relabel_name_(obj).c_str());
684
+ stream->print(F("\"} "));
685
+ if (obj->is_muted()) {
686
+ stream->print(F("1.0"));
687
+ } else {
688
+ stream->print(F("0.0"));
689
+ }
690
+ stream->print(F("\n"));
691
+ }
692
+ #endif
693
+
694
+ #ifdef USE_UPDATE
695
+ void PrometheusHandler::update_entity_type_(AsyncResponseStream *stream) {
696
+ stream->print(F("#TYPE esphome_update_entity_state gauge\n"));
697
+ stream->print(F("#TYPE esphome_update_entity_info gauge\n"));
698
+ stream->print(F("#TYPE esphome_update_entity_failed gauge\n"));
699
+ }
700
+
701
+ void PrometheusHandler::handle_update_state_(AsyncResponseStream *stream, update::UpdateState state) {
702
+ switch (state) {
703
+ case update::UpdateState::UPDATE_STATE_UNKNOWN:
704
+ stream->print("unknown");
705
+ break;
706
+ case update::UpdateState::UPDATE_STATE_NO_UPDATE:
707
+ stream->print("none");
708
+ break;
709
+ case update::UpdateState::UPDATE_STATE_AVAILABLE:
710
+ stream->print("available");
711
+ break;
712
+ case update::UpdateState::UPDATE_STATE_INSTALLING:
713
+ stream->print("installing");
714
+ break;
715
+ default:
716
+ stream->print("invalid");
717
+ break;
718
+ }
719
+ }
720
+
721
+ void PrometheusHandler::update_entity_row_(AsyncResponseStream *stream, update::UpdateEntity *obj, std::string &area,
722
+ std::string &node, std::string &friendly_name) {
723
+ if (obj->is_internal() && !this->include_internal_)
724
+ return;
725
+ if (obj->has_state()) {
726
+ // We have a valid value, output this value
727
+ stream->print(F("esphome_update_entity_failed{id=\""));
728
+ stream->print(relabel_id_(obj).c_str());
729
+ add_area_label_(stream, area);
730
+ add_node_label_(stream, node);
731
+ add_friendly_name_label_(stream, friendly_name);
732
+ stream->print(F("\",name=\""));
733
+ stream->print(relabel_name_(obj).c_str());
734
+ stream->print(F("\"} 0\n"));
735
+ // First update state
736
+ stream->print(F("esphome_update_entity_state{id=\""));
737
+ stream->print(relabel_id_(obj).c_str());
738
+ add_area_label_(stream, area);
739
+ add_node_label_(stream, node);
740
+ add_friendly_name_label_(stream, friendly_name);
741
+ stream->print(F("\",name=\""));
742
+ stream->print(relabel_name_(obj).c_str());
743
+ stream->print(F("\",value=\""));
744
+ handle_update_state_(stream, obj->state);
745
+ stream->print(F("\"} "));
746
+ stream->print(F("1.0"));
747
+ stream->print(F("\n"));
748
+ // Next update info
749
+ stream->print(F("esphome_update_entity_info{id=\""));
750
+ stream->print(relabel_id_(obj).c_str());
751
+ add_area_label_(stream, area);
752
+ add_node_label_(stream, node);
753
+ add_friendly_name_label_(stream, friendly_name);
754
+ stream->print(F("\",name=\""));
755
+ stream->print(relabel_name_(obj).c_str());
756
+ stream->print(F("\",current_version=\""));
757
+ stream->print(obj->update_info.current_version.c_str());
758
+ stream->print(F("\",latest_version=\""));
759
+ stream->print(obj->update_info.latest_version.c_str());
760
+ stream->print(F("\",title=\""));
761
+ stream->print(obj->update_info.title.c_str());
762
+ stream->print(F("\"} "));
763
+ stream->print(F("1.0"));
764
+ stream->print(F("\n"));
765
+ } else {
766
+ // Invalid state
767
+ stream->print(F("esphome_update_entity_failed{id=\""));
768
+ stream->print(relabel_id_(obj).c_str());
769
+ add_area_label_(stream, area);
770
+ add_node_label_(stream, node);
771
+ add_friendly_name_label_(stream, friendly_name);
772
+ stream->print(F("\",name=\""));
773
+ stream->print(relabel_name_(obj).c_str());
774
+ stream->print(F("\"} 1\n"));
775
+ }
776
+ }
777
+ #endif
778
+
779
+ #ifdef USE_VALVE
780
+ void PrometheusHandler::valve_type_(AsyncResponseStream *stream) {
781
+ stream->print(F("#TYPE esphome_valve_operation gauge\n"));
782
+ stream->print(F("#TYPE esphome_valve_failed gauge\n"));
783
+ stream->print(F("#TYPE esphome_valve_position gauge\n"));
784
+ }
785
+
786
+ void PrometheusHandler::valve_row_(AsyncResponseStream *stream, valve::Valve *obj, std::string &area, std::string &node,
787
+ std::string &friendly_name) {
788
+ if (obj->is_internal() && !this->include_internal_)
789
+ return;
790
+ stream->print(F("esphome_valve_failed{id=\""));
791
+ stream->print(relabel_id_(obj).c_str());
792
+ add_area_label_(stream, area);
793
+ add_node_label_(stream, node);
794
+ add_friendly_name_label_(stream, friendly_name);
795
+ stream->print(F("\",name=\""));
796
+ stream->print(relabel_name_(obj).c_str());
797
+ stream->print(F("\"} 0\n"));
798
+ // Data itself
799
+ stream->print(F("esphome_valve_operation{id=\""));
800
+ stream->print(relabel_id_(obj).c_str());
801
+ add_area_label_(stream, area);
802
+ add_node_label_(stream, node);
803
+ add_friendly_name_label_(stream, friendly_name);
804
+ stream->print(F("\",name=\""));
805
+ stream->print(relabel_name_(obj).c_str());
806
+ stream->print(F("\",operation=\""));
807
+ stream->print(valve::valve_operation_to_str(obj->current_operation));
808
+ stream->print(F("\"} "));
809
+ stream->print(F("1.0"));
810
+ stream->print(F("\n"));
811
+ // Now see if position is supported
812
+ if (obj->get_traits().get_supports_position()) {
813
+ stream->print(F("esphome_valve_position{id=\""));
814
+ stream->print(relabel_id_(obj).c_str());
815
+ add_area_label_(stream, area);
816
+ add_node_label_(stream, node);
817
+ add_friendly_name_label_(stream, friendly_name);
818
+ stream->print(F("\",name=\""));
819
+ stream->print(relabel_name_(obj).c_str());
820
+ stream->print(F("\"} "));
821
+ stream->print(obj->position);
822
+ stream->print(F("\n"));
823
+ }
824
+ }
825
+ #endif
826
+
514
827
  } // namespace prometheus
515
828
  } // namespace esphome
516
829
  #endif
@@ -75,7 +75,7 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
75
75
  #ifdef USE_BINARY_SENSOR
76
76
  /// Return the type for prometheus
77
77
  void binary_sensor_type_(AsyncResponseStream *stream);
78
- /// Return the sensor state as prometheus data point
78
+ /// Return the binary sensor state as prometheus data point
79
79
  void binary_sensor_row_(AsyncResponseStream *stream, binary_sensor::BinarySensor *obj, std::string &area,
80
80
  std::string &node, std::string &friendly_name);
81
81
  #endif
@@ -83,7 +83,7 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
83
83
  #ifdef USE_FAN
84
84
  /// Return the type for prometheus
85
85
  void fan_type_(AsyncResponseStream *stream);
86
- /// Return the sensor state as prometheus data point
86
+ /// Return the fan state as prometheus data point
87
87
  void fan_row_(AsyncResponseStream *stream, fan::Fan *obj, std::string &area, std::string &node,
88
88
  std::string &friendly_name);
89
89
  #endif
@@ -91,7 +91,7 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
91
91
  #ifdef USE_LIGHT
92
92
  /// Return the type for prometheus
93
93
  void light_type_(AsyncResponseStream *stream);
94
- /// Return the Light Values state as prometheus data point
94
+ /// Return the light values state as prometheus data point
95
95
  void light_row_(AsyncResponseStream *stream, light::LightState *obj, std::string &area, std::string &node,
96
96
  std::string &friendly_name);
97
97
  #endif
@@ -99,7 +99,7 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
99
99
  #ifdef USE_COVER
100
100
  /// Return the type for prometheus
101
101
  void cover_type_(AsyncResponseStream *stream);
102
- /// Return the switch Values state as prometheus data point
102
+ /// Return the cover values state as prometheus data point
103
103
  void cover_row_(AsyncResponseStream *stream, cover::Cover *obj, std::string &area, std::string &node,
104
104
  std::string &friendly_name);
105
105
  #endif
@@ -107,7 +107,7 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
107
107
  #ifdef USE_SWITCH
108
108
  /// Return the type for prometheus
109
109
  void switch_type_(AsyncResponseStream *stream);
110
- /// Return the switch Values state as prometheus data point
110
+ /// Return the switch values state as prometheus data point
111
111
  void switch_row_(AsyncResponseStream *stream, switch_::Switch *obj, std::string &area, std::string &node,
112
112
  std::string &friendly_name);
113
113
  #endif
@@ -115,7 +115,7 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
115
115
  #ifdef USE_LOCK
116
116
  /// Return the type for prometheus
117
117
  void lock_type_(AsyncResponseStream *stream);
118
- /// Return the lock Values state as prometheus data point
118
+ /// Return the lock values state as prometheus data point
119
119
  void lock_row_(AsyncResponseStream *stream, lock::Lock *obj, std::string &area, std::string &node,
120
120
  std::string &friendly_name);
121
121
  #endif
@@ -123,11 +123,52 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
123
123
  #ifdef USE_TEXT_SENSOR
124
124
  /// Return the type for prometheus
125
125
  void text_sensor_type_(AsyncResponseStream *stream);
126
- /// Return the lock Values state as prometheus data point
126
+ /// Return the text sensor values state as prometheus data point
127
127
  void text_sensor_row_(AsyncResponseStream *stream, text_sensor::TextSensor *obj, std::string &area, std::string &node,
128
128
  std::string &friendly_name);
129
129
  #endif
130
130
 
131
+ #ifdef USE_NUMBER
132
+ /// Return the type for prometheus
133
+ void number_type_(AsyncResponseStream *stream);
134
+ /// Return the number state as prometheus data point
135
+ void number_row_(AsyncResponseStream *stream, number::Number *obj, std::string &area, std::string &node,
136
+ std::string &friendly_name);
137
+ #endif
138
+
139
+ #ifdef USE_SELECT
140
+ /// Return the type for prometheus
141
+ void select_type_(AsyncResponseStream *stream);
142
+ /// Return the select state as prometheus data point
143
+ void select_row_(AsyncResponseStream *stream, select::Select *obj, std::string &area, std::string &node,
144
+ std::string &friendly_name);
145
+ #endif
146
+
147
+ #ifdef USE_MEDIA_PLAYER
148
+ /// Return the type for prometheus
149
+ void media_player_type_(AsyncResponseStream *stream);
150
+ /// Return the media player state as prometheus data point
151
+ void media_player_row_(AsyncResponseStream *stream, media_player::MediaPlayer *obj, std::string &area,
152
+ std::string &node, std::string &friendly_name);
153
+ #endif
154
+
155
+ #ifdef USE_UPDATE
156
+ /// Return the type for prometheus
157
+ void update_entity_type_(AsyncResponseStream *stream);
158
+ /// Return the update state and info as prometheus data point
159
+ void update_entity_row_(AsyncResponseStream *stream, update::UpdateEntity *obj, std::string &area, std::string &node,
160
+ std::string &friendly_name);
161
+ void handle_update_state_(AsyncResponseStream *stream, update::UpdateState state);
162
+ #endif
163
+
164
+ #ifdef USE_VALVE
165
+ /// Return the type for prometheus
166
+ void valve_type_(AsyncResponseStream *stream);
167
+ /// Return the valve state as prometheus data point
168
+ void valve_row_(AsyncResponseStream *stream, valve::Valve *obj, std::string &area, std::string &node,
169
+ std::string &friendly_name);
170
+ #endif
171
+
131
172
  web_server_base::WebServerBase *base_;
132
173
  bool include_internal_{false};
133
174
  std::map<EntityBase *, std::string> relabel_map_id_;
@@ -21,7 +21,14 @@ void PsramComponent::dump_config() {
21
21
  ESP_LOGCONFIG(TAG, " Available: %s", YESNO(available));
22
22
  #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
23
23
  if (available) {
24
- ESP_LOGCONFIG(TAG, " Size: %d KB", heap_caps_get_total_size(MALLOC_CAP_SPIRAM) / 1024);
24
+ const size_t psram_total_size_bytes = heap_caps_get_total_size(MALLOC_CAP_SPIRAM);
25
+ const float psram_total_size_kb = psram_total_size_bytes / 1024.0f;
26
+
27
+ if (abs(std::round(psram_total_size_kb) - psram_total_size_kb) < 0.05f) {
28
+ ESP_LOGCONFIG(TAG, " Size: %.0f KB", psram_total_size_kb);
29
+ } else {
30
+ ESP_LOGCONFIG(TAG, " Size: %zu bytes", psram_total_size_bytes);
31
+ }
25
32
  }
26
33
  #endif
27
34
  }
@@ -13,9 +13,9 @@ PulseCounterStorageBase *get_storage(bool hw_pcnt) {
13
13
  return (hw_pcnt ? (PulseCounterStorageBase *) (new HwPulseCounterStorage)
14
14
  : (PulseCounterStorageBase *) (new BasicPulseCounterStorage));
15
15
  }
16
- #else
16
+ #else // HAS_PCNT
17
17
  PulseCounterStorageBase *get_storage(bool) { return new BasicPulseCounterStorage; }
18
- #endif
18
+ #endif // HAS_PCNT
19
19
 
20
20
  void IRAM_ATTR BasicPulseCounterStorage::gpio_intr(BasicPulseCounterStorage *arg) {
21
21
  const uint32_t now = micros();
@@ -28,14 +28,17 @@ void IRAM_ATTR BasicPulseCounterStorage::gpio_intr(BasicPulseCounterStorage *arg
28
28
  switch (mode) {
29
29
  case PULSE_COUNTER_DISABLE:
30
30
  break;
31
- case PULSE_COUNTER_INCREMENT:
32
- arg->counter++;
33
- break;
34
- case PULSE_COUNTER_DECREMENT:
35
- arg->counter--;
36
- break;
31
+ case PULSE_COUNTER_INCREMENT: {
32
+ auto x = arg->counter + 1;
33
+ arg->counter = x;
34
+ } break;
35
+ case PULSE_COUNTER_DECREMENT: {
36
+ auto x = arg->counter - 1;
37
+ arg->counter = x;
38
+ } break;
37
39
  }
38
40
  }
41
+
39
42
  bool BasicPulseCounterStorage::pulse_counter_setup(InternalGPIOPin *pin) {
40
43
  this->pin = pin;
41
44
  this->pin->setup();
@@ -43,6 +46,7 @@ bool BasicPulseCounterStorage::pulse_counter_setup(InternalGPIOPin *pin) {
43
46
  this->pin->attach_interrupt(BasicPulseCounterStorage::gpio_intr, this, gpio::INTERRUPT_ANY_EDGE);
44
47
  return true;
45
48
  }
49
+
46
50
  pulse_counter_t BasicPulseCounterStorage::read_raw_value() {
47
51
  pulse_counter_t counter = this->counter;
48
52
  pulse_counter_t ret = counter - this->last_value;
@@ -141,6 +145,7 @@ bool HwPulseCounterStorage::pulse_counter_setup(InternalGPIOPin *pin) {
141
145
  }
142
146
  return true;
143
147
  }
148
+
144
149
  pulse_counter_t HwPulseCounterStorage::read_raw_value() {
145
150
  pulse_counter_t counter;
146
151
  pcnt_get_counter_value(this->pcnt_unit, &counter);
@@ -148,7 +153,7 @@ pulse_counter_t HwPulseCounterStorage::read_raw_value() {
148
153
  this->last_value = counter;
149
154
  return ret;
150
155
  }
151
- #endif
156
+ #endif // HAS_PCNT
152
157
 
153
158
  void PulseCounterSensor::setup() {
154
159
  ESP_LOGCONFIG(TAG, "Setting up pulse counter '%s'...", this->name_.c_str());
@@ -9,7 +9,7 @@
9
9
  #if defined(USE_ESP32) && !defined(USE_ESP32_VARIANT_ESP32C3)
10
10
  #include <driver/pcnt.h>
11
11
  #define HAS_PCNT
12
- #endif
12
+ #endif // defined(USE_ESP32) && !defined(USE_ESP32_VARIANT_ESP32C3)
13
13
 
14
14
  namespace esphome {
15
15
  namespace pulse_counter {
@@ -22,9 +22,9 @@ enum PulseCounterCountMode {
22
22
 
23
23
  #ifdef HAS_PCNT
24
24
  using pulse_counter_t = int16_t;
25
- #else
25
+ #else // HAS_PCNT
26
26
  using pulse_counter_t = int32_t;
27
- #endif
27
+ #endif // HAS_PCNT
28
28
 
29
29
  struct PulseCounterStorageBase {
30
30
  virtual bool pulse_counter_setup(InternalGPIOPin *pin) = 0;
@@ -57,7 +57,7 @@ struct HwPulseCounterStorage : public PulseCounterStorageBase {
57
57
  pcnt_unit_t pcnt_unit;
58
58
  pcnt_channel_t pcnt_channel;
59
59
  };
60
- #endif
60
+ #endif // HAS_PCNT
61
61
 
62
62
  PulseCounterStorageBase *get_storage(bool hw_pcnt = false);
63
63
 
@@ -75,6 +75,8 @@ void PulseMeterSensor::loop() {
75
75
  case MeterState::RUNNING: {
76
76
  uint32_t delta_us = this->get_->last_detected_edge_us_ - this->last_processed_edge_us_;
77
77
  float pulse_width_us = delta_us / float(this->get_->count_);
78
+ ESP_LOGV(TAG, "New pulse, delta: %" PRIu32 " µs, count: %" PRIu32 ", width: %.5f µs", delta_us,
79
+ this->get_->count_, pulse_width_us);
78
80
  this->publish_state((60.0f * 1000000.0f) / pulse_width_us);
79
81
  } break;
80
82
  }
@@ -1 +1,4 @@
1
1
  CODEOWNERS = ["@clydebarrow"]
2
+
3
+ CONF_DRAW_FROM_ORIGIN = "draw_from_origin"
4
+ CONF_DRAW_ROUNDING = "draw_rounding"