* Construct binary sensor state from zigpy cache (WIP)
* Workaround zha-quirks issue where "MotionWithReset" quirks don't update attribute cache (WIP)
zha-quirks currently has an issue where the ZONE_STATE attribute is updated (when the zone_STATUS changes).
https://github.com/zigpy/zha-device-handlers/pull/2231 is a proper fix for this.
For now, we just update the attribute cache when we get the "zone status update notification" command.
This wasn't noticed before, as the "attribute report signal" was sent from the `cluster_command()` method and the used the provided attribute (in the signal) to update the `_state` value in the binary sensor class.
As we just tell HA to write state again when we get an attribute report now, the ZONE_STATUS attribute is read now (and needs to be correct).
* Use parse() method of main class for IasZone entity (with stripped bits)
* Change wording in comment, remove explicitly sending attr signal
(This comment should be removed/changed later anyway)
* Remove note
* Get zone_status attribute id with zigpy
* Remove `security.` prefix for `IasZone` import
`AceCluster` was already directly imported and `IasZone` is too now for getting the attribute id
* Store full zone status attribute in cache
* Check that non-alarm bits are ignored in IasZone sensor test
* Re-enable occupancy binary sensor test
This test seems to work fine and I don't see any reason why it was commented out for a while
* Fix cached read mix-up for `zone_status`/`zone_state`
This allows cached reads for `zone_state` (enrolled or not), but forces a new read for `zone_status` (alarm or not).
* Use last valid state if meter is not periodically resetting
* Fix unload of entry, used during options flow submit
* Adjustments based on code review
* Move DecimalException handling to validation method
* Add test for invalid new state in calculate_adjustment method
* Add basic tests
* Updated requriements_test_all.txt
* Update temperusb version
* Add type hints
Co-authored-by: Christian Knittl-Frank <lcnittl@gmail.com>
* Add type hints
Co-authored-by: Christian Knittl-Frank <lcnittl@gmail.com>
* Correct typo in type hint
* Fix isort
* Fix requirements_test_all.txt
---------
Co-authored-by: Dave T <davet2001@users.noreply.github.com>
Co-authored-by: Christian Knittl-Frank <lcnittl@gmail.com>
* Add tests to Lidarr
* fix js files
* take out the trash
* fix 3.9
* uno mas
* fix fixture
* ruff
* Update const.py
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Add a missing test for aborting with "already_configured"
Test that config_flow aborts with "already_configured" when the
integration has already been configured
* Don't copy test data
Since #90232 is merged, it is no longer needed
* Split the initialisation into two steps, as it should be
* Create new config parameter for default character encoding if no character encoding is declared
* Changes suggested by gjohansson-ST
* Added config flow for scape
* Removed "character"
* Change to create_async_httpx_client
* Remove CONF_ENCODING from Scrape SENSOR_SCHEMA
* Debug scrape test
* Remove async_setup from mqtt integration
* Final update common tests
* Related tests init
* Related tests diagnostics
* Related tests config_flow
* Cleanup and correct test
* Keep websockets_api commands in async_setup
* Look up collaborators only when adding new task.
Also fixed a few api call arguments that were incorrect. The `labels`
key should have been a list of strings and the `assignee` key should
have been `assignee_id`.
* Add missing type in test.
* Remove print
* SharkIQ Dep & Codeowner Update
* Update code owners
* Add EU Region Support
* Update Config Flow Tests
* Standardize Region Comparison Strings
* Add Translation Support to Region Selector
* Fix Validation Tests
* Reduce data sharing between ConfigFlow and DataUpdateCoordinator
Instead of fetching device information from the device once in
`ConfigFlow` and then piping it through in `ConfigEntry.data`,
only use as much as needed in `ConfigFlow.async_step_user`, then fetch
again in `AirQCoordinator._async_update_data` if a key is missing.
Additionally, factor `AirQCoordinator` out into a sumbodule.
Add a simple test for `AirQCoordinator.device_info` update.
Positive side effect: `AirQCoordinator.device_info` is
updated explicitly, instead of dumping the entire content of (a fully
compatible) `TypedDict`, retrieved from `aioairq`.
* Remove tests ill-suited to this PR
`test_config_flow.test_duplicate_error` slipped through by mistake,
while `test_coordinator.test_fetch_device_info_on_first_update` may need
a more thoroughly suite of accompanying tests
* Ignore airq/coordinator.py
...newly separated from airq/__init__.py, that's already in this list
* Reorder files alphabetically
* 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.