homeassistant-stubs 2023.3.6__py3-none-any.whl → 2023.4.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 (333) hide show
  1. homeassistant-stubs/auth/__init__.pyi +1 -1
  2. homeassistant-stubs/auth/jwt_wrapper.pyi +14 -0
  3. homeassistant-stubs/auth/permissions/models.pyi +3 -3
  4. homeassistant-stubs/bootstrap.pyi +1 -1
  5. homeassistant-stubs/components/aladdin_connect/config_flow.pyi +0 -2
  6. homeassistant-stubs/components/aladdin_connect/cover.pyi +5 -7
  7. homeassistant-stubs/components/alarm_control_panel/device_action.pyi +0 -1
  8. homeassistant-stubs/components/alarm_control_panel/device_condition.pyi +1 -1
  9. homeassistant-stubs/components/alarm_control_panel/device_trigger.pyi +0 -1
  10. homeassistant-stubs/components/amazon_polly/tts.pyi +2 -2
  11. homeassistant-stubs/components/amcrest/camera.pyi +0 -1
  12. homeassistant-stubs/components/awair/sensor.pyi +2 -1
  13. homeassistant-stubs/components/backup/manager.pyi +2 -1
  14. homeassistant-stubs/components/bayesian/issues.pyi +0 -1
  15. homeassistant-stubs/components/bluetooth/wrappers.pyi +1 -0
  16. homeassistant-stubs/components/bmw_connected_drive/config_flow.pyi +3 -0
  17. homeassistant-stubs/components/bmw_connected_drive/coordinator.pyi +1 -0
  18. homeassistant-stubs/components/braviatv/media_player.pyi +2 -2
  19. homeassistant-stubs/components/button/device_action.pyi +0 -1
  20. homeassistant-stubs/components/button/device_trigger.pyi +0 -1
  21. homeassistant-stubs/components/calendar/__init__.pyi +8 -4
  22. homeassistant-stubs/components/calendar/const.pyi +2 -2
  23. homeassistant-stubs/components/calendar/trigger.pyi +25 -8
  24. homeassistant-stubs/components/camera/__init__.pyi +1 -1
  25. homeassistant-stubs/components/cover/device_action.pyi +0 -1
  26. homeassistant-stubs/components/cover/device_condition.pyi +1 -1
  27. homeassistant-stubs/components/cover/device_trigger.pyi +0 -1
  28. homeassistant-stubs/components/demo/sensor.pyi +2 -1
  29. homeassistant-stubs/components/demo/stt.pyi +2 -2
  30. homeassistant-stubs/components/device_automation/condition.pyi +2 -4
  31. homeassistant-stubs/components/device_tracker/device_condition.pyi +1 -1
  32. homeassistant-stubs/components/device_tracker/device_trigger.pyi +0 -1
  33. homeassistant-stubs/components/devolo_home_network/device_tracker.pyi +0 -1
  34. homeassistant-stubs/components/devolo_home_network/entity.pyi +1 -0
  35. homeassistant-stubs/components/dlna_dmr/config_flow.pyi +0 -1
  36. homeassistant-stubs/components/dlna_dmr/media_player.pyi +1 -2
  37. homeassistant-stubs/components/dormakaba_dkey/__init__.pyi +1 -1
  38. homeassistant-stubs/components/dormakaba_dkey/config_flow.pyi +5 -1
  39. homeassistant-stubs/components/efergy/sensor.pyi +2 -2
  40. homeassistant-stubs/components/emulated_hue/hue_api.pyi +1 -0
  41. homeassistant-stubs/components/energy/types.pyi +2 -2
  42. homeassistant-stubs/components/energy/websocket_api.pyi +1 -0
  43. homeassistant-stubs/components/esphome/bluetooth/client.pyi +3 -1
  44. homeassistant-stubs/components/esphome/entry_data.pyi +1 -0
  45. homeassistant-stubs/components/esphome/media_player.pyi +1 -1
  46. homeassistant-stubs/components/fan/device_condition.pyi +1 -1
  47. homeassistant-stubs/components/filesize/__init__.pyi +1 -2
  48. homeassistant-stubs/components/fitbit/sensor.pyi +1 -1
  49. homeassistant-stubs/components/fritz/binary_sensor.pyi +7 -11
  50. homeassistant-stubs/components/fritz/common.pyi +25 -3
  51. homeassistant-stubs/components/fritz/sensor.pyi +6 -15
  52. homeassistant-stubs/components/fritzbox/sensor.pyi +0 -1
  53. homeassistant-stubs/components/fronius/coordinator.pyi +2 -3
  54. homeassistant-stubs/components/fronius/sensor.pyi +13 -8
  55. homeassistant-stubs/components/fully_kiosk/media_player.pyi +3 -3
  56. homeassistant-stubs/components/fully_kiosk/sensor.pyi +3 -3
  57. homeassistant-stubs/components/gios/__init__.pyi +3 -3
  58. homeassistant-stubs/components/gios/const.pyi +0 -2
  59. homeassistant-stubs/components/gios/sensor.pyi +10 -13
  60. homeassistant-stubs/components/google/__init__.pyi +1 -1
  61. homeassistant-stubs/components/google/calendar.pyi +1 -1
  62. homeassistant-stubs/components/google/const.pyi +1 -0
  63. homeassistant-stubs/components/group/media_player.pyi +4 -3
  64. homeassistant-stubs/components/group/notify.pyi +1 -1
  65. homeassistant-stubs/components/group/sensor.pyi +2 -0
  66. homeassistant-stubs/components/guardian/util.pyi +0 -1
  67. homeassistant-stubs/components/history/websocket_api.pyi +2 -1
  68. homeassistant-stubs/components/homeassistant_alerts/__init__.pyi +4 -2
  69. homeassistant-stubs/components/homeassistant_hardware/silabs_multiprotocol_addon.pyi +7 -2
  70. homeassistant-stubs/components/homeassistant_sky_connect/__init__.pyi +2 -8
  71. homeassistant-stubs/components/homeassistant_yellow/__init__.pyi +3 -7
  72. homeassistant-stubs/components/homekit/__init__.pyi +6 -6
  73. homeassistant-stubs/components/homekit/config_flow.pyi +2 -2
  74. homeassistant-stubs/components/homekit/type_triggers.pyi +0 -1
  75. homeassistant-stubs/components/http/__init__.pyi +18 -1
  76. homeassistant-stubs/components/http/auth.pyi +1 -0
  77. homeassistant-stubs/components/http/security_filter.pyi +1 -0
  78. homeassistant-stubs/components/huawei_lte/__init__.pyi +1 -1
  79. homeassistant-stubs/components/huawei_lte/device_tracker.pyi +0 -1
  80. homeassistant-stubs/components/isy994/lock.pyi +8 -3
  81. homeassistant-stubs/components/isy994/services.pyi +6 -0
  82. homeassistant-stubs/components/jellyfin/coordinator.pyi +4 -2
  83. homeassistant-stubs/components/jellyfin/media_player.pyi +3 -3
  84. homeassistant-stubs/components/knx/__init__.pyi +3 -2
  85. homeassistant-stubs/components/knx/device.pyi +18 -0
  86. homeassistant-stubs/components/knx/light.pyi +2 -2
  87. homeassistant-stubs/components/knx/sensor.pyi +33 -2
  88. homeassistant-stubs/components/kraken/sensor.pyi +0 -1
  89. homeassistant-stubs/components/lametric/__init__.pyi +1 -2
  90. homeassistant-stubs/components/lidarr/const.pyi +0 -2
  91. homeassistant-stubs/components/lifx/__init__.pyi +2 -2
  92. homeassistant-stubs/components/light/intent.pyi +1 -1
  93. homeassistant-stubs/components/litejet/__init__.pyi +14 -0
  94. homeassistant-stubs/components/litejet/config_flow.pyi +18 -0
  95. homeassistant-stubs/components/litejet/const.pyi +8 -0
  96. homeassistant-stubs/components/litejet/diagnostics.pyi +7 -0
  97. homeassistant-stubs/components/litejet/light.pyi +39 -0
  98. homeassistant-stubs/components/litejet/scene.pyi +32 -0
  99. homeassistant-stubs/components/litejet/switch.pyi +37 -0
  100. homeassistant-stubs/components/litejet/trigger.pyi +16 -0
  101. homeassistant-stubs/components/litterrobot/select.pyi +11 -6
  102. homeassistant-stubs/components/lock/device_action.pyi +0 -1
  103. homeassistant-stubs/components/lock/device_condition.pyi +1 -1
  104. homeassistant-stubs/components/lock/device_trigger.pyi +0 -1
  105. homeassistant-stubs/components/logbook/__init__.pyi +3 -3
  106. homeassistant-stubs/components/logbook/const.pyi +0 -2
  107. homeassistant-stubs/components/logbook/helpers.pyi +1 -1
  108. homeassistant-stubs/components/logbook/models.pyi +25 -7
  109. homeassistant-stubs/components/logbook/processor.pyi +8 -7
  110. homeassistant-stubs/components/logbook/queries/__init__.pyi +3 -1
  111. homeassistant-stubs/components/logbook/queries/all.pyi +4 -4
  112. homeassistant-stubs/components/logbook/queries/common.pyi +2 -2
  113. homeassistant-stubs/components/logbook/queries/devices.pyi +1 -1
  114. homeassistant-stubs/components/logbook/queries/entities.pyi +6 -6
  115. homeassistant-stubs/components/logbook/queries/entities_and_devices.pyi +5 -5
  116. homeassistant-stubs/components/logbook/websocket_api.pyi +2 -2
  117. homeassistant-stubs/components/logger/helpers.pyi +1 -1
  118. homeassistant-stubs/components/logger/websocket_api.pyi +1 -1
  119. homeassistant-stubs/components/matter/binary_sensor.pyi +5 -1
  120. homeassistant-stubs/components/matter/entity.pyi +5 -1
  121. homeassistant-stubs/components/matter/lock.pyi +44 -0
  122. homeassistant-stubs/components/matter/models.pyi +2 -9
  123. homeassistant-stubs/components/matter/sensor.pyi +5 -1
  124. homeassistant-stubs/components/media_player/__init__.pyi +2 -2
  125. homeassistant-stubs/components/media_player/device_condition.pyi +1 -1
  126. homeassistant-stubs/components/media_player/device_trigger.pyi +0 -1
  127. homeassistant-stubs/components/metoffice/__init__.pyi +0 -2
  128. homeassistant-stubs/components/metoffice/sensor.pyi +2 -1
  129. homeassistant-stubs/components/mikrotik/const.pyi +2 -0
  130. homeassistant-stubs/components/mikrotik/device_tracker.pyi +0 -1
  131. homeassistant-stubs/components/mikrotik/hub.pyi +2 -1
  132. homeassistant-stubs/components/modbus/__init__.pyi +1 -1
  133. homeassistant-stubs/components/modbus/climate.pyi +3 -1
  134. homeassistant-stubs/components/modbus/const.pyi +1 -0
  135. homeassistant-stubs/components/modbus/modbus.pyi +1 -1
  136. homeassistant-stubs/components/modem_callerid/button.pyi +2 -2
  137. homeassistant-stubs/components/modem_callerid/sensor.pyi +2 -2
  138. homeassistant-stubs/components/moon/config_flow.pyi +0 -2
  139. homeassistant-stubs/components/moon/sensor.pyi +2 -7
  140. homeassistant-stubs/components/mqtt/__init__.pyi +5 -7
  141. homeassistant-stubs/components/mqtt/client.pyi +24 -2
  142. homeassistant-stubs/components/mqtt/config_integration.pyi +1 -1
  143. homeassistant-stubs/components/mqtt/const.pyi +0 -1
  144. homeassistant-stubs/components/mqtt/models.pyi +2 -1
  145. homeassistant-stubs/components/mysensors/__init__.pyi +4 -9
  146. homeassistant-stubs/components/mysensors/const.pyi +1 -3
  147. homeassistant-stubs/components/mysensors/device.pyi +1 -1
  148. homeassistant-stubs/components/mysensors/light.pyi +1 -1
  149. homeassistant-stubs/components/mysensors/switch.pyi +6 -20
  150. homeassistant-stubs/components/nam/__init__.pyi +0 -2
  151. homeassistant-stubs/components/nam/sensor.pyi +0 -1
  152. homeassistant-stubs/components/netatmo/device_trigger.pyi +0 -1
  153. homeassistant-stubs/components/nissan_leaf/sensor.pyi +2 -3
  154. homeassistant-stubs/components/notify/legacy.pyi +2 -2
  155. homeassistant-stubs/components/number/const.pyi +2 -0
  156. homeassistant-stubs/components/number/device_action.pyi +0 -1
  157. homeassistant-stubs/components/otbr/__init__.pyi +3 -0
  158. homeassistant-stubs/components/otbr/config_flow.pyi +3 -2
  159. homeassistant-stubs/components/otbr/util.pyi +6 -0
  160. homeassistant-stubs/components/otbr/websocket_api.pyi +7 -3
  161. homeassistant-stubs/components/overkiz/climate_entities/__init__.pyi +1 -0
  162. homeassistant-stubs/components/overkiz/climate_entities/atlantic_electrical_heater.pyi +2 -0
  163. homeassistant-stubs/components/overkiz/climate_entities/atlantic_electrical_heater_with_adjustable_temperature_setpoint.pyi +2 -0
  164. homeassistant-stubs/components/overkiz/climate_entities/atlantic_electrical_towel_dryer.pyi +2 -0
  165. homeassistant-stubs/components/overkiz/climate_entities/atlantic_heat_recovery_ventilation.pyi +2 -0
  166. homeassistant-stubs/components/overkiz/climate_entities/atlantic_pass_apc_heating_zone.pyi +2 -0
  167. homeassistant-stubs/components/overkiz/climate_entities/somfy_thermostat.pyi +2 -2
  168. homeassistant-stubs/components/overkiz/climate_entities/valve_heating_temperature_interface.pyi +37 -0
  169. homeassistant-stubs/components/overkiz/const.pyi +2 -1
  170. homeassistant-stubs/components/overkiz/sensor.pyi +3 -1
  171. homeassistant-stubs/components/overkiz/switch.pyi +2 -2
  172. homeassistant-stubs/components/pi_hole/sensor.pyi +2 -2
  173. homeassistant-stubs/components/rainmachine/util.pyi +0 -1
  174. homeassistant-stubs/components/recorder/__init__.pyi +3 -3
  175. homeassistant-stubs/components/recorder/auto_repairs/__init__.pyi +0 -0
  176. homeassistant-stubs/components/recorder/auto_repairs/events/__init__.pyi +0 -0
  177. homeassistant-stubs/components/recorder/auto_repairs/events/schema.pyi +6 -0
  178. homeassistant-stubs/components/recorder/auto_repairs/schema.pyi +23 -0
  179. homeassistant-stubs/components/recorder/auto_repairs/states/schema.pyi +9 -0
  180. homeassistant-stubs/components/recorder/auto_repairs/statistics/__init__.pyi +0 -0
  181. homeassistant-stubs/components/recorder/auto_repairs/statistics/duplicates.pyi +19 -0
  182. homeassistant-stubs/components/recorder/auto_repairs/statistics/schema.pyi +9 -0
  183. homeassistant-stubs/components/recorder/const.pyi +10 -0
  184. homeassistant-stubs/components/recorder/core.pyi +33 -29
  185. homeassistant-stubs/components/recorder/db_schema.pyi +36 -6
  186. homeassistant-stubs/components/recorder/entity_registry.pyi +10 -0
  187. homeassistant-stubs/components/recorder/filters.pyi +13 -11
  188. homeassistant-stubs/components/recorder/history/__init__.pyi +13 -0
  189. homeassistant-stubs/components/recorder/history/common.pyi +4 -0
  190. homeassistant-stubs/components/recorder/history/const.pyi +9 -0
  191. homeassistant-stubs/components/recorder/{history.pyi → history/legacy.pyi} +9 -14
  192. homeassistant-stubs/components/recorder/history/modern.pyi +41 -0
  193. homeassistant-stubs/components/recorder/migration.pyi +34 -6
  194. homeassistant-stubs/components/recorder/models/__init__.pyi +5 -0
  195. homeassistant-stubs/components/recorder/models/context.pyi +6 -0
  196. homeassistant-stubs/components/recorder/models/database.pyi +14 -0
  197. homeassistant-stubs/components/recorder/models/legacy.pyi +39 -0
  198. homeassistant-stubs/components/recorder/models/state.pyi +43 -0
  199. homeassistant-stubs/components/recorder/models/state_attributes.pyi +9 -0
  200. homeassistant-stubs/components/recorder/models/statistics.pyi +50 -0
  201. homeassistant-stubs/components/recorder/models/time.pyi +20 -0
  202. homeassistant-stubs/components/recorder/purge.pyi +9 -12
  203. homeassistant-stubs/components/recorder/queries.pyi +19 -3
  204. homeassistant-stubs/components/recorder/services.pyi +1 -1
  205. homeassistant-stubs/components/recorder/statistics.pyi +40 -42
  206. homeassistant-stubs/components/recorder/table_managers/__init__.pyi +20 -0
  207. homeassistant-stubs/components/recorder/table_managers/event_data.pyi +26 -0
  208. homeassistant-stubs/components/recorder/table_managers/event_types.pyi +20 -0
  209. homeassistant-stubs/components/recorder/{run_history.pyi → table_managers/recorder_runs.pyi} +3 -3
  210. homeassistant-stubs/components/recorder/table_managers/state_attributes.pyi +29 -0
  211. homeassistant-stubs/components/recorder/table_managers/states.pyi +14 -0
  212. homeassistant-stubs/components/recorder/table_managers/states_meta.pyi +23 -0
  213. homeassistant-stubs/components/recorder/table_managers/statistics_meta.pyi +35 -0
  214. homeassistant-stubs/components/recorder/tasks.pyi +39 -4
  215. homeassistant-stubs/components/recorder/util.pyi +2 -1
  216. homeassistant-stubs/components/recorder/websocket_api.pyi +2 -2
  217. homeassistant-stubs/components/renault/renault_vehicle.pyi +1 -0
  218. homeassistant-stubs/components/rest/__init__.pyi +1 -1
  219. homeassistant-stubs/components/rest/const.pyi +2 -0
  220. homeassistant-stubs/components/rest/data.pyi +3 -2
  221. homeassistant-stubs/components/rest/schema.pyi +1 -1
  222. homeassistant-stubs/components/ridwell/calendar.pyi +22 -0
  223. homeassistant-stubs/components/ridwell/coordinator.pyi +2 -2
  224. homeassistant-stubs/components/ridwell/entity.pyi +2 -4
  225. homeassistant-stubs/components/ridwell/sensor.pyi +2 -1
  226. homeassistant-stubs/components/ridwell/switch.pyi +4 -0
  227. homeassistant-stubs/components/roku/media_player.pyi +4 -4
  228. homeassistant-stubs/components/samsungtv/device_trigger.pyi +19 -0
  229. homeassistant-stubs/components/samsungtv/helpers.pyi +8 -0
  230. homeassistant-stubs/components/samsungtv/media_player.pyi +7 -2
  231. homeassistant-stubs/components/samsungtv/trigger.pyi +12 -0
  232. homeassistant-stubs/components/samsungtv/triggers/__init__.pyi +0 -0
  233. homeassistant-stubs/components/samsungtv/triggers/turn_on.pyi +14 -0
  234. homeassistant-stubs/components/scrape/config_flow.pyi +1 -1
  235. homeassistant-stubs/components/scrape/const.pyi +2 -0
  236. homeassistant-stubs/components/scrape/sensor.pyi +3 -6
  237. homeassistant-stubs/components/select/device_action.pyi +0 -1
  238. homeassistant-stubs/components/select/device_condition.pyi +1 -1
  239. homeassistant-stubs/components/select/device_trigger.pyi +0 -1
  240. homeassistant-stubs/components/sensor/const.pyi +2 -0
  241. homeassistant-stubs/components/sensor/recorder.pyi +3 -1
  242. homeassistant-stubs/components/sfr_box/__init__.pyi +1 -1
  243. homeassistant-stubs/components/sfr_box/binary_sensor.pyi +3 -1
  244. homeassistant-stubs/components/sfr_box/models.pyi +4 -2
  245. homeassistant-stubs/components/sfr_box/sensor.pyi +2 -1
  246. homeassistant-stubs/components/sleepiq/entity.pyi +0 -1
  247. homeassistant-stubs/components/statistics/sensor.pyi +2 -2
  248. homeassistant-stubs/components/sun/__init__.pyi +1 -1
  249. homeassistant-stubs/components/sun/sensor.pyi +36 -0
  250. homeassistant-stubs/components/switcher_kis/__init__.pyi +1 -1
  251. homeassistant-stubs/components/switcher_kis/button.pyi +0 -1
  252. homeassistant-stubs/components/switcher_kis/climate.pyi +0 -1
  253. homeassistant-stubs/components/switcher_kis/cover.pyi +0 -1
  254. homeassistant-stubs/components/switcher_kis/sensor.pyi +0 -1
  255. homeassistant-stubs/components/switcher_kis/switch.pyi +1 -1
  256. homeassistant-stubs/components/synology_dsm/sensor.pyi +5 -4
  257. homeassistant-stubs/components/threshold/__init__.pyi +7 -0
  258. homeassistant-stubs/components/threshold/binary_sensor.pyi +55 -0
  259. homeassistant-stubs/components/threshold/config_flow.pyi +19 -0
  260. homeassistant-stubs/components/threshold/const.pyi +5 -0
  261. homeassistant-stubs/components/tibber/config_flow.pyi +3 -0
  262. homeassistant-stubs/components/tibber/sensor.pyi +2 -1
  263. homeassistant-stubs/components/tplink/light.pyi +1 -1
  264. homeassistant-stubs/components/tplink_omada/__init__.pyi +1 -0
  265. homeassistant-stubs/components/tplink_omada/controller.pyi +21 -0
  266. homeassistant-stubs/components/tplink_omada/coordinator.pyi +3 -4
  267. homeassistant-stubs/components/tplink_omada/entity.pyi +6 -4
  268. homeassistant-stubs/components/tplink_omada/switch.pyi +4 -6
  269. homeassistant-stubs/components/tplink_omada/update.pyi +43 -0
  270. homeassistant-stubs/components/tradfri/sensor.pyi +0 -1
  271. homeassistant-stubs/components/tts/__init__.pyi +2 -1
  272. homeassistant-stubs/components/unifi/__init__.pyi +33 -0
  273. homeassistant-stubs/components/unifi/config_flow.pyi +46 -0
  274. homeassistant-stubs/components/unifi/const.pyi +30 -0
  275. homeassistant-stubs/components/unifi/controller.pyi +77 -0
  276. homeassistant-stubs/components/unifi/device_tracker.pyi +70 -0
  277. homeassistant-stubs/components/unifi/diagnostics.pyi +19 -0
  278. homeassistant-stubs/components/unifi/entity.pyi +58 -0
  279. homeassistant-stubs/components/unifi/errors.pyi +8 -0
  280. homeassistant-stubs/components/unifi/sensor.pyi +37 -0
  281. homeassistant-stubs/components/unifi/services.pyi +17 -0
  282. homeassistant-stubs/components/unifi/switch.pyi +55 -0
  283. homeassistant-stubs/components/unifi/update.pyi +1 -1
  284. homeassistant-stubs/components/unifiprotect/select.pyi +2 -2
  285. homeassistant-stubs/components/vacuum/device_action.pyi +0 -1
  286. homeassistant-stubs/components/vacuum/device_condition.pyi +1 -1
  287. homeassistant-stubs/components/vacuum/device_trigger.pyi +0 -1
  288. homeassistant-stubs/components/velbus/__init__.pyi +0 -2
  289. homeassistant-stubs/components/velbus/light.pyi +1 -1
  290. homeassistant-stubs/components/velbus/select.pyi +21 -0
  291. homeassistant-stubs/components/water_heater/device_action.pyi +0 -1
  292. homeassistant-stubs/components/weather/__init__.pyi +2 -23
  293. homeassistant-stubs/components/weather/const.pyi +25 -0
  294. homeassistant-stubs/components/weather/websocket_api.pyi +7 -0
  295. homeassistant-stubs/components/webostv/trigger.pyi +3 -3
  296. homeassistant-stubs/components/webostv/triggers/__init__.pyi +0 -5
  297. homeassistant-stubs/components/websocket_api/commands.pyi +2 -2
  298. homeassistant-stubs/components/websocket_api/connection.pyi +7 -1
  299. homeassistant-stubs/components/zwave_js/__init__.pyi +4 -4
  300. homeassistant-stubs/components/zwave_js/api.pyi +0 -1
  301. homeassistant-stubs/components/zwave_js/device_action.pyi +0 -1
  302. homeassistant-stubs/components/zwave_js/device_trigger.pyi +0 -1
  303. homeassistant-stubs/components/zwave_js/diagnostics.pyi +2 -1
  304. homeassistant-stubs/components/zwave_js/discovery.pyi +1 -1
  305. homeassistant-stubs/components/zwave_js/update.pyi +18 -8
  306. homeassistant-stubs/config_entries.pyi +4 -1
  307. homeassistant-stubs/core.pyi +4 -3
  308. homeassistant-stubs/helpers/condition.pyi +11 -3
  309. homeassistant-stubs/helpers/config_validation.pyi +1 -1
  310. homeassistant-stubs/helpers/debounce.pyi +1 -0
  311. homeassistant-stubs/helpers/device_registry.pyi +1 -1
  312. homeassistant-stubs/helpers/entity.pyi +1 -0
  313. homeassistant-stubs/helpers/entity_platform.pyi +2 -1
  314. homeassistant-stubs/helpers/entity_registry.pyi +9 -1
  315. homeassistant-stubs/helpers/event.pyi +3 -1
  316. homeassistant-stubs/helpers/httpx_client.pyi +1 -0
  317. homeassistant-stubs/helpers/integration_platform.pyi +3 -3
  318. homeassistant-stubs/helpers/script.pyi +5 -3
  319. homeassistant-stubs/helpers/selector.pyi +29 -12
  320. homeassistant-stubs/helpers/service.pyi +11 -0
  321. homeassistant-stubs/helpers/template.pyi +24 -3
  322. homeassistant-stubs/scripts/check_config.pyi +0 -1
  323. homeassistant-stubs/util/ssl.pyi +8 -0
  324. homeassistant-stubs/util/ulid.pyi +2 -1
  325. homeassistant-stubs/util/yaml/dumper.pyi +1 -1
  326. homeassistant-stubs/util/yaml/loader.pyi +4 -5
  327. homeassistant-stubs/util/yaml/objects.pyi +1 -0
  328. {homeassistant_stubs-2023.3.6.dist-info → homeassistant_stubs-2023.4.0b1.dist-info}/METADATA +2 -2
  329. {homeassistant_stubs-2023.3.6.dist-info → homeassistant_stubs-2023.4.0b1.dist-info}/RECORD +331 -265
  330. homeassistant-stubs/components/mysensors/notify.pyi +0 -23
  331. homeassistant-stubs/components/recorder/models.pyi +0 -148
  332. {homeassistant_stubs-2023.3.6.dist-info → homeassistant_stubs-2023.4.0b1.dist-info}/LICENSE +0 -0
  333. {homeassistant_stubs-2023.3.6.dist-info → homeassistant_stubs-2023.4.0b1.dist-info}/WHEEL +0 -0
@@ -1,8 +1,11 @@
1
- from .. import recorder as recorder
2
- from .db_schema import RecorderRuns as RecorderRuns, StateAttributes as StateAttributes, States as States
3
- from .filters import Filters as Filters
4
- from .models import LazyState as LazyState, LazyStatePreSchema31 as LazyStatePreSchema31, process_datetime_to_timestamp as process_datetime_to_timestamp, process_timestamp as process_timestamp, process_timestamp_to_utc_isoformat as process_timestamp_to_utc_isoformat, row_to_compressed_state as row_to_compressed_state, row_to_compressed_state_pre_schema_31 as row_to_compressed_state_pre_schema_31
5
- from .util import execute_stmt_lambda_element as execute_stmt_lambda_element, session_scope as session_scope
1
+ from ... import recorder as recorder
2
+ from ..db_schema import RecorderRuns as RecorderRuns, StateAttributes as StateAttributes, States as States
3
+ from ..filters import Filters as Filters
4
+ from ..models import LazyState as LazyState, process_datetime_to_timestamp as process_datetime_to_timestamp, process_timestamp as process_timestamp, process_timestamp_to_utc_isoformat as process_timestamp_to_utc_isoformat, row_to_compressed_state as row_to_compressed_state
5
+ from ..models.legacy import LazyStatePreSchema31 as LazyStatePreSchema31, row_to_compressed_state_pre_schema_31 as row_to_compressed_state_pre_schema_31
6
+ from ..util import execute_stmt_lambda_element as execute_stmt_lambda_element, session_scope as session_scope
7
+ from .common import _schema_version as _schema_version
8
+ from .const import IGNORE_DOMAINS_ENTITY_ID_LIKE as IGNORE_DOMAINS_ENTITY_ID_LIKE, LAST_CHANGED_KEY as LAST_CHANGED_KEY, NEED_ATTRIBUTE_DOMAINS as NEED_ATTRIBUTE_DOMAINS, SIGNIFICANT_DOMAINS as SIGNIFICANT_DOMAINS, SIGNIFICANT_DOMAINS_ENTITY_ID_LIKE as SIGNIFICANT_DOMAINS_ENTITY_ID_LIKE, STATE_KEY as STATE_KEY
6
9
  from _typeshed import Incomplete
7
10
  from collections.abc import Callable as Callable, Iterable, MutableMapping
8
11
  from datetime import datetime
@@ -16,13 +19,6 @@ from sqlalchemy.sql.lambdas import StatementLambdaElement as StatementLambdaElem
16
19
  from typing import Any
17
20
 
18
21
  _LOGGER: Incomplete
19
- STATE_KEY: str
20
- LAST_CHANGED_KEY: str
21
- SIGNIFICANT_DOMAINS: Incomplete
22
- SIGNIFICANT_DOMAINS_ENTITY_ID_LIKE: Incomplete
23
- IGNORE_DOMAINS: Incomplete
24
- IGNORE_DOMAINS_ENTITY_ID_LIKE: Incomplete
25
- NEED_ATTRIBUTE_DOMAINS: Incomplete
26
22
  _BASE_STATES: Incomplete
27
23
  _BASE_STATES_NO_LAST_CHANGED: Incomplete
28
24
  _QUERY_STATE_NO_ATTR: Incomplete
@@ -40,8 +36,7 @@ _QUERY_STATES_NO_LAST_CHANGED: Incomplete
40
36
  _FIELD_MAP: Incomplete
41
37
  _FIELD_MAP_PRE_SCHEMA_31: Incomplete
42
38
 
43
- def _schema_version(hass: HomeAssistant) -> int: ...
44
- def lambda_stmt_and_join_attributes(schema_version: int, no_attributes: bool, include_last_changed: bool = ...) -> tuple[StatementLambdaElement, bool]: ...
39
+ def _lambda_stmt_and_join_attributes(schema_version: int, no_attributes: bool, include_last_changed: bool = ...) -> tuple[StatementLambdaElement, bool]: ...
45
40
  def get_significant_states(hass: HomeAssistant, start_time: datetime, end_time: Union[datetime, None] = ..., entity_ids: Union[list[str], None] = ..., filters: Union[Filters, None] = ..., include_start_time_state: bool = ..., significant_changes_only: bool = ..., minimal_response: bool = ..., no_attributes: bool = ..., compressed_state_format: bool = ...) -> MutableMapping[str, list[Union[State, dict[str, Any]]]]: ...
46
41
  def _ignore_domains_filter(query: Query) -> Query: ...
47
42
  def _significant_states_stmt(schema_version: int, start_time: datetime, end_time: Union[datetime, None], entity_ids: Union[list[str], None], filters: Union[Filters, None], significant_changes_only: bool, no_attributes: bool) -> StatementLambdaElement: ...
@@ -0,0 +1,41 @@
1
+ from ... import recorder as recorder
2
+ from ..db_schema import RecorderRuns as RecorderRuns, StateAttributes as StateAttributes, States as States, StatesMeta as StatesMeta
3
+ from ..filters import Filters as Filters
4
+ from ..models import LazyState as LazyState, extract_metadata_ids as extract_metadata_ids, process_timestamp as process_timestamp, row_to_compressed_state as row_to_compressed_state
5
+ from ..util import execute_stmt_lambda_element as execute_stmt_lambda_element, session_scope as session_scope
6
+ from .const import IGNORE_DOMAINS_ENTITY_ID_LIKE as IGNORE_DOMAINS_ENTITY_ID_LIKE, LAST_CHANGED_KEY as LAST_CHANGED_KEY, NEED_ATTRIBUTE_DOMAINS as NEED_ATTRIBUTE_DOMAINS, SIGNIFICANT_DOMAINS as SIGNIFICANT_DOMAINS, SIGNIFICANT_DOMAINS_ENTITY_ID_LIKE as SIGNIFICANT_DOMAINS_ENTITY_ID_LIKE, STATE_KEY as STATE_KEY
7
+ from _typeshed import Incomplete
8
+ from collections.abc import Callable as Callable, Iterable, MutableMapping
9
+ from datetime import datetime
10
+ from homeassistant.const import COMPRESSED_STATE_LAST_UPDATED as COMPRESSED_STATE_LAST_UPDATED, COMPRESSED_STATE_STATE as COMPRESSED_STATE_STATE
11
+ from homeassistant.core import HomeAssistant as HomeAssistant, State as State, split_entity_id as split_entity_id
12
+ from sqlalchemy import Column as Column
13
+ from sqlalchemy.engine.row import Row as Row
14
+ from sqlalchemy.orm.query import Query as Query
15
+ from sqlalchemy.orm.session import Session as Session
16
+ from sqlalchemy.sql.lambdas import StatementLambdaElement as StatementLambdaElement
17
+ from typing import Any
18
+
19
+ _BASE_STATES: Incomplete
20
+ _BASE_STATES_NO_LAST_CHANGED: Incomplete
21
+ _QUERY_STATE_NO_ATTR: Incomplete
22
+ _QUERY_STATE_NO_ATTR_NO_LAST_CHANGED: Incomplete
23
+ _QUERY_STATES: Incomplete
24
+ _QUERY_STATES_NO_LAST_CHANGED: Incomplete
25
+ _FIELD_MAP: Incomplete
26
+
27
+ def _lambda_stmt_and_join_attributes(no_attributes: bool, include_last_changed: bool = ...) -> tuple[StatementLambdaElement, bool]: ...
28
+ def get_significant_states(hass: HomeAssistant, start_time: datetime, end_time: Union[datetime, None] = ..., entity_ids: Union[list[str], None] = ..., filters: Union[Filters, None] = ..., include_start_time_state: bool = ..., significant_changes_only: bool = ..., minimal_response: bool = ..., no_attributes: bool = ..., compressed_state_format: bool = ...) -> MutableMapping[str, list[Union[State, dict[str, Any]]]]: ...
29
+ def _ignore_domains_filter(query: Query) -> Query: ...
30
+ def _significant_states_stmt(start_time: datetime, end_time: Union[datetime, None], metadata_ids: Union[list[int], None], metadata_ids_in_significant_domains: list[int], filters: Union[Filters, None], significant_changes_only: bool, no_attributes: bool) -> StatementLambdaElement: ...
31
+ def get_significant_states_with_session(hass: HomeAssistant, session: Session, start_time: datetime, end_time: Union[datetime, None] = ..., entity_ids: Union[list[str], None] = ..., filters: Union[Filters, None] = ..., include_start_time_state: bool = ..., significant_changes_only: bool = ..., minimal_response: bool = ..., no_attributes: bool = ..., compressed_state_format: bool = ...) -> MutableMapping[str, list[Union[State, dict[str, Any]]]]: ...
32
+ def get_full_significant_states_with_session(hass: HomeAssistant, session: Session, start_time: datetime, end_time: Union[datetime, None] = ..., entity_ids: Union[list[str], None] = ..., filters: Union[Filters, None] = ..., include_start_time_state: bool = ..., significant_changes_only: bool = ..., no_attributes: bool = ...) -> MutableMapping[str, list[State]]: ...
33
+ def _state_changed_during_period_stmt(start_time: datetime, end_time: Union[datetime, None], metadata_id: Union[int, None], no_attributes: bool, descending: bool, limit: Union[int, None]) -> StatementLambdaElement: ...
34
+ def state_changes_during_period(hass: HomeAssistant, start_time: datetime, end_time: Union[datetime, None] = ..., entity_id: Union[str, None] = ..., no_attributes: bool = ..., descending: bool = ..., limit: Union[int, None] = ..., include_start_time_state: bool = ...) -> MutableMapping[str, list[State]]: ...
35
+ def _get_last_state_changes_stmt(number_of_states: int, metadata_id: int) -> StatementLambdaElement: ...
36
+ def get_last_state_changes(hass: HomeAssistant, number_of_states: int, entity_id: str) -> MutableMapping[str, list[State]]: ...
37
+ def _get_states_for_entities_stmt(run_start: datetime, utc_point_in_time: datetime, metadata_ids: list[int], no_attributes: bool) -> StatementLambdaElement: ...
38
+ def _get_states_for_all_stmt(run_start: datetime, utc_point_in_time: datetime, filters: Union[Filters, None], no_attributes: bool) -> StatementLambdaElement: ...
39
+ def _get_rows_with_session(hass: HomeAssistant, session: Session, utc_point_in_time: datetime, entity_ids: Union[list[str], None] = ..., entity_id_to_metadata_id: Union[dict[str, Union[int, None]], None] = ..., run: Union[RecorderRuns, None] = ..., filters: Union[Filters, None] = ..., no_attributes: bool = ...) -> Iterable[Row]: ...
40
+ def _get_single_entity_states_stmt(utc_point_in_time: datetime, metadata_id: int, no_attributes: bool = ...) -> StatementLambdaElement: ...
41
+ def _sorted_states_to_dict(hass: HomeAssistant, session: Session, states: Iterable[Row], start_time: datetime, entity_ids: Union[list[str], None], entity_id_to_metadata_id: Union[dict[str, Union[int, None]], None], filters: Union[Filters, None] = ..., include_start_time_state: bool = ..., minimal_response: bool = ..., no_attributes: bool = ..., compressed_state_format: bool = ...) -> MutableMapping[str, list[Union[State, dict[str, Any]]]]: ...
@@ -1,44 +1,72 @@
1
1
  from . import Recorder as Recorder
2
+ from .auto_repairs.statistics.duplicates import delete_statistics_duplicates as delete_statistics_duplicates, delete_statistics_meta_duplicates as delete_statistics_meta_duplicates
2
3
  from .const import SupportedDialect as SupportedDialect
3
- from .db_schema import Base as Base, SCHEMA_VERSION as SCHEMA_VERSION, STATISTICS_TABLES as STATISTICS_TABLES, SchemaChanges as SchemaChanges, Statistics as Statistics, StatisticsMeta as StatisticsMeta, StatisticsRuns as StatisticsRuns, StatisticsShortTerm as StatisticsShortTerm, TABLE_STATES as TABLE_STATES
4
+ from .db_schema import Base as Base, CONTEXT_ID_BIN_MAX_LENGTH as CONTEXT_ID_BIN_MAX_LENGTH, DOUBLE_PRECISION_TYPE_SQL as DOUBLE_PRECISION_TYPE_SQL, EventTypes as EventTypes, Events as Events, LEGACY_STATES_EVENT_ID_INDEX as LEGACY_STATES_EVENT_ID_INDEX, MYSQL_COLLATE as MYSQL_COLLATE, MYSQL_DEFAULT_CHARSET as MYSQL_DEFAULT_CHARSET, SCHEMA_VERSION as SCHEMA_VERSION, STATISTICS_TABLES as STATISTICS_TABLES, SchemaChanges as SchemaChanges, States as States, StatesMeta as StatesMeta, Statistics as Statistics, StatisticsMeta as StatisticsMeta, StatisticsRuns as StatisticsRuns, StatisticsShortTerm as StatisticsShortTerm, TABLE_STATES as TABLE_STATES
4
5
  from .models import process_timestamp as process_timestamp
5
- from .statistics import delete_statistics_duplicates as delete_statistics_duplicates, delete_statistics_meta_duplicates as delete_statistics_meta_duplicates, get_start_time as get_start_time
6
+ from .queries import batch_cleanup_entity_ids as batch_cleanup_entity_ids, find_entity_ids_to_migrate as find_entity_ids_to_migrate, find_event_type_to_migrate as find_event_type_to_migrate, find_events_context_ids_to_migrate as find_events_context_ids_to_migrate, find_states_context_ids_to_migrate as find_states_context_ids_to_migrate, has_used_states_event_ids as has_used_states_event_ids
7
+ from .statistics import get_start_time as get_start_time
6
8
  from .tasks import CommitTask as CommitTask, PostSchemaMigrationTask as PostSchemaMigrationTask, StatisticsTimestampMigrationCleanupTask as StatisticsTimestampMigrationCleanupTask
7
- from .util import database_job_retry_wrapper as database_job_retry_wrapper, session_scope as session_scope
9
+ from .util import database_job_retry_wrapper as database_job_retry_wrapper, get_index_by_name as get_index_by_name, retryable_database_job as retryable_database_job, session_scope as session_scope
8
10
  from _typeshed import Incomplete
9
11
  from collections.abc import Callable as Callable, Iterable
10
12
  from homeassistant.core import HomeAssistant as HomeAssistant
13
+ from homeassistant.util.enum import try_parse_enum as try_parse_enum
14
+ from homeassistant.util.ulid import ulid_to_bytes as ulid_to_bytes
11
15
  from sqlalchemy.engine import CursorResult as CursorResult, Engine as Engine
12
16
  from sqlalchemy.orm.session import Session as Session
13
17
 
14
18
  LIVE_MIGRATION_MIN_SCHEMA_VERSION: int
19
+ _EMPTY_CONTEXT_ID: Incomplete
20
+ _EMPTY_ENTITY_ID: str
21
+ _EMPTY_EVENT_TYPE: str
15
22
  _LOGGER: Incomplete
16
23
 
24
+ class _ColumnTypesForDialect:
25
+ big_int_type: str
26
+ timestamp_type: str
27
+ context_bin_type: str
28
+ def __init__(self, big_int_type, timestamp_type, context_bin_type) -> None: ...
29
+
30
+ _MYSQL_COLUMN_TYPES: Incomplete
31
+ _POSTGRESQL_COLUMN_TYPES: Incomplete
32
+ _SQLITE_COLUMN_TYPES: Incomplete
33
+ _COLUMN_TYPES_FOR_DIALECT: dict[Union[SupportedDialect, None], _ColumnTypesForDialect]
34
+
17
35
  def raise_if_exception_missing_str(ex: Exception, match_substrs: Iterable[str]) -> None: ...
18
36
  def _get_schema_version(session: Session) -> Union[int, None]: ...
19
37
  def get_schema_version(session_maker: Callable[[], Session]) -> Union[int, None]: ...
20
38
 
21
39
  class SchemaValidationStatus:
22
40
  current_version: int
23
- statistics_schema_errors: set[str]
41
+ schema_errors: set[str]
24
42
  valid: bool
25
- def __init__(self, current_version, statistics_schema_errors, valid) -> None: ...
43
+ def __init__(self, current_version, schema_errors, valid) -> None: ...
26
44
 
27
45
  def _schema_is_current(current_version: int) -> bool: ...
28
46
  def validate_db_schema(hass: HomeAssistant, instance: Recorder, session_maker: Callable[[], Session]) -> Union[SchemaValidationStatus, None]: ...
47
+ def _find_schema_errors(hass: HomeAssistant, instance: Recorder, session_maker: Callable[[], Session]) -> set[str]: ...
29
48
  def live_migration(schema_status: SchemaValidationStatus) -> bool: ...
30
49
  def migrate_schema(instance: Recorder, hass: HomeAssistant, engine: Engine, session_maker: Callable[[], Session], schema_status: SchemaValidationStatus) -> None: ...
31
50
  def _create_index(session_maker: Callable[[], Session], table_name: str, index_name: str) -> None: ...
32
- def _drop_index(session_maker: Callable[[], Session], table_name: str, index_name: str) -> None: ...
51
+ def _execute_or_collect_error(session_maker: Callable[[], Session], query: str, errors: list[str]) -> bool: ...
52
+ def _drop_index(session_maker: Callable[[], Session], table_name: str, index_name: str, quiet: Union[bool, None] = ...) -> None: ...
33
53
  def _add_columns(session_maker: Callable[[], Session], table_name: str, columns_def: list[str]) -> None: ...
34
54
  def _modify_columns(session_maker: Callable[[], Session], engine: Engine, table_name: str, columns_def: list[str]) -> None: ...
35
55
  def _update_states_table_with_foreign_key_options(session_maker: Callable[[], Session], engine: Engine) -> None: ...
36
56
  def _drop_foreign_key_constraints(session_maker: Callable[[], Session], engine: Engine, table: str, columns: list[str]) -> None: ...
37
57
  def _apply_update(instance: Recorder, hass: HomeAssistant, engine: Engine, session_maker: Callable[[], Session], new_version: int, old_version: int) -> None: ...
58
+ def _correct_table_character_set_and_collation(table: str, session_maker: Callable[[], Session]) -> None: ...
38
59
  def post_schema_migration(instance: Recorder, old_version: int, new_version: int) -> None: ...
39
60
  def _wipe_old_string_statistics_columns(instance: Recorder) -> None: ...
40
61
  def _wipe_old_string_time_columns(instance: Recorder, engine: Engine, session: Session) -> None: ...
41
62
  def _migrate_columns_to_timestamp(session_maker: Callable[[], Session], engine: Engine) -> None: ...
42
63
  def _migrate_statistics_columns_to_timestamp(session_maker: Callable[[], Session], engine: Engine) -> None: ...
64
+ def _context_id_to_bytes(context_id: Union[str, None]) -> Union[bytes, None]: ...
65
+ def migrate_states_context_ids(instance: Recorder) -> bool: ...
66
+ def migrate_events_context_ids(instance: Recorder) -> bool: ...
67
+ def migrate_event_type_ids(instance: Recorder) -> bool: ...
68
+ def migrate_entity_ids(instance: Recorder) -> bool: ...
69
+ def post_migrate_entity_ids(instance: Recorder) -> bool: ...
70
+ def cleanup_legacy_states_event_ids(instance: Recorder) -> bool: ...
43
71
  def _initialize_database(session: Session) -> bool: ...
44
72
  def initialize_database(session_maker: Callable[[], Session]) -> bool: ...
@@ -0,0 +1,5 @@
1
+ from .context import bytes_to_ulid_or_none as bytes_to_ulid_or_none, bytes_to_uuid_hex_or_none as bytes_to_uuid_hex_or_none, ulid_to_bytes_or_none as ulid_to_bytes_or_none, uuid_hex_to_bytes_or_none as uuid_hex_to_bytes_or_none
2
+ from .database import DatabaseEngine as DatabaseEngine, DatabaseOptimizer as DatabaseOptimizer, UnsupportedDialect as UnsupportedDialect
3
+ from .state import LazyState as LazyState, extract_metadata_ids as extract_metadata_ids, row_to_compressed_state as row_to_compressed_state
4
+ from .statistics import CalendarStatisticPeriod as CalendarStatisticPeriod, FixedStatisticPeriod as FixedStatisticPeriod, RollingWindowStatisticPeriod as RollingWindowStatisticPeriod, StatisticData as StatisticData, StatisticDataTimestamp as StatisticDataTimestamp, StatisticMetaData as StatisticMetaData, StatisticPeriod as StatisticPeriod, StatisticResult as StatisticResult
5
+ from .time import datetime_to_timestamp_or_none as datetime_to_timestamp_or_none, process_datetime_to_timestamp as process_datetime_to_timestamp, process_timestamp as process_timestamp, process_timestamp_to_utc_isoformat as process_timestamp_to_utc_isoformat, timestamp_to_datetime_or_none as timestamp_to_datetime_or_none
@@ -0,0 +1,6 @@
1
+ from homeassistant.util.ulid import bytes_to_ulid as bytes_to_ulid, ulid_to_bytes as ulid_to_bytes
2
+
3
+ def ulid_to_bytes_or_none(ulid: Union[str, None]) -> Union[bytes, None]: ...
4
+ def bytes_to_ulid_or_none(_bytes: Union[bytes, None]) -> Union[str, None]: ...
5
+ def uuid_hex_to_bytes_or_none(uuid_hex: Union[str, None]) -> Union[bytes, None]: ...
6
+ def bytes_to_uuid_hex_or_none(_bytes: Union[bytes, None]) -> Union[str, None]: ...
@@ -0,0 +1,14 @@
1
+ from ..const import SupportedDialect as SupportedDialect
2
+ from awesomeversion import AwesomeVersion as AwesomeVersion
3
+
4
+ class UnsupportedDialect(Exception): ...
5
+
6
+ class DatabaseEngine:
7
+ dialect: SupportedDialect
8
+ optimizer: DatabaseOptimizer
9
+ version: Union[AwesomeVersion, None]
10
+ def __init__(self, dialect, optimizer, version) -> None: ...
11
+
12
+ class DatabaseOptimizer:
13
+ slow_range_in_select: bool
14
+ def __init__(self, slow_range_in_select) -> None: ...
@@ -0,0 +1,39 @@
1
+ from .state_attributes import decode_attributes_from_row as decode_attributes_from_row
2
+ from .time import process_datetime_to_timestamp as process_datetime_to_timestamp, process_timestamp as process_timestamp, process_timestamp_to_utc_isoformat as process_timestamp_to_utc_isoformat
3
+ from _typeshed import Incomplete
4
+ from datetime import datetime
5
+ from homeassistant.const import COMPRESSED_STATE_ATTRIBUTES as COMPRESSED_STATE_ATTRIBUTES, COMPRESSED_STATE_LAST_CHANGED as COMPRESSED_STATE_LAST_CHANGED, COMPRESSED_STATE_LAST_UPDATED as COMPRESSED_STATE_LAST_UPDATED, COMPRESSED_STATE_STATE as COMPRESSED_STATE_STATE
6
+ from homeassistant.core import Context as Context, State as State
7
+ from sqlalchemy.engine.row import Row as Row
8
+ from typing import Any
9
+
10
+ class LazyStatePreSchema31(State):
11
+ __slots__: Incomplete
12
+ _row: Incomplete
13
+ entity_id: Incomplete
14
+ state: Incomplete
15
+ _attributes: Incomplete
16
+ _last_changed: Incomplete
17
+ _last_updated: Incomplete
18
+ _context: Incomplete
19
+ attr_cache: Incomplete
20
+ def __init__(self, row: Row, attr_cache: dict[str, dict[str, Any]], start_time: Union[datetime, None]) -> None: ...
21
+ @property
22
+ def attributes(self) -> dict[str, Any]: ...
23
+ @attributes.setter
24
+ def attributes(self, value: dict[str, Any]) -> None: ...
25
+ @property
26
+ def context(self) -> Context: ...
27
+ @context.setter
28
+ def context(self, value: Context) -> None: ...
29
+ @property
30
+ def last_changed(self) -> datetime: ...
31
+ @last_changed.setter
32
+ def last_changed(self, value: datetime) -> None: ...
33
+ @property
34
+ def last_updated(self) -> datetime: ...
35
+ @last_updated.setter
36
+ def last_updated(self, value: datetime) -> None: ...
37
+ def as_dict(self) -> dict[str, Any]: ...
38
+
39
+ def row_to_compressed_state_pre_schema_31(row: Row, attr_cache: dict[str, dict[str, Any]], start_time: Union[datetime, None]) -> dict[str, Any]: ...
@@ -0,0 +1,43 @@
1
+ from .state_attributes import decode_attributes_from_row as decode_attributes_from_row
2
+ from .time import process_timestamp as process_timestamp
3
+ from _typeshed import Incomplete
4
+ from datetime import datetime
5
+ from homeassistant.const import COMPRESSED_STATE_ATTRIBUTES as COMPRESSED_STATE_ATTRIBUTES, COMPRESSED_STATE_LAST_CHANGED as COMPRESSED_STATE_LAST_CHANGED, COMPRESSED_STATE_LAST_UPDATED as COMPRESSED_STATE_LAST_UPDATED, COMPRESSED_STATE_STATE as COMPRESSED_STATE_STATE
6
+ from homeassistant.core import Context as Context, State as State
7
+ from sqlalchemy.engine.row import Row as Row
8
+ from typing import Any
9
+
10
+ _LOGGER: Incomplete
11
+
12
+ def extract_metadata_ids(entity_id_to_metadata_id: dict[str, Union[int, None]]) -> list[int]: ...
13
+
14
+ class LazyState(State):
15
+ __slots__: Incomplete
16
+ _row: Incomplete
17
+ entity_id: Incomplete
18
+ state: Incomplete
19
+ _attributes: Incomplete
20
+ _last_updated_ts: Incomplete
21
+ _last_changed_ts: Incomplete
22
+ _context: Incomplete
23
+ attr_cache: Incomplete
24
+ def __init__(self, row: Row, attr_cache: dict[str, dict[str, Any]], start_time: Union[datetime, None], entity_id: Union[str, None] = ...) -> None: ...
25
+ @property
26
+ def attributes(self) -> dict[str, Any]: ...
27
+ @attributes.setter
28
+ def attributes(self, value: dict[str, Any]) -> None: ...
29
+ @property
30
+ def context(self) -> Context: ...
31
+ @context.setter
32
+ def context(self, value: Context) -> None: ...
33
+ @property
34
+ def last_changed(self) -> datetime: ...
35
+ @last_changed.setter
36
+ def last_changed(self, value: datetime) -> None: ...
37
+ @property
38
+ def last_updated(self) -> datetime: ...
39
+ @last_updated.setter
40
+ def last_updated(self, value: datetime) -> None: ...
41
+ def as_dict(self) -> dict[str, Any]: ...
42
+
43
+ def row_to_compressed_state(row: Row, attr_cache: dict[str, dict[str, Any]], start_time: Union[datetime, None], entity_id: Union[str, None] = ...) -> dict[str, Any]: ...
@@ -0,0 +1,9 @@
1
+ from _typeshed import Incomplete
2
+ from homeassistant.util.json import json_loads_object as json_loads_object
3
+ from sqlalchemy.engine.row import Row as Row
4
+ from typing import Any
5
+
6
+ EMPTY_JSON_OBJECT: str
7
+ _LOGGER: Incomplete
8
+
9
+ def decode_attributes_from_row(row: Row, attr_cache: dict[str, dict[str, Any]]) -> dict[str, Any]: ...
@@ -0,0 +1,50 @@
1
+ from datetime import datetime, timedelta
2
+ from typing import Literal, TypedDict
3
+
4
+ class StatisticResult(TypedDict):
5
+ meta: StatisticMetaData
6
+ stat: StatisticData
7
+
8
+ class StatisticDataTimestampBase(TypedDict):
9
+ start_ts: float
10
+
11
+ class StatisticDataBase(TypedDict):
12
+ start: datetime
13
+
14
+ class StatisticMixIn(TypedDict):
15
+ state: float
16
+ sum: float
17
+ min: float
18
+ max: float
19
+ mean: float
20
+
21
+ class StatisticData(StatisticDataBase, StatisticMixIn):
22
+ last_reset: Union[datetime, None]
23
+
24
+ class StatisticDataTimestamp(StatisticDataTimestampBase, StatisticMixIn):
25
+ last_reset_ts: Union[float, None]
26
+
27
+ class StatisticMetaData(TypedDict):
28
+ has_mean: bool
29
+ has_sum: bool
30
+ name: Union[str, None]
31
+ source: str
32
+ statistic_id: str
33
+ unit_of_measurement: Union[str, None]
34
+
35
+ class CalendarStatisticPeriod(TypedDict):
36
+ period: Literal['hour', 'day', 'week', 'month', 'year']
37
+ offset: int
38
+
39
+ class FixedStatisticPeriod(TypedDict):
40
+ end_time: datetime
41
+ start_time: datetime
42
+
43
+ class RollingWindowStatisticPeriod(TypedDict):
44
+ duration: timedelta
45
+ offset: timedelta
46
+
47
+ class StatisticPeriod(TypedDict):
48
+ calendar: CalendarStatisticPeriod
49
+ fixed_period: FixedStatisticPeriod
50
+ rolling_window: RollingWindowStatisticPeriod
@@ -0,0 +1,20 @@
1
+ from _typeshed import Incomplete
2
+ from datetime import datetime
3
+ from typing import overload
4
+
5
+ _LOGGER: Incomplete
6
+ DB_TIMEZONE: str
7
+ EMPTY_JSON_OBJECT: str
8
+
9
+
10
+ @overload
11
+ def process_timestamp(ts: None) -> None: ...
12
+ @overload
13
+ def process_timestamp(ts: datetime) -> datetime: ...
14
+ @overload
15
+ def process_timestamp_to_utc_isoformat(ts: None) -> None: ...
16
+ @overload
17
+ def process_timestamp_to_utc_isoformat(ts: datetime) -> str: ...
18
+ def process_datetime_to_timestamp(ts: datetime) -> float: ...
19
+ def datetime_to_timestamp_or_none(dt: Union[datetime, None]) -> Union[float, None]: ...
20
+ def timestamp_to_datetime_or_none(ts: Union[float, None]) -> Union[datetime, None]: ...
@@ -1,15 +1,13 @@
1
1
  from . import Recorder as Recorder
2
2
  from .const import SQLITE_MAX_BIND_VARS as SQLITE_MAX_BIND_VARS
3
- from .db_schema import Events as Events, StateAttributes as StateAttributes, States as States
3
+ from .db_schema import Events as Events, States as States, StatesMeta as StatesMeta
4
4
  from .models import DatabaseEngine as DatabaseEngine
5
- from .queries import attributes_ids_exist_in_states as attributes_ids_exist_in_states, attributes_ids_exist_in_states_with_fast_in_distinct as attributes_ids_exist_in_states_with_fast_in_distinct, data_ids_exist_in_events as data_ids_exist_in_events, data_ids_exist_in_events_with_fast_in_distinct as data_ids_exist_in_events_with_fast_in_distinct, delete_event_data_rows as delete_event_data_rows, delete_event_rows as delete_event_rows, delete_recorder_runs_rows as delete_recorder_runs_rows, delete_states_attributes_rows as delete_states_attributes_rows, delete_states_rows as delete_states_rows, delete_statistics_runs_rows as delete_statistics_runs_rows, delete_statistics_short_term_rows as delete_statistics_short_term_rows, disconnect_states_rows as disconnect_states_rows, find_events_to_purge as find_events_to_purge, find_latest_statistics_runs_run_id as find_latest_statistics_runs_run_id, find_legacy_event_state_and_attributes_and_data_ids_to_purge as find_legacy_event_state_and_attributes_and_data_ids_to_purge, find_legacy_row as find_legacy_row, find_short_term_statistics_to_purge as find_short_term_statistics_to_purge, find_states_to_purge as find_states_to_purge, find_statistics_runs_to_purge as find_statistics_runs_to_purge
5
+ from .queries import attributes_ids_exist_in_states as attributes_ids_exist_in_states, attributes_ids_exist_in_states_with_fast_in_distinct as attributes_ids_exist_in_states_with_fast_in_distinct, data_ids_exist_in_events as data_ids_exist_in_events, data_ids_exist_in_events_with_fast_in_distinct as data_ids_exist_in_events_with_fast_in_distinct, delete_event_data_rows as delete_event_data_rows, delete_event_rows as delete_event_rows, delete_event_types_rows as delete_event_types_rows, delete_recorder_runs_rows as delete_recorder_runs_rows, delete_states_attributes_rows as delete_states_attributes_rows, delete_states_meta_rows as delete_states_meta_rows, delete_states_rows as delete_states_rows, delete_statistics_runs_rows as delete_statistics_runs_rows, delete_statistics_short_term_rows as delete_statistics_short_term_rows, disconnect_states_rows as disconnect_states_rows, find_entity_ids_to_purge as find_entity_ids_to_purge, find_event_types_to_purge as find_event_types_to_purge, find_events_to_purge as find_events_to_purge, find_latest_statistics_runs_run_id as find_latest_statistics_runs_run_id, find_legacy_event_state_and_attributes_and_data_ids_to_purge as find_legacy_event_state_and_attributes_and_data_ids_to_purge, find_legacy_row as find_legacy_row, find_short_term_statistics_to_purge as find_short_term_statistics_to_purge, find_states_to_purge as find_states_to_purge, find_statistics_runs_to_purge as find_statistics_runs_to_purge
6
6
  from .repack import repack_database as repack_database
7
7
  from .util import chunked as chunked, retryable_database_job as retryable_database_job, session_scope as session_scope
8
8
  from _typeshed import Incomplete
9
- from collections.abc import Callable as Callable, Iterable
9
+ from collections.abc import Callable as Callable
10
10
  from datetime import datetime
11
- from homeassistant.const import EVENT_STATE_CHANGED as EVENT_STATE_CHANGED
12
- from sqlalchemy.engine.row import Row as Row
13
11
  from sqlalchemy.orm.session import Session as Session
14
12
 
15
13
  _LOGGER: Incomplete
@@ -31,16 +29,15 @@ def _select_statistics_runs_to_purge(session: Session, purge_before: datetime) -
31
29
  def _select_short_term_statistics_to_purge(session: Session, purge_before: datetime) -> list[int]: ...
32
30
  def _select_legacy_event_state_and_attributes_and_data_ids_to_purge(session: Session, purge_before: datetime) -> tuple[set[int], set[int], set[int], set[int]]: ...
33
31
  def _purge_state_ids(instance: Recorder, session: Session, state_ids: set[int]) -> None: ...
34
- def _evict_purged_states_from_old_states_cache(instance: Recorder, purged_state_ids: set[int]) -> None: ...
35
- def _evict_purged_data_from_data_cache(instance: Recorder, purged_data_ids: set[int]) -> None: ...
36
- def _evict_purged_attributes_from_attributes_cache(instance: Recorder, purged_attributes_ids: set[int]) -> None: ...
37
32
  def _purge_batch_attributes_ids(instance: Recorder, session: Session, attributes_ids: set[int]) -> None: ...
38
33
  def _purge_batch_data_ids(instance: Recorder, session: Session, data_ids: set[int]) -> None: ...
39
34
  def _purge_statistics_runs(session: Session, statistics_runs: list[int]) -> None: ...
40
35
  def _purge_short_term_statistics(session: Session, short_term_statistics: list[int]) -> None: ...
41
- def _purge_event_ids(session: Session, event_ids: Iterable[int]) -> None: ...
36
+ def _purge_event_ids(session: Session, event_ids: set[int]) -> None: ...
42
37
  def _purge_old_recorder_runs(instance: Recorder, session: Session, purge_before: datetime) -> None: ...
38
+ def _purge_old_event_types(instance: Recorder, session: Session) -> None: ...
39
+ def _purge_old_entity_ids(instance: Recorder, session: Session) -> None: ...
43
40
  def _purge_filtered_data(instance: Recorder, session: Session) -> bool: ...
44
- def _purge_filtered_states(instance: Recorder, session: Session, excluded_entity_ids: list[str], database_engine: DatabaseEngine) -> None: ...
45
- def _purge_filtered_events(instance: Recorder, session: Session, excluded_event_types: list[str]) -> None: ...
46
- def purge_entity_data(instance: Recorder, entity_filter: Callable[[str], bool]) -> bool: ...
41
+ def _purge_filtered_states(instance: Recorder, session: Session, metadata_ids_to_purge: list[str], database_engine: DatabaseEngine, purge_before_timestamp: float) -> bool: ...
42
+ def _purge_filtered_events(instance: Recorder, session: Session, excluded_event_type_ids: list[int], purge_before_timestamp: float) -> bool: ...
43
+ def purge_entity_data(instance: Recorder, entity_filter: Callable[[str], bool], purge_before: datetime) -> bool: ...
@@ -1,14 +1,16 @@
1
1
  from .const import SQLITE_MAX_BIND_VARS as SQLITE_MAX_BIND_VARS
2
- from .db_schema import EventData as EventData, Events as Events, RecorderRuns as RecorderRuns, StateAttributes as StateAttributes, States as States, StatisticsRuns as StatisticsRuns, StatisticsShortTerm as StatisticsShortTerm
2
+ from .db_schema import EventData as EventData, EventTypes as EventTypes, Events as Events, RecorderRuns as RecorderRuns, StateAttributes as StateAttributes, States as States, StatesMeta as StatesMeta, StatisticsRuns as StatisticsRuns, StatisticsShortTerm as StatisticsShortTerm
3
3
  from collections.abc import Iterable
4
4
  from datetime import datetime
5
5
  from sqlalchemy.sql.lambdas import StatementLambdaElement as StatementLambdaElement
6
6
  from sqlalchemy.sql.selectable import Select as Select
7
7
 
8
+ def select_event_type_ids(event_types: tuple[str, ...]) -> Select: ...
8
9
  def get_shared_attributes(hashes: list[int]) -> StatementLambdaElement: ...
9
10
  def get_shared_event_datas(hashes: list[int]) -> StatementLambdaElement: ...
10
- def find_shared_attributes_id(data_hash: int, shared_attrs: str) -> StatementLambdaElement: ...
11
- def find_shared_data_id(attr_hash: int, shared_data: str) -> StatementLambdaElement: ...
11
+ def find_event_type_ids(event_types: Iterable[str]) -> StatementLambdaElement: ...
12
+ def find_all_states_metadata_ids() -> StatementLambdaElement: ...
13
+ def find_states_metadata_ids(entity_ids: Iterable[str]) -> StatementLambdaElement: ...
12
14
  def _state_attrs_exist(attr: Union[int, None]) -> Select: ...
13
15
  def attributes_ids_exist_in_states_with_fast_in_distinct(attributes_ids: Iterable[int]) -> StatementLambdaElement: ...
14
16
  def attributes_ids_exist_in_states(attr1: int, attr2: Union[int, None], attr3: Union[int, None], attr4: Union[int, None], attr5: Union[int, None], attr6: Union[int, None], attr7: Union[int, None], attr8: Union[int, None], attr9: Union[int, None], attr10: Union[int, None], attr11: Union[int, None], attr12: Union[int, None], attr13: Union[int, None], attr14: Union[int, None], attr15: Union[int, None], attr16: Union[int, None], attr17: Union[int, None], attr18: Union[int, None], attr19: Union[int, None], attr20: Union[int, None], attr21: Union[int, None], attr22: Union[int, None], attr23: Union[int, None], attr24: Union[int, None], attr25: Union[int, None], attr26: Union[int, None], attr27: Union[int, None], attr28: Union[int, None], attr29: Union[int, None], attr30: Union[int, None], attr31: Union[int, None], attr32: Union[int, None], attr33: Union[int, None], attr34: Union[int, None], attr35: Union[int, None], attr36: Union[int, None], attr37: Union[int, None], attr38: Union[int, None], attr39: Union[int, None], attr40: Union[int, None], attr41: Union[int, None], attr42: Union[int, None], attr43: Union[int, None], attr44: Union[int, None], attr45: Union[int, None], attr46: Union[int, None], attr47: Union[int, None], attr48: Union[int, None], attr49: Union[int, None], attr50: Union[int, None], attr51: Union[int, None], attr52: Union[int, None], attr53: Union[int, None], attr54: Union[int, None], attr55: Union[int, None], attr56: Union[int, None], attr57: Union[int, None], attr58: Union[int, None], attr59: Union[int, None], attr60: Union[int, None], attr61: Union[int, None], attr62: Union[int, None], attr63: Union[int, None], attr64: Union[int, None], attr65: Union[int, None], attr66: Union[int, None], attr67: Union[int, None], attr68: Union[int, None], attr69: Union[int, None], attr70: Union[int, None], attr71: Union[int, None], attr72: Union[int, None], attr73: Union[int, None], attr74: Union[int, None], attr75: Union[int, None], attr76: Union[int, None], attr77: Union[int, None], attr78: Union[int, None], attr79: Union[int, None], attr80: Union[int, None], attr81: Union[int, None], attr82: Union[int, None], attr83: Union[int, None], attr84: Union[int, None], attr85: Union[int, None], attr86: Union[int, None], attr87: Union[int, None], attr88: Union[int, None], attr89: Union[int, None], attr90: Union[int, None], attr91: Union[int, None], attr92: Union[int, None], attr93: Union[int, None], attr94: Union[int, None], attr95: Union[int, None], attr96: Union[int, None], attr97: Union[int, None], attr98: Union[int, None], attr99: Union[int, None], attr100: Union[int, None]) -> StatementLambdaElement: ...
@@ -30,3 +32,17 @@ def find_statistics_runs_to_purge(purge_before: datetime) -> StatementLambdaElem
30
32
  def find_latest_statistics_runs_run_id() -> StatementLambdaElement: ...
31
33
  def find_legacy_event_state_and_attributes_and_data_ids_to_purge(purge_before: float) -> StatementLambdaElement: ...
32
34
  def find_legacy_row() -> StatementLambdaElement: ...
35
+ def find_events_context_ids_to_migrate() -> StatementLambdaElement: ...
36
+ def find_event_type_to_migrate() -> StatementLambdaElement: ...
37
+ def find_entity_ids_to_migrate() -> StatementLambdaElement: ...
38
+ def batch_cleanup_entity_ids() -> StatementLambdaElement: ...
39
+ def has_used_states_event_ids() -> StatementLambdaElement: ...
40
+ def has_events_context_ids_to_migrate() -> StatementLambdaElement: ...
41
+ def has_states_context_ids_to_migrate() -> StatementLambdaElement: ...
42
+ def has_event_type_to_migrate() -> StatementLambdaElement: ...
43
+ def has_entity_ids_to_migrate() -> StatementLambdaElement: ...
44
+ def find_states_context_ids_to_migrate() -> StatementLambdaElement: ...
45
+ def find_event_types_to_purge() -> StatementLambdaElement: ...
46
+ def find_entity_ids_to_purge() -> StatementLambdaElement: ...
47
+ def delete_event_types_rows(event_type_ids: Iterable[int]) -> StatementLambdaElement: ...
48
+ def delete_states_meta_rows(metadata_ids: Iterable[int]) -> StatementLambdaElement: ...
@@ -4,7 +4,7 @@ from .tasks import PurgeEntitiesTask as PurgeEntitiesTask, PurgeTask as PurgeTas
4
4
  from _typeshed import Incomplete
5
5
  from homeassistant.core import HomeAssistant as HomeAssistant, ServiceCall as ServiceCall, callback as callback
6
6
  from homeassistant.helpers.entityfilter import generate_filter as generate_filter
7
- from homeassistant.helpers.service import async_extract_entity_ids as async_extract_entity_ids
7
+ from homeassistant.helpers.service import async_extract_entity_ids as async_extract_entity_ids, async_register_admin_service as async_register_admin_service
8
8
 
9
9
  SERVICE_PURGE: str
10
10
  SERVICE_PURGE_ENTITIES: str