Commit Graph

15548 Commits (0ecd043cb2f0e84d8234fce6a82529988630caa5)

Author SHA1 Message Date
Erik Montnemery 0ecd043cb2
Add test helper mock_config_flow (#90103) 2023-03-22 08:59:35 -04:00
Paulus Schoutsen 0ca6723378
Allow passing binary to the WS connection (#89882)
* Allow passing binary to the WS connection

* Expand test coverage

* Test non-existing handler

* Allow signaling end of stream using empty payloads

* Store handlers in a list

* Handle binary handlers raising exceptions
2023-03-22 08:36:36 -04:00
Erik Montnemery 19d56a7102
Change error handling in async_process_play_media_url (#90052) 2023-03-22 13:32:02 +01:00
Matrix 87e6dd3949
YoLink flexfob support (#90027) 2023-03-22 12:01:04 +01:00
Jan Bouwhuis 214286acb9
Prepare MQTT platorm tests part1 (#90051)
* Add help_custom_config

* Tests alarm_control_panel

* Tests binary_sensor

* Only use help_custom_config with iterable options
2023-03-22 10:23:08 +01:00
J. Nick Koston 96225bb287
Rename recorder run_history to table_managers.recorder_runs_manager (#90070) 2023-03-21 18:38:33 -10:00
J. Nick Koston 88ad97f112
Fix generating statistics for time periods smaller than we can measure (#90069)
If the time period for the mean/time weighted average was smaller
than we can measure (less than one microsecond), generating
statistics would fail with a divide by zero error. This is likely
only happens if the database schema precision is incorrect.
2023-03-21 21:12:45 -04:00
Michael Hansen 0e7ffff869
Add TTS to pipelines (#90004)
* Add text to speech and stages to pipeline

* Default to "cloud" TTS when engine is None

* Refactor pipeline request to split text/audio

* Refactor with PipelineRun

* Generate pipeline from language

* Clean up

* Restore TTS code

* Add audio pipeline test

* Clean TTS cache in test

* Clean up tests and pipeline base class

* Stop pylint and pytest magics from fighting

* Include mock_get_cache_files
2023-03-21 21:10:31 -04:00
J. Nick Koston ddcaa9d372
Break out statistics repairs into a `auto_repairs` modules (#90068)
* Break out statistics schema repairs into a repairs module

A future PR will add repairs for events, states, etc

* reorg

* reorg

* reorg

* reorg

* fixes

* fix patch targets

* name space rename
2023-03-21 21:08:06 -04:00
Franck Nijhof f98d685154
Refactor WLED select tests (#89219) 2023-03-21 22:32:41 +01:00
Michael d4cc4a343d
Use has_template property from lib in Fritz!SmartHome (#89152) 2023-03-21 21:33:33 +01:00
Jan Bouwhuis 6f88fe93ef
Only publish mqtt_statestream when MQTT is started (#89833)
* Only publish mqtt_statestream when ha is started

* also catch startup states and use event filter

* Add check for MQTT to be available first

* Make sure MQTT is available and started

* Fix test

* Improve test

* Reset mock before assertung not called
2023-03-21 10:21:45 -04:00
Erik Montnemery 41ea8fa9b4
Guess media type when cast is playing media without media type (#90048) 2023-03-21 10:01:35 -04:00
Jan Bouwhuis d865440012
Prepare MQTT common tests part3 (#90022) 2023-03-21 09:19:20 +01:00
Jan Bouwhuis fe49861e26
Prepare MQTT common tests part4 (#90023)
* Upd test_setting_attribute_via_mqtt_json_message

* Update test_setting_attribute_with_template

* Update test_update_with_json_attrs_not_dict

* Update test_update_with_json_attrs_bad_json
2023-03-21 09:07:46 +01:00
epenet dd1700954b
Deprecate YAML in SamsungTV (#89743)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-03-21 09:00:17 +01:00
Tom Harris 0c0c86bf7b
Add support for new Insteon i3 devcies (#89892) 2023-03-20 21:56:44 -10:00
Jan Bouwhuis 91dbda1ce7
Add mqtt common tests for availability (part2) (#89805)
* update test_availability_when_connection_lost

* Adjust test_availability_without_topic

* Update test_default_availability_payload + helper

* Update test_default_availability_list_payload

* Use helper for async_setup_component

* Update test_default_availability_list_*

* Update test_custom_availability_payload
2023-03-21 08:20:37 +01:00
Arturo 5e5ace9c4e
Add door lock device type to matter integration (#89277)
* Adds base code for matter lock

* Adds basic matter door lock support

* Adds matter lock fixture

* Adds tests for matter lock

* Addresses feedback

* Added logic to handle inter states of matter lock

* Addesses feedback
2023-03-21 01:29:33 +01:00
Raman Gupta cbe85126cb
Introduce a delay between update entity calls (#89737)
* Introduce a delay between update entity calls

* Update homeassistant/components/zwave_js/update.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* move delay to constant and patch

* rename constant

* Switch to async_call_later

* Remove failing test

* Reimplement to solve task problem

* comment

* pass count directly so that value doesn't mutate before we store it

* lines

* Fix logic and tests

* Comments

* Readd missed coverage

* Add test for delays

* cleanup

* Fix async_added_to_hass logic

* flip conditional

* Store firmware info in extra data so we can restore it along with latest version

* Comment

* comment

* Add test for is_running check and fix bugs

* comment

* Add tests for various restore state scenarios

* move comment so it's less confusing

* improve typing

* consolidate into constant and remove unused one

* Update update.py

* update test to unknown state during partial restore

* fix elif check

* Fix type

* clean up test docstrings and function names

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-03-20 18:30:56 -04:00
epenet 18df3a22ca
Add FTTH information to SFR Box (#89781) 2023-03-20 20:06:44 +01:00
Jan Bouwhuis 51b12cbf96
Add user_input as suggested value in imap config flow (#89982)
Add user_input as suggested value to config_schema
2023-03-20 15:52:54 +01:00
Jan Bouwhuis e4275a053c
Remove yaml import from imap integration (#89981)
* Remove yaml import from imap integration

* Cleanup sensor code and strings.json
2023-03-20 15:52:07 +01:00
Malte Franken 0bf652ca96
Refactor constants in geo_json_events integration (#89912)
move constants to separate file
2023-03-20 13:26:38 +01:00
J. Nick Koston 146a31163c
Use bluetooth address instead of uuid on MacOS (#89926) 2023-03-20 12:07:41 +01:00
J. Nick Koston c3043fb0ee
Bump bluetooth deps for bleak 0.20 (#89925)
Co-authored-by: K <z@kwi.li>
2023-03-20 12:06:15 +01:00
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