Commit graph

15522 commits

Author SHA1 Message Date
epenet
9a784fddef
Fail CI on lingering timers (#89292) 2023-03-20 10:20:19 +01:00
J. Nick Koston
d33a303a83
Fix statistics schema µs precision auto repair being ineffective (#89902)
If a user manually migrated their database to MySQL or PostgresSQL
and incorrectly created the timestamp columns as float we would
fail to correct them to double because when we migrated to use
timestamps for the columns I missed that we needed to change the
columns and types for µs precision
2023-03-20 00:06:37 -04:00
J. Nick Koston
e798c30b8b
Fix statistics schema auto repair when there is bad data (#89903)
- If the user had previously duplicated data we could end up
  picking the next metadata_id and there could be stale rows
  in the database that have that metadata_id. This can only happen
  from bad manual migrations (which is what this is function
  is validating in the first place). To solve this we now insert
  data with a future date and look at the latest inserted row
  instead of the first.

Example
```
['stored_statistics',
  defaultdict(<class 'list'>,
              {'recorder.db_test_schema': [{'end': 948589200.0,
                                            'last_reset': None,
                                            'max': None,
                                            'mean': 2021.0,
                                            'min': None,
                                            'start': 948585600.0,
                                            'state': None,
                                            'sum': 394.5068},
                                          {'end': 1601946000.000001,
                                            'last_reset': 1601942400.000001,
                                            'max': 1.000000000000001,
                                            'mean': 1.000000000000001,
                                            'min': 1.000000000000001,
                                            'start': 1601942400.000001,
                                            'state': 1.000000000000001,
                                            'sum': 1.000000000000001}]})]
```
2023-03-20 00:06:23 -04:00
Allen Porter
9721ba59b6
Rewrite the calendar trigger to fix potential bugs (#89918)
Update the calander event trigger logic to have more exhaustive coverage. The
trigger will now use a timespan to create an explicit window for considering
upcoming events. The start/end of the time span is now more explicit, rather
than getting it from the alarm time.

The trigger is now broken into composable pieces:
- A timespan object for more explicitly managing the time window
- A function to get events during a time span
- A function to process upcoming events and determine the trigger times

The existing listener is now just responsible for scheduling alarms and glue.

This fixes bug with DST handling where the conversion back and forth between
UTC and timezone ends up dropping events during the jump forward. In practice,
an event was returned from the scanning, but it was never fired by the trigger
because (1) it was filtered out of the interval and (2) the event list was
previously cleared every iteration so it would get dropped.

Future improvements can bake more invariant checking into this structure.
2023-03-19 23:42:12 -04:00
Jan Bouwhuis
2039955ef7
Fix imap_email_content unknown status and replaying stale states (#89563) 2023-03-19 17:35:45 -10:00
J. Nick Koston
c94b054d75
Retain history when renaming an entity_id (#89963)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-03-19 17:33:21 -10:00
J. Nick Koston
aebe4c66a6
Fix cpu thrashing during purge after all legacy events were removed (#89923)
* Fix cpu thrashing during purge after all legacy events were removed

We now remove the the index of of event ids on the states table when its
all NULLs to save space. The purge path needs to avoid checking for legacy
rows to purge if the index has been removed since it will result in a full
table scan each purge cycle that will always find no legacy rows to purge

* one more place

* drop the key constraint as well

* fixes

* more sqlite
2023-03-19 22:04:24 -04:00
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
Matthias Alphart
557b9c7d51
Add KNX interface device with diagnostic entities (#89213) 2023-03-19 02:13:52 -11:00
epenet
0e7bd401f2
Fix lingering timer in config entry flow tests (#89853) 2023-03-19 08:56:24 +01:00
Vincent Knoop Pathuis
6ad9f420ab
Add Landis+Gyr poll on restart (#89644) 2023-03-18 08:50:50 -11:00
J. Nick Koston
b1f64de6ce
Remove the old ix_states_event_id index if its no longer being used (#89901)
* Remove the old ix_states_event_id index if its no longer being used

* cover it

* fixes

* fixup

* Update homeassistant/components/recorder/tasks.py
2023-03-17 20:27:33 -04:00
J. Nick Koston
138bbd9c28
Use json_loads_object util in backup (#89895)
* Use json_loads_object util in backup

* adjust test
2023-03-17 20:25:29 -04:00
epenet
ab6e929443
Fix EntityComponent lingering timer in helper tests (#89801)
* Fix lingering timer in entity platform tests

* Tweak

* Fix entity and entity_component also

* Remove async_shutdown

* Adjust

* Adjust
2023-03-17 10:26:05 +01:00
epenet
abd91dd934
Ensure MockEntityPlatform shuts down after tests (#89849) 2023-03-17 10:22:43 +01:00
epenet
ab4a726e6c
Add tmpdir to known fixtures in pylint (#89844) 2023-03-17 10:22:02 +01:00
J. Nick Koston
f6f3565796
Reduce latency to find stats metadata (#89824) 2023-03-16 19:00:02 -10:00
Allen Porter
04a99fdbfc
Add local calendar diagnostics platform (#89776)
* Add local calendar diagnostics platform

* Use redaction from ical

* Update diagnostics for new ical version

* Apply suggestions from code review

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Use snapshot tests for local calendar diagnostics

* Setup diagnostics directly in tests rather than via dependencies

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-03-16 23:05:01 -04:00
Erik Montnemery
ae127e7687
Change light white service call attribute to accept True (#89803) 2023-03-16 23:02:56 -04:00
epenet
79c9447770
Fix lingering timer in event helper tests (#89819)
Fix lingering timer in event tests
2023-03-16 23:01:23 -04:00
epenet
ff8b91aeea
Add freezer to known test fixtures in pylint (#89825)
Add freezer to known fixtures in pylint
2023-03-16 22:39:41 -04:00
Michael Hansen
e16f17f5a8
Voice assistant integration with pipelines (#89822)
* Initial commit

* Add websocket test tool

* Small tweak

* Tiny cleanup

* Make pipeline work with frontend branch

* Add some more info to start event

* Fixes

* First voice assistant tests

* Remove run_task

* Clean up for PR

* Add config_flow.py

* Remove CLI tool

* Simplify by removing stt/tts for now

* Clean up and fix tests

* More clean up and API changes

* Add quality_scale

* Remove data from run-finish

* Use StrEnum backport

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-03-16 20:42:26 -04:00
epenet
81c0382e4b
Fix lingering timer in bootstrap tests (#89790)
* Fix lingering timer in bootstrap test

* Adjust comment

* Use a constant
2023-03-16 17:20:27 -04:00
epenet
9893b1cf4a
Cleanup get_local_ip in global conftest (#89826) 2023-03-16 22:03:06 +01:00
Franck Nijhof
f9919bb7cf
Add pre-defined entity name translations (#89792) 2023-03-16 21:10:20 +01:00
epenet
69aa3a75c5
Fix lingering timer in event sun tests (#89808) 2023-03-16 18:32:34 +01:00
epenet
1a7e316b51
Fix lingering timer in condition tests (#89807) 2023-03-16 18:19:29 +01:00
Jan Bouwhuis
6e25abfdcc
Fix typo in docstr (#89804) 2023-03-16 16:54:26 +01:00
Erik Montnemery
9384ec18f8
Add filters to climate and light service descriptions (#86162)
* Add filters to climate and light service descriptions

* Allow specifying enums directly

* Update service descriptions

* Adjust test

* Cache entity features

* Lint

* Improve error handling, add list of known base components

* Don't allow specifying an entity feature as int
2023-03-16 15:59:51 +01:00
Jan Bouwhuis
c81a38effb
Mqtt prepare test base part1 (#89796)
* Refactor test_reloadable

* Refactor test_disabling_and_enabling_entry

* optimize test_unload_config_entry

* Cleanup help_test_unload_config_entry

* cleanup test_unload_entry

* Update test tls_version

* More tests to entry only

* Add validate and hassconfig patch

* Revert fixture changes patch_hass_config

* Follow up comments
2023-03-16 15:57:01 +01:00
Erik Montnemery
886c2635ad
Add support for constant selector (#89573)
* Add support for constant selector

* Adapt to frontend PR changes
2023-03-16 09:02:26 -04:00
epenet
c6568ffb62
Fix lingering timer in collection helper tests (#89793)
* Fix lingering timer in collection helper tests

* One more
2023-03-16 08:38:22 -04:00
Franck Nijhof
f32b7859b8
Restructure translations for entity components (#89702) 2023-03-16 12:16:08 +01:00
Erik Montnemery
f55aaf7664
Drop unused Google entity settings from cloud (#89786) 2023-03-16 11:15:38 +01:00
Vincent Knoop Pathuis
273d794f7a
Add device class for Landis+Gyr GJ energy sensor (#89522) 2023-03-16 11:12:05 +01:00
epenet
46a5aa71ec
Add type hints to helper tests (#89784) 2023-03-16 11:10:56 +01:00
epenet
69e85b3216
Fix SFR Box diagnostics (#89783) 2023-03-16 11:09:54 +01:00
epenet
fec6236dd9
Add type hints to root tests (#89785) 2023-03-16 11:08:47 +01:00
epenet
8a58457203
Fix lingering timer in config entries test (#89787) 2023-03-16 11:07:42 +01:00
epenet
913156b0e0
Avoid lingering timer on script shutdown (#89753) 2023-03-16 08:00:21 +01:00
J. Nick Koston
99d6b1fa57
Migrate States to use a table manager (#89769) 2023-03-15 16:19:43 -10:00
J. Nick Koston
4080d68489
Fix logbook tests failing because time was not url encoded correctly (#89770) 2023-03-15 15:29:41 -10:00
J. Nick Koston
e379aa23bd
Migrate StateAttributes to use a table manager (#89760)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-03-15 15:26:29 -10:00
J. Nick Koston
ccab45520b
Remove asyncio.coroutine workarounds (#88560) 2023-03-15 20:04:31 -04:00
J. Nick Koston
aec2d63302
Add keep_days to recorder.purge_entities (#89726) 2023-03-15 11:13:47 -10:00
epenet
3aa5629665
Improve type hints in condition helper tests (#89754) 2023-03-15 19:42:23 +01:00
Michael
d4edec2863
Move calculation of current value into lib in Fritz!SmartHome (#89150) 2023-03-15 18:59:03 +01:00
Marcel van der Veldt
fceb208381
Abort Hue config flow if bridge can not be reached (#88893)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-03-15 18:55:34 +01:00
starkillerOG
4eee626770
Reolink check firmware (#88903) 2023-03-15 18:54:28 +01:00
epenet
54ad8b8ee9
Avoid lingering timers in update coordinator tests (#89749) 2023-03-15 18:50:32 +01:00