Commit Graph

608 Commits (d72c28a1357dba0bef25ee0acc2f07e628109458)

Author SHA1 Message Date
GitHub Action f19a1147fe [ci skip] Translation update 2022-12-11 00:26:24 +00:00
GitHub Action f25017313a [ci skip] Translation update 2022-12-09 00:24:29 +00:00
Erik Montnemery 587381440f
Fix repairing datetime precision for PostgreSQL (#83351) 2022-12-05 22:33:06 -05:00
GitHub Action 03154e1d83 [ci skip] Translation update 2022-12-03 00:21:50 +00:00
Erik Montnemery f869ce9d06
Validate common statistics DB schema errors on start (#79707)
* Validate common statistics db schema errors on start

* Fix test

* Add tests

* Adjust tests

* Disable statistics schema validation in tests

* Update after rebase
2022-11-29 10:16:08 +01:00
GitHub Action 230b50d099 [ci skip] Translation update 2022-11-29 00:26:01 +00:00
Erik Montnemery 58b3a00b16
Remove unnecessary DB access from statistic_during_period (#82871) 2022-11-28 13:48:06 -05:00
Erik Montnemery a038314d8b
Add display unit to WS recorder/get_statistics_metadata (#82870) 2022-11-28 13:46:57 -05:00
Erik Montnemery 2fe8e95309
Add helper to calculate statistic period start and end (#82493)
* Add helper to calculate statistic period start and end

* Don't parse values in resolve_period

* Add specific test for resolve_period

* Improve typing

* Move to recorder/util.py

* Extract period schema
2022-11-26 13:00:40 -05:00
GitHub Action f3b3193f7a [ci skip] Translation update 2022-11-25 00:24:19 +00:00
Erik Montnemery b94e1e9ef8
Fire events when long term statistics is updated (#82492)
* Fire events when long term statistics is updated

* Allow the new events to be subscribed to by anyone

* Address review comments

* Finish renaming events

* Finish renaming events

* Fix do_adhoc_statistics

* Adjust tests

* Adjust tests
2022-11-24 22:01:36 +01:00
Erik Montnemery 607a0e7697
Reduce size of get_statistics_during_period WS API response (#82131) 2022-11-16 17:36:30 +01:00
Erik Montnemery 9b8f94363c
Fix statistic_during_period for data with holes (#81847) 2022-11-16 12:46:29 +01:00
Franck Nijhof 19e5e671a2
Update sqlalchemy to 1.4.44 (#82129) 2022-11-15 08:51:13 -06:00
Marc Mueller 0c8eeaa643
Update mypy to 0.990 (#81783)
* Update mypy to 0.990

* Remove type ignore - overriding attr with property (13475)

* Remove type ignores - hasattr (13544)

* Adjust type ignore - assignment (13549)

* New error code - type-abstract (13785)

* Disable annotation-unchecked (13851)
2022-11-08 14:41:39 +01:00
Erik Montnemery 68346599d2
Add WS API recorder/statistic_during_period (#80663) 2022-10-27 15:51:09 -04:00
Michael 8175dab7ab
Add week period to recorder statistics api (#80784)
* add week period to get statistics api

* add test
2022-10-25 20:07:28 +02:00
Erik Montnemery beeee8b60e
Use start helper in recorder (#79559) 2022-10-25 10:38:07 +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
Marc Mueller d78c2a31a1
Update pylint to 2.15.4 (#80612) 2022-10-20 08:59:06 +02:00
Erik Montnemery eca21ceff0
Make all datetime columns in recorder DB µs precision (#80584) 2022-10-19 10:26:17 +02:00
Erik Montnemery d1facab71c
Add guard in recorder retry function (#80585) 2022-10-19 10:05:55 +02:00
epenet 5442d6af01
Improve msg type hint in websocket commands (#80530) 2022-10-18 16:41:17 +02:00
Franck Nijhof cb530e398c
Update sqlalchemy to 1.4.42 (#80495) 2022-10-17 23:30:21 -04:00
Erik Montnemery b42e26fbdd
Use SupportedDialect enum in recorder (#80319) 2022-10-14 08:45:57 -04:00
Erik Montnemery 2e261d5dc2
Allow specifying the target table when importing statistics (#80230)
Allow specifying the table when importing statistics
2022-10-14 08:32:19 +02:00
Erik Montnemery 04cc2ae264
Correct initialization of new databases (#80234) 2022-10-13 13:01:27 +02:00
Erik Montnemery 466c4656ca
Refactor recorder migration (#80175)
* Refactor recorder migration

* Improve test coverage
2022-10-13 08:11:54 +02:00
Erik 4a1c40f09b Revert "Refactor recorder migration"
This reverts commit 69e10e5982.
2022-10-12 15:12:12 +02:00
Erik 69e10e5982 Refactor recorder migration 2022-10-12 15:00:28 +02:00
Erik Montnemery 577f7904b5
Minor improvements of recorder typing (#80165)
* Minor improvements of recorder typing

* Only allow specifying statistic_ids as lists
2022-10-12 14:59:10 +02:00
Erik Montnemery 9aa6043255
Set character set to utf8mb4 when connecting to MySQL or MariaDB databases (#79755) 2022-10-11 14:01:46 +02:00
Erik Montnemery e8af007124
Disable echo for non SQLite databases (#80032)
* Disable echo for non SQLite databases

* Add test
2022-10-10 22:42:38 +03:00
Franck Nijhof 2b27cfdabb
Set system & entity integration types (#79593) 2022-10-04 10:36:42 -04:00
Erik Montnemery 92ca95ca81
Fix preserving long term statistics when entity_id is changed (#79556) 2022-10-03 21:13:48 -04:00
Erik Montnemery a2e3978d53
Don't normalize units of long term statistics (#79320)
* Don't normalize units of long term statistics

* Update statistics.py
2022-10-03 21:42:44 +02:00
Erik Montnemery 0fdb7052e9
Add comment in recorder about dropping column (#79523)
Add comment in recorder
2022-10-03 11:40:11 +02:00
Erik Montnemery 2de273500e
Remove state_unit_of_measurement from metadata DB table (#79370)
* Remove state_unit_of_measurement from metadata DB table

* Adjust test
2022-10-01 18:55:00 +02:00
Marc Mueller 3a9ecab98a
Improve iterable typing (1) (#79295) 2022-10-01 00:12:39 +02:00
Erik Montnemery bc2dffabc4
Improve naming of units used in statistics (#79276) 2022-09-30 08:38:44 +02:00
epenet 5438552d4a
Cleanup unit conversion (#79197)
* Move UNIT_RATIO to BaseUnitConverter

* Make UNIT_CONVERSION private

* Remove STATISTIC_UNIT_TO_UNIT_CLASS constant

* Cleanup websocket_api

* Imrpove valid_units check
2022-09-28 13:49:46 +02:00
epenet 5389ff3253
Add new weight device class (#79185) 2022-09-28 12:13:49 +02:00
epenet 12e4d18038
Add volume to SensorDeviceClass (#77960)
* Add volume to SensorDeviceClass

* Adjust recorder

* Adjust tests

* Adjust sensor UNIT_CONVERTERS

* Adjust recorder

* Update strings.json
2022-09-27 19:37:52 +02:00
epenet 7c448416e1
Add speed to SensorDeviceClass (#77953)
* Add speed to SensorDeviceClass

* Adjust recorder

* Adjust tests

* Adjust sensor UNIT_CONVERTERS

* Add tests

* Add websocket tests

* Update strings.json
2022-09-27 17:19:34 +01:00
epenet bfcc18e5b8
Add distance to SensorDeviceClass (#77951)
* Add distance to SensorDeviceClass

* Adjust recorder

* Adjust tests

* Adjust recorder

* Update __init__.py

* Update test_websocket_api.py

* Update test_websocket_api.py

* Update test_websocket_api.py

* Update strings.json

* Fix tests

* Adjust docstring
2022-09-27 15:34:00 +01:00
Erik Montnemery 2167cf540d
Drop some unused constants from recorder (#79138) 2022-09-27 10:52:16 +02:00
Erik Montnemery c52d0f7495
Support converting statistics to another unit (#79117) 2022-09-27 08:44:58 +02:00
Marc Mueller e8156adb13
Update mypy to 0.981 (#79115) 2022-09-26 16:10:06 -04:00
epenet 83b426deb0
Adjust normalization routines in recorder statistics (#78966) 2022-09-23 08:27:27 -04:00
epenet ddf56baf7a
Move temperature utility to unit_conversion (#78960) 2022-09-22 18:31:50 +02:00