Commit Graph

275 Commits (5d56ce67f5a9b07c77bce0d1930072a6d4727863)

Author SHA1 Message Date
Franck Nijhof c875ff8648
Store JSON in database in compact format (#53364)
* Store JSON in database in compact format

* Fix logbook
2021-07-22 12:05:59 -10:00
Ville Skyttä 470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Erik Montnemery e541bcd54d
Update statistics meta data on entity_id change (#52755) 2021-07-14 13:23:11 +02: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 19d3aa71ad
Enable basic type checking for recorder (#52440)
* Enable basic type checking for recorder

* Tweak
2021-07-13 21:21:45 +02:00
Erik Montnemery c5556a091e
Return empty when listing statistic_ids for unsupported statistic (#52954) 2021-07-13 10:35:55 +02:00
J. Nick Koston 0099b54489
Fix recorder purge with sqlite3 < 3.32.0 (#52929) 2021-07-12 22:03:13 +02:00
Franck Nijhof 74029a0948
Fix Statistics recorder migration path by dropping in pairs (#52453) 2021-07-05 13:34:40 +02:00
Franck Nijhof 5e9127ef7a
Remove problematic/redudant db migration happning schema 15 (#52541) 2021-07-05 13:28:01 +02:00
Franck Nijhof 7f3f6757ea
Fix Statistics recorder migration order (#52449) 2021-07-02 20:55:40 +02:00
Erik Montnemery ed25e6fada
Correct recorder table arguments (#52436) 2021-07-02 16:28:16 +02:00
Erik Montnemery 11fd9d9525
Avoid duplicated database queries when fetching statistics (#52433) 2021-07-02 15:40:54 +02:00
Erik Montnemery 24ae05b734
Drop statistic_id and source columns from statistics table (#52417)
* Drop statistic_id and source columns from statistics table

* Remove useless double drop of statistics table

* Update homeassistant/components/recorder/models.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

* black

Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-07-02 13:17:00 +02:00
Erik Montnemery 16d2dcbfb2
Improve sensor statistics tests (#52386) 2021-07-02 09:51:47 +02:00
Erik Montnemery d450cda385
Report target unit in statistics meta data (#52341) 2021-06-30 16:53:51 +02:00
Erik Montnemery 9d0c4c168e
Convert units when fetching statistics (#52338) 2021-06-30 14:53:42 +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
PeteBa 42c4317628
Avoid drift in recorder purge cut-off (#52135) 2021-06-25 11:29:38 -10: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
J. Nick Koston b3a67a2dd7
Bump sqlalchemy to 1.4.17 (#51593) 2021-06-08 16:53:51 +02:00
J. Nick Koston 06c9a50869
Handle missing options in foreign_key for MSSQL (#51503) 2021-06-05 12:13:12 +02:00
Raman Gupta 58e37435b3
Make more max lengths constants and add additional MaxLengthExceeded checks (#50337)
* Add more MaxLengthExceeded checks

* remove some validations to reduce performance impact

* check length of generated entity ID

* dont check entity ID twice and use single context id length constant

* fix test

* add missing test
2021-05-25 19:58:01 +02:00
tkdrob 028a07d86f
Wrap up selectors (#50794)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-05-25 14:45:17 +02:00
Marcin Ciupak caad125b44
Add support for Oracle DB in recorder (#50090) 2021-05-22 21:10:27 -05:00
PeteBa aa9b99713c
Add purge_entities service call to recorder (#48069) 2021-05-22 10:30:05 -05:00
Erik Montnemery 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 Koston e7f7e61e88
Ensure a wal checkpoint is scheduled nightly (#50746) 2021-05-17 16:27:51 -05:00
J. Nick Koston 72288710ca
Increase the sqlite cache size from ~2MiB to 8MiB (#50747) 2021-05-17 19:42:12 +02:00
Erik Montnemery 89dd3292ba
Initial draft of statistics (#49852) 2021-05-16 10:23:37 -07:00
tkdrob 2d5f5bfa9f
Add targets and selectors for services (P-R) (#50628) 2021-05-14 22:07:17 -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
J. Nick Koston 906de23087
Bump sqlalchemy to 1.4.13 (#50138) 2021-05-05 20:08:48 -07:00
J. Nick Koston 1c8d9ca68b
Check exception causes for matching strings during recorder migration (#49999) 2021-05-02 20:57:42 -07:00
Paulus Schoutsen 1bd9826684
Handle different entity_id formats (#49969) 2021-05-01 20:30:28 -07:00
J. Nick Koston b27e9e376d
Use StaticPool for recorder and NullPool for all other threads with sqlite3 (#49693) 2021-04-26 19:20:31 -10:00
J. Nick Koston 376b787e4d
Skip recorder commit if there is nothing to do (#49614) 2021-04-25 12:05:49 +02:00
jan iversen c351098f04
HomeAssistantType —> HomeAssistant for Integrations p* - s* (#49558) 2021-04-22 19:58:02 +02:00
J. Nick Koston c10836fcee
Upgrade to sqlalchemy 1.4.11 (#49538) 2021-04-21 20:29:36 -10:00
J. Nick Koston 6d137d2316
Increase recorder test coverage (#49362)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-19 08:22:38 -07:00
J. Nick Koston 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
Franck Nijhof 055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
J. Nick Koston 53853f035d
Prevent calling stop or restart services during db upgrade (#49098) 2021-04-12 17:18:38 -07:00
J. Nick Koston 9368891b1b
Live db migrations and recovery (#49036)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-11 20:43:54 -10:00
Raman Gupta 3ca69f5568
Raise an exception when event_type exceeds the max length (#48115)
* raise an exception when event_type exceeds the max length that the recorder supports

* add test

* use max length constant in recorder

* update config entry reloaded service name

* remove exception string function because it's not needed

* increase limit to 64 and revert event name change

* fix test

* assert exception args

* fix test

* add comment about migration
2021-04-08 20:46:28 +02:00
Laszlo Magyar c7e4857d2c
Let recorder deal with event names longer than 32 chars (#47748) 2021-04-08 07:08:49 -10:00
Stefan Agner 815db999da
Use microsecond precision for datetime values on MariaDB/MySQL (#48749)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-04-07 09:13:55 +02:00
Franck Nijhof 3aed84560f
Merge of nested IF-IF cases - O-R (#48371) 2021-03-27 10:38:57 +01:00
J. Nick Koston c820dd4cb5
Have pylint warn when user visible log messages do not start with capital letter or end with a period (#48064)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-19 09:26:36 -05:00
Marc Mueller a3cd1854f6
Update typing 12 (#48073) 2021-03-18 14:31:38 +01:00