Erik Montnemery
b145aeaf75
Fix flaky recorder test ( #73733 )
2022-06-20 12:27:25 +02:00
J. Nick Koston
8e8fa0399e
Fix statistics_during_period being incorrectly cached ( #72947 )
2022-06-03 13:04:46 -07:00
J. Nick Koston
5b31414225
Fix misalignments between sql based filtering with the entityfilter based filtering ( #72936 )
2022-06-02 20:52:53 -07:00
J. Nick Koston
a43d47fa0b
Escape % and _ in history/logbook entity_globs, and use ? as _ ( #72623 )
...
Co-authored-by: pyos <pyos100500@gmail.com>
2022-05-27 14:38:29 -07:00
J. Nick Koston
1001f9e39a
Fix last state in history minimal respones when all the states at the end are skipped ( #72203 )
2022-05-19 20:58:32 -07:00
J. Nick Koston
1f753ecd88
Relocate sqlalchemy filter builder to recorder/filters.py ( #71883 )
2022-05-14 23:04:23 -07:00
J. Nick Koston
65f44bd80b
Exclude last_changed when same as last_updated for history websocket api ( #71886 )
2022-05-14 23:03:56 -07:00
J. Nick Koston
68632cb267
Implement use_include_order in the history websocket api ( #71839 )
2022-05-14 12:37:35 -07:00
J. Nick Koston
e2cef55162
Add history/history_during_period websocket endpoint ( #71688 )
2022-05-11 17:52:22 -05:00
J. Nick Koston
7c9c0e911a
Move do_adhoc_statistics to recorder test helpers ( #71544 )
2022-05-08 12:45:57 -07:00
J. Nick Koston
29bda196b5
Break apart recorder into tasks and core modules ( #71222 )
2022-05-02 21:53:56 -07:00
Erik Montnemery
3016b5fbfc
Use recorder fixtures and helpers in tests ( #70773 )
2022-04-26 06:08:00 -10:00
Erik Montnemery
28ebab9c5a
Simplify waiting for recorder in tests ( #70647 )
2022-04-25 12:04:47 +02:00
Erik Montnemery
982e314de6
Use recorder_mock in tests ( #70363 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-22 19:29:44 -10:00
Erik Montnemery
61cc8e32f3
Include has_mean + has_sum in statistics metadata WS response ( #68546 )
...
* Include has_mean + has_sum in statistics metadata WS response
* Don't include has_mean/has_sum in history/list_statistic_ids
* Adjust tests
* Do include has_mean/has_sum in history/list_statistic_ids
2022-03-24 10:12:01 +01:00
J. Nick Koston
816695cc96
Avoid selecting attributes in the history api when `no_attributes` is passed ( #68352 )
2022-03-19 23:47:22 -10:00
Erik Montnemery
f594bc353b
Add support for external statistics ( #56607 )
...
* Support external statistics
* Update tests
* Lint
* Adjust code after rebase
* Separate external statistic_id with :, add name to metadata
* Adjust tests
* Simplify get_metadata_with_session
* Address review comments
* Allow updating external statistics
* Validate input
* Adjust tests after rebase
* Pylint
* Adjust tests
* Improve test coverage
2021-10-26 10:26:50 +02:00
Ville Skyttä
b52c5c82b1
Use http.HTTPStatus in components/[gh]* ( #58246 )
2021-10-23 20:34:53 +02:00
Erik Montnemery
40ecf22bac
Remove automatic splitting of net meters from statistics ( #56772 )
2021-09-29 17:20:17 +02:00
Erik Montnemery
8c5efafdd8
Add 5-minute statistics for sensors ( #56006 )
...
* Add 5-minute statistics for sensors
* Address pylint issues
* Black
* Apply suggestion from code review
* Apply suggestions from code review
* Improve tests
2021-09-16 10:57:15 +02:00
Erik Montnemery
d2a9f7904a
Include end time of statistics data points in API response ( #56063 )
...
* Include end time of statistics data points in API response
* Correct typing
* Update tests
2021-09-13 10:02:24 +02:00
Erik Montnemery
80fd330479
Add sum_decrease and sum_increase statistics ( #55850 )
2021-09-08 23:35:53 -07:00
Erik Montnemery
8877f37da0
Fix statistics for sensors setting last_reset ( #55136 )
...
* Re-add state_class total to sensor
* Make energy cost sensor enforce state_class total_increasing
* Drop state_class total
* Only report energy sensor issues once
2021-08-24 17:02:34 +02:00
Erik Montnemery
e1926caeb9
Remove STATE_CLASS_TOTAL and last_reset from sensor ( #54755 )
...
* Remove STATE_CLASS_TOTAL
* Update mill sensor
* Update tests
* Kill last_reset
* Return ATTR_LAST_RESET to utility_meter
* Update energy cost sensor
* Restore last_reset for backwards compatibility
* Re-add and update deprecation warning
* Update tests
* Fix utility_meter
* Update EnergyCostSensor
* Tweak
* Fix rebase mistake
* Fix test
2021-08-18 10:03:27 +02: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
Erik Montnemery
ddc788bf8e
Include future statistics in history/list_statistic_ids ( #52942 )
...
* Include future statistics in history/list_statistic_ids
* Improve tests
2021-07-14 11:54:55 +02:00
Erik Montnemery
c5556a091e
Return empty when listing statistic_ids for unsupported statistic ( #52954 )
2021-07-13 10:35:55 +02:00
Erik Montnemery
d450cda385
Report target unit in statistics meta data ( #52341 )
2021-06-30 16:53:51 +02:00
Erik Montnemery
0476c7f9ee
Normalize temperature statistics to °C ( #52297 )
...
* Normalize temperature statistics to °C
* Fix tests
* Support temperature conversion to and from K, improve tests
* Fix test
* Add tests, pylint
2021-06-30 14:17:58 +02:00
Erik Montnemery
0ab999738b
Add statistics meta data table ( #52331 )
...
* Add statistics meta data table
* Tweak meta data generation
2021-06-30 13:32:17 +02:00
Erik Montnemery
0ca199d8d0
Add WS API for listing available statistic ids ( #51984 )
...
* Add WS API for listing available statistic ids
* Update homeassistant/components/history/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2021-06-18 21:32:30 +02:00
Paulus Schoutsen
805ef3f90b
Allow fetching multiple statistics ( #51996 )
2021-06-18 21:03:13 +02:00
Erik Montnemery
27b9d7fed0
Fix flaky statistics tests ( #51242 )
2021-05-29 09:00:36 -05:00
Bram Kragten
26563e3ea4
Add statistics websocket endpoint ( #51044 )
...
Co-authored-by: Erik <erik@montnemery.com>
2021-05-25 08:03:37 -07:00
Erik Montnemery
973f59e423
Refactor history component ( #50287 )
...
* Refactor history component
* Update tests
* Address review comments
* Correct deprecated functions
2021-05-11 09:21:57 +02:00
Marc Mueller
8e2b5b36b5
Bump pyupgrade to 2.12.0 ( #48943 )
2021-04-09 09:58:27 -07:00
Matthew Donoughe
9011a54e7f
Switch history tests to pytest ( #42318 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-17 15:32:44 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest ( #44746 )
2021-01-01 22:31:56 +01:00
J. Nick Koston
9649525fe6
Increase coverage and optimize history skip_initial_state ( #42014 )
...
Avoids a database query when all states have not
changed in the time window when skip_initial_state
is set.
2020-10-19 09:53:47 +02:00
J. Nick Koston
68e1c70b14
Update history tests to use async_add_executor_job ( #41526 )
2020-10-09 08:36:59 +02:00
J. Nick Koston
aada6a1d88
Fix logbook with empty filter and remove unused code ( #40565 )
2020-09-30 13:10:11 +02:00
J. Nick Koston
a19e10c57a
Add entity glob matching support to history ( #40387 )
2020-09-28 15:58:55 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 ( #39287 )
2020-08-27 13:56:20 +02:00
J. Nick Koston
f8d547f2d3
Adjust history as all scripts can now be canceled ( #37820 )
2020-07-14 22:31:34 +02:00
Paulus Schoutsen
8ed1a29c82
Drop white blacklist pt1 ( #37816 )
2020-07-13 17:43:11 +02:00
J. Nick Koston
b64ae55c66
Prebake common history queries ( #37496 )
...
* Prebake common history queries
The python overhead of to construct
the queries exceeded the database overhead. We now
prebake the queries that get frequently polled.
This reduces the time it takes to update history_stats
sensors and can make quite a difference if there
are a lot of them.
When using the mini-graph-card card, all the entities
on the card being graphed are queried every few seconds
for new states. Previously this would tie up the database if there
are lot of these graphs in the UI.
* Update homeassistant/components/history/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/history/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* cache entity_filter in the lambda
* switch to yield
* Revert "switch to yield"
This reverts commit f8386f4940
.
* get_states always returns a list
* query wasnt actually reusable so revert part of the breakout
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-07-05 11:03:23 -05:00
J. Nick Koston
f4528d0db2
Ensure history states can be copied ( #37081 )
...
The filter integration makes a copy of a
state object obtained from history.
2020-06-24 22:43:08 -05:00
J. Nick Koston
5b79c1f9ef
Remove support for deprecated hidden attribute from logbook and history ( #37039 )
2020-06-23 13:40:39 -07:00
J. Nick Koston
e19c97af7c
Fix history api with no constraints ( #36979 )
2020-06-22 10:32:46 -05:00
J. Nick Koston
9cc20fc6b8
Fix history graphs with mysql/mariadb ( #36769 )
2020-06-13 21:22:16 -07:00