Commit Graph

19 Commits (d811fa0e74bcc98a3be182f4ef09ba0cf8be7882)

Author SHA1 Message Date
J. Nick Koston 5ffb233004
Avoid database executor job to fetch statistic metadata on cache hit (#89960)
* Avoid database executor job to fetch statistic metadata on cache hit

Since we will almost always have a cache hit fetching
statistic meta data we can avoid an executor job

* Avoid database executor job to fetch statistic metadata on cache hit

Since we will almost always have a cache hit fetching
statistic meta data we can avoid an executor job

* Avoid database executor job to fetch statistic metadata on cache hit

Since we will almost always have a cache hit fetching
statistic meta data we can avoid an executor job

* remove exception catch since the threading.excepthook will actually catch this in production

* fix a few missed ones

* threadsafe

* Update homeassistant/components/recorder/table_managers/statistics_meta.py

* coverage and optimistic caching
2023-03-19 22:01:16 -04:00
J. Nick Koston a6d6807dd0
Add typing to statistics results (#89118) 2023-03-14 09:06:56 -10:00
J. Nick Koston c35661947a
Optimize fetching statistics by avoiding timestamp conversions (#87845)
* Optimize fetching statistics by avoiding timestamp conversions

* remove accidential unrelated change

* fix test

* recreate so we handle timezone changes
2023-02-10 11:26:46 -05:00
J. Nick Koston ea356ad260
Optimize fetching weekly/monthly/yearly statistics (#87747)
* Optimize fetching statistics

* speed up

* avoid double groupby

* avoid another loop

* tweak flow

* fixes

* tweak

* avoid a new dt object in the cache for week/month

* avoid a new dt object in the cache for week/month
2023-02-09 21:22:32 -05:00
Erik Montnemery 607a0e7697
Reduce size of get_statistics_during_period WS API response (#82131) 2022-11-16 17:36:30 +01:00
epenet 842cb18d39
Migrate energy units to an enum (#80998) 2022-10-26 13:56:51 +02:00
epenet 2c43606922
Add websocket type hints in components (#80654)
* Add websocket type hints in components

* Adjust

* Apply suggestion

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-10-20 13:41:14 +02:00
epenet 5442d6af01
Improve msg type hint in websocket commands (#80530) 2022-10-18 16:41:17 +02:00
Erik Montnemery 5d7756885b
Normalize to kWh when handling WS energy/fossil_energy_consumption (#79649)
* Normalize to kWh when handling WS energy/fossil_energy_consumption

* Improve test
2022-10-05 16:27:08 +02:00
J. Nick Koston 97aa65d9a4
Run energy db calls in the db executor (#69544)
Fixes #69537
2022-04-07 11:50:49 +02:00
Marc Mueller 67c35652f0
Update typing - collections.abc (2) (#63934) 2022-01-12 09:04:37 +01:00
Erik Montnemery 27d1063dec
Revert "Skip duplicated data when calculating fossil energy consumption (#60599)" (#61323)
This reverts commit 159506262a.
2021-12-10 08:19:53 +01:00
Erik Montnemery 159506262a
Skip duplicated data when calculating fossil energy consumption (#60599) 2021-12-08 10:59:26 -08:00
Erik Montnemery e33384d8b9
Fix CO2 calculation when data is missing (#61106) 2021-12-06 09:55:28 -08:00
Erik Montnemery 4a5238efa5
Add support for calculating daily and monthly fossil energy consumption (#59588) 2021-11-22 09:10:54 -08:00
Paulus Schoutsen 7c5a0174ba
Add an energy solar platform for solar forecasts (#54576)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-08-25 11:37:03 -07:00
Paulus Schoutsen 2f77b5025c
Add energy validation (#54567) 2021-08-18 11:21:51 -07:00
Bram Kragten 4df56bad9e
Remove currency from energy, use core config (#53615)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-07-28 08:49:55 -07:00
Bram Kragten fcc6ea7497
Add energy integration (#52001)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Erik <erik@montnemery.com>
2021-07-26 09:37:37 -07:00