* Fix `quirk_class_validator`
Fix the `quirk_class_validator` for quirks with more than 1 module level
* fix black
* Shorten `quirk_cls` in `clss`
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
* Update comment
---------
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
* Clean up voice assistant
* Reinstate auto-removed imports
* Resample STT audio from 44.1Khz to 16Khz
* Energy based VAD for prototyping
---------
Co-authored-by: Michael Hansen <mike@rhasspy.org>
* Fix sql doing I/O in the event loop
* Fix sql doing I/O in the event loop
* no test query on main db
* fix mocking because it was targeting the recorder
* Sun sensor
* remove extra attr
* Add tests
* Add back attributes
* position sensors disabled default
* entity id
* unique id
* test init to attributes
* Fix test init
* Fix test sensor
* test unique id
* uom
* remove rising
* Remove not needed uom property
* Fix reload issue
* degree
* Allow passing an optional name to async_track_time_interval
This is the same idea as passing a name to asyncio.create_task which
makes it easier to track down bugs
* more
* short
* still cannot find it
* add a few more
* test
* Add a faster query for get_last_state_changes when the number of states is 1
related issue #90113
* Add a faster query for get_last_state_changes when the number of states is 1
related issue #90113
* coverage
* Apply suggestions from code review
* Allow passing binary to the WS connection
* Expand test coverage
* Test non-existing handler
* 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
* Working on STT
* Preparing to test
* First successful test
* Send handler_id
* Allow signaling end of stream using empty payloads
* Store handlers in a list
* Handle binary handlers raising exceptions
* Add stt/tts dependencies to voice_assistant
* Include STT audio in pipeline test
* Working on tests
* Refactoring with stages
* Fix tests
* Add more tests
* Add method docs
* Change stt demo/cloud to AsyncIterable
* Add pipeline error events
* Move handler id to separate message before pipeline
* Add test for invalid stage order
* Change "finish" to "end"
* Use enum
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Repeated warning messages on unavailable manually specified hosts
Sonos logs warning messages every 1 minute 12 seconds for hosts that are not on-line. This fixes the issue and the warning will be logged the first time, and subsequent logs messages will be at DEBUG level
* Update homeassistant/components/sonos/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Log info message when reconnect succeeds
* Use pop to simplify code
* Add additional test, fix key error with pop
* Use pop with default return value
* Update tests/components/sonos/test_init.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update tests/components/sonos/test_init.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update tests/components/sonos/test_init.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update tests/components/sonos/test_init.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update tests/components/sonos/test_init.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update comment, remove unneeded line of code
---------
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Add auto repairs for events schema
* Add auto repairs for events schema
* Add auto repairs for events schema
* Add auto repairs for events schema
* Add auto repairs for events schema
* fix bug - wrong table
* Fix index not being dropped on postgresql databases with a schema prefix
Added logging in case index drops fail so we can tell
why in the future
* coverage
* Bump PyJWT to 2.6.0
* fix time being frozen too late which makes the access token creation time in the future
* revert zha change
* fix repairs test
* fix ical test
* Rename `zha.api` to `zha.websocket_api`
* Implement a ZHA network settings API
* Use the enum name as the radio type
* Don't filter out ignored config entries
* [WIP] Start unit tests
* Add unit tests
* Rename ZHA websocket API module in `.coveragerc`
* Rename `api` to `websocket_api`
* Increase test coverage to 100%
* 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
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.
* 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
* 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
* 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
* 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
* 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>
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
- 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}]})]
```
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.
* 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
* 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
* 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>
* 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>
* 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
* refactor to make StatesMetaManager threadsafe
* refactor to make StatesMetaManager threadsafe
* refactor to make StatesMetaManager threadsafe
* refactor to make StatesMetaManager threadsafe
* reduce
* comments