Commit Graph
110 Commits
Author SHA1 Message Date
Erik MontnemeryandGitHub e541bcd54d Update statistics meta data on entity_id change (#52755) 2021-07-14 13:23:11 +02:00
Erik MontnemeryandGitHub 11fd9d9525 Avoid duplicated database queries when fetching statistics (#52433) 2021-07-02 15:40:54 +02:00
Erik MontnemeryandGitHub 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
PeteBaandGitHub 42c4317628 Avoid drift in recorder purge cut-off (#52135) 2021-06-25 11:29:38 -10:00
Paulus SchoutsenandGitHub 805ef3f90b Allow fetching multiple statistics (#51996) 2021-06-18 21:03:13 +02:00
Erik MontnemeryandGitHub 39c94e8daa Fix flaky statistics tests (#51214)
* Fix flaky statistics tests

* Tweak
2021-05-28 22:37:17 +02:00
Erik MontnemeryandGitHub b339d73109 Weight sensor average statistics by state durations (#51150)
* Weight sensor average statistics by state durations

* Fix test
2021-05-28 13:16:52 +02:00
PeteBaandGitHub aa9b99713c Add purge_entities service call to recorder (#48069) 2021-05-22 10:30:05 -05:00
Erik MontnemeryandGitHub e16a8063a5 Compile statistics for energy sensors (#50829)
* Compile statistics for energy sensors

* Update tests

* Rename abs_value to state

* Tweak

* Recreate statistics table

* Pylint

* Try to fix test

* Fix statistics for multiple energy sensors

* Fix energy statistics when last_reset is not set
2021-05-20 13:05:15 +02:00
J. Nick KostonandGitHub e7f7e61e88 Ensure a wal checkpoint is scheduled nightly (#50746) 2021-05-17 16:27:51 -05:00
J. Nick KostonandGitHub 72288710ca Increase the sqlite cache size from ~2MiB to 8MiB (#50747) 2021-05-17 19:42:12 +02:00
Erik MontnemeryandGitHub 89dd3292ba Initial draft of statistics (#49852) 2021-05-16 10:23:37 -07:00
Erik MontnemeryandGitHub 973f59e423 Refactor history component (#50287)
* Refactor history component

* Update tests

* Address review comments

* Correct deprecated functions
2021-05-11 09:21:57 +02:00
bf2d40adfe Migrate from pytz to python-dateutil (#49643)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-05-07 22:46:26 -07:00
J. Nick KostonandGitHub 1c8d9ca68b Check exception causes for matching strings during recorder migration (#49999) 2021-05-02 20:57:42 -07:00
Paulus SchoutsenandGitHub 1bd9826684 Handle different entity_id formats (#49969) 2021-05-01 20:30:28 -07:00
J. Nick KostonandGitHub b27e9e376d Use StaticPool for recorder and NullPool for all other threads with sqlite3 (#49693) 2021-04-26 19:20:31 -10:00
jan iversenandGitHub c351098f04 HomeAssistantType —> HomeAssistant for Integrations p* - s* (#49558) 2021-04-22 19:58:02 +02:00
J. Nick KostonandGitHub c10836fcee Upgrade to sqlalchemy 1.4.11 (#49538) 2021-04-21 20:29:36 -10:00
6d137d2316 Increase recorder test coverage (#49362)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-19 08:22:38 -07:00
J. Nick KostonandGitHub e24f5831a2 Force recorder shutdown at final write event (#49145)
* Force recorder shutdown at EVENT_HOMEASSISTANT_FINAL_WRITE

* remove unreachable

* remove unreachable

* simplify

* cancel in async
2021-04-19 11:24:17 +02:00
J. Nick KostonandGitHub 53853f035d Prevent calling stop or restart services during db upgrade (#49098) 2021-04-12 17:18:38 -07:00
9368891b1b Live db migrations and recovery (#49036)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-11 20:43:54 -10:00
Laszlo MagyarandGitHub c7e4857d2c Let recorder deal with event names longer than 32 chars (#47748) 2021-04-08 07:08:49 -10:00
08870690a6 Fix a collection of tests with missing asserts (#48127)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-20 17:23:55 +01:00
Franck NijhofandGitHub fb849b81b5 Rewrite of not a == b occurances (#48132) 2021-03-20 01:27:04 +01:00
J. Nick KostonandGitHub 28c80c1133 Ensure recorder purge tests can handle multiple purge cycle (#47956)
Since a purge can generate another purge task, we now wait for
three recorder queue completions by default.
2021-03-15 11:19:19 -07:00
J. Nick KostonandGitHub 61a2460c87 Improve error reporting in recorder purge test (#47929) 2021-03-14 19:46:21 -07:00
Erik MontnemeryandGitHub 2178e27fb4 Fix unclean shutdown of recorder test (#47791) 2021-03-12 14:17:27 -08:00
Marc MuellerandGitHub 92852b9c10 Add apply_filter attribute to recorder.purge service (#45826) 2021-03-11 17:03:30 -10:00
Marc MuellerandGitHub 10848b9bdf Recorder improvements (#47739) 2021-03-11 07:52:07 -10:00
a060acc2b1 Fix recorder with MSSQL (#46678)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-03-09 11:16:19 -10:00
adrian-vladandGitHub 44293a3738 Add enable and disable services for recorder (#45778) 2021-02-24 07:26:05 -06:00
J. Nick KostonandGitHub e2fd255a96 Cleanup recorder tests (#46836) 2021-02-21 09:52:41 +01:00
J. Nick KostonandGitHub 9b69549f73 Recover and restart the recorder if the sqlite database encounters corruption while running (#46612) 2021-02-19 21:26:24 -10:00
J. Nick KostonandGitHub 22dbac259b Ensure recorder shuts down cleanly on restart before startup is finished (#46604) 2021-02-19 22:18:21 -08:00
J. Nick KostonandGitHub dc26fd5149 Ensure creating an index that already exists is forgiving for postgresql (#46185)
Unlikely sqlite and mysql, postgresql throws ProgrammingError instead
of InternalError or OperationalError when trying to create an index
that already exists.
2021-02-08 23:22:38 +01:00
Franck NijhofandGitHub 65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Allen PorterandGitHub f1dff973dc Fix broken test test_auto_purge in recorder (#44687)
* Fix failing test due to edge-of-2021 bug

* Rewrite test_auto_purge to make the intent more clear
2020-12-31 12:04:12 -10:00
J. Nick KostonandGitHub 2cbb93be43 Always keep the current recorder run when purging (#43733) 2020-11-30 09:13:50 +01:00
J. Nick KostonandGitHub 4ab02cb9bc Ensure recorder commit can retry after encountering invalid data (#41426) 2020-10-08 09:15:25 +02:00
J. Nick KostonandGitHub 113d738fa2 Reduce orm overhead by grouping object expiration (#41394) 2020-10-07 15:35:48 +02:00
Ariana HlavatyandGitHub 1e9e40bf71 Rewrite recorder unittest tests to pytest style test function (#41264) 2020-10-06 21:24:13 +02:00
J. Nick KostonandGitHub 20a136e2a1 Avoid event data serialization during recorder that we throw away (#41217)
We currently serialize the event data for state change events
and then replace it because we save the state in the states table.
Since the old state and new state are both contains in the event
the cost of serializing the data has a noticable impact when there
are many state changed events.
2020-10-05 15:08:47 +02:00
J. Nick KostonandGitHub d9ba32dc3f Setup recorder model relationships to avoid calling flush (#40467) 2020-09-30 13:11:43 +02:00
J. Nick KostonandGitHub 557684c3ce Add ability to disable the sqlite3 quick_check (#39479) 2020-09-02 10:12:56 +02:00
J. Nick KostonandGitHub 56ddbd87b2 Fix recorder test intermittently failing (#39468) 2020-08-30 13:58:00 -05:00
J. Nick KostonandGitHub 45401d4308 Fix flapping recorder last run test (#39134) 2020-08-22 09:35:18 +02:00
J. Nick KostonandGitHub 7c346c2f7c Skip the sqlite quick_check on clean restarts (#38972) 2020-08-21 14:20:46 +02:00
J. Nick KostonandGitHub 7878d97588 Use SimpleQueue for recorder (#38967)
Now that python 3.7 is the minimum supported version, we can
use the more efficient SimpleQueue in the recorder as it does
not have to use threading.Lock
2020-08-21 13:54:13 +02:00