Commit Graph

15718 Commits (34041c75648c6c913785c8dad47376485b646d71)

Author SHA1 Message Date
Erik Montnemery 506a916a13
Add reauth flow to dormakaba dkey (#90225) 2023-03-27 08:37:31 -10:00
Erik Montnemery f84651b14e
Improve tts test coverage (#90370) 2023-03-27 20:00:54 +02:00
Franck Nijhof b033232b06
Filter out ASCII tab or newline from input URLs (#90348) 2023-03-27 13:49:40 -04:00
javicalle f4fda55405
Fix `quirk_class_validator` in ZHA unit tests (#90140)
* 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>
2023-03-27 11:57:40 -04:00
Erik Montnemery a91aef9d52
Rewrite tts tests (#90355) 2023-03-27 14:01:17 +02:00
epenet c193402ba7
Remove incorrect ignore in pylint plugin (#90024)
* Remove incorrect ignore_missing_annotations

* Allow tuple[int, int] in hs_color

* Adjust notify targets

* Always check for return type inheritance

* Adjust tests

* Revert "Always check for return type inheritance"

This reverts commit 3528742adf98edc6481f2c954c032ace881e1d6e.

* Revert "Allow tuple[int, int] in hs_color"

This reverts commit d51c1731eff3d59b9e94e7a7e914933ceaf8e34f.

* Revert "Adjust notify targets"

This reverts commit 4cba77a7309dc89980e29d6d5b9107d9e55f7070.
2023-03-27 13:53:14 +02:00
Raman Gupta c11a3881af
Bump zwave-js-server-python to 0.47.0 (#90212) 2023-03-27 12:25:04 +02:00
Jan Bouwhuis 5b3c57ff1e
Add option flow for imap integration (#89914)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-03-27 11:47:22 +02:00
epenet 8c519e1abb
Use SnapshotAssertion in gree climate tests (#90339) 2023-03-27 10:01:39 +02:00
G Johansson 624860da0e
Remove deprecated platform yaml in Scrape (#90272)
* Deprecate platform yaml

* typing

* DiscoveryInfoType
2023-03-27 08:05:30 +02:00
Paulus Schoutsen c3717f8182
Clean up voice assistant integration (#90239)
* 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>
2023-03-26 21:41:17 -05:00
J. Nick Koston 7098debe09
Fix sql doing I/O in the event loop at startup (#90335)
* 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
2023-03-26 21:02:24 -04:00
epenet c06ec1f78f
Improve onewire test coverage (#90184) 2023-03-26 23:46:52 +02:00
Allen Porter fa35867765
Bump ical to 4.5.1 and set PRODID for home assistant in local calendar ics (#90291) 2023-03-26 23:00:45 +02:00
Aaron Godfrey 745df277a0
Fix Todoist end date for all day event (#89837) 2023-03-26 22:08:36 +02:00
Michael 45262c6114
Implement config flow for nextcloud (#89396)
* implement config flow

* add tests

* fix hassfest and requirements

* abort import on connection error

* add add_suggested_values_to_schema

* mock async_setup_entry

* revert code owner change

* fix try connect in config flow

* add device info

* allow multiple instances

* fix import in config flow

* remove custom scan interval from coordinator

* applay suggestions

* apply suggestions

* take over ownership from @meichthys

* cleanup import data before passing to user step

* apply suggestions to tests

* add untested files to .coveragerc
2023-03-26 21:14:17 +02:00
Alexey Baturin 89355e0879
Add WLED IP as a sensor (#90241)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-03-26 20:03:03 +02:00
epenet c075dac916
Fix pylint plugin for tuple[float, float] returns (#90047) 2023-03-26 19:54:21 +02:00
epenet a036e31495
Use SnapshotAssertion in gree switch tests (#90222) 2023-03-26 19:51:48 +02:00
Niels Perfors 1baadc1d09
Update Verisure package to 2.6.1 (#89318)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: RobinBolder <33325401+RobinBolder@users.noreply.github.com>
Co-authored-by: Tobias Lindaaker <tobias@thobe.org>
2023-03-26 19:32:25 +02:00
epenet 6e92dac61f
Adjust pylint plugin for return type inheritance (#90046) 2023-03-26 18:37:26 +02:00
rikroe bec7bbeb92
Use SnapshotAssertion in bmw_connected_drive tests (#90128) 2023-03-26 16:57:19 +02:00
epenet 69a46d4002
Adjust pylint plugin for components fixtures (#90217)
* Adjust pylint plugin for components fixtures

* Adjust components

* Use MagicMock

* Adjust

* Use None
2023-03-26 15:21:19 +02:00
epenet e0ec3488d3
Adjust IntFlag handling in syrupy (#90223) 2023-03-26 14:20:05 +02:00
G Johansson e8f3b9c09a
Remove Volvooncall integration yaml import (#90288)
Depr yaml import
2023-03-26 09:42:38 +02:00
G Johansson b3f3f234c6
Remove pushbullet platform yaml import (#90285)
Depr pushbullet yaml
2023-03-26 09:40:07 +02:00
G Johansson 92beb48a41
Add sensor platform to Sun (#81045)
* 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
2023-03-26 07:24:43 +08:00
G Johansson 7f6406127e
Remove platform yaml radiotherm (#90284) 2023-03-25 12:43:44 -10:00
G Johansson 89d00ac733
Fix default ipv6 resolver (#90269) 2023-03-25 12:31:01 -10:00
Franck Nijhof 5c839e2367
Add entity name translations to Elgato (#89629) 2023-03-25 23:06:03 +01:00
rikroe cc337c4ff6
Add Re-Auth to bmw_connected_drive (#90251)
* Add Re-Auth to bmw_connected_drive

* Always store refresh token to entry

* Fix tests

* Typo

---------

Co-authored-by: rikroe <rikroe@users.noreply.github.com>
2023-03-25 10:09:33 -07:00
Luca Angemi 6d8eaa0bee
Add location field to calendar create_event service supported by Google Calendar and Local Calendar (#90098)
* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update calendar.py

* Update calendar.py

* Update services.yaml

* Update services.yaml

* Update calendar.py

* Update calendar.py

* Update __init__.py

* Update services.yaml

* Update services.yaml

* Update test_calendar.py

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update __init__.py

* Update const.py

* Address changes to service.yaml

* Address changes to service.yaml

* Update test_calendar.py

* Update test_calendar.py

* Update test_calendar.py

* Update conftest.py

* Update conftest.py

* Update calendar.py

* Update __init__.py
2023-03-25 09:43:49 -07:00
J. Nick Koston 02ef7d445d
Allow passing an optional name to async_track_time_interval (#90244)
* 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
2023-03-25 10:11:14 -04:00
epenet 5f3868b141
Add missing type hints to tests (#90218)
* Add type hints to tests

* Revert gree as handled in #90222
2023-03-24 19:34:01 -07:00
J. Nick Koston 4c45c3c63b
Add a faster query for get_last_state_changes when the number of states is 1 (#90211)
* 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
2023-03-24 09:39:55 -04:00
Robert Svensson ee74e21541
Rework UniFi wireless client "wired bug" logic (#89757) 2023-03-24 10:06:09 +01:00
Jan Bouwhuis 7364e6ecb3
Remove incorrect parametrize decorator (#90219) 2023-03-24 09:38:43 +01:00
Jan Bouwhuis 1224b1aff6
Use helper on tests MQTT fan platform (#90196)
Use helper on tests fan
2023-03-24 08:42:23 +01:00
Jan Bouwhuis f2b4c95a04
Prepare MQTT platform tests part7 (#90130)
* Tests select

* Tests sensor

* Deduplicate test code
2023-03-24 08:42:00 +01:00
Jan Bouwhuis 0570405a3c
Prepare MQTT platform tests part6 (#90129)
* Tests lock

* Tests mixins

* Tests number

* Tests scene
2023-03-24 08:41:36 +01:00
Jan Bouwhuis a404d5f6d7
Prepare MQTT platform tests part5 (#90108)
* Tests light_json

* Tests light_template

* Tests light
2023-03-24 08:41:04 +01:00
J. Nick Koston d49fbc17df
Fix recorder attribute excludes not being effective until after startup (#90198)
* Fix attribute excludes not being effective until after startup

fixes #90016

* reduce
2023-03-23 20:52:37 -04:00
J. Nick Koston dd0f05b980
Avoid calling the http access logging when logging is disabled (#90152) 2023-03-23 09:55:02 -10:00
epenet 38a4f08e15
Fix missing mock in islamic_prayer_times (#90178)
* Fix missing mock in islamic_prayer_times

* Restore 100% coverage

* Update test_config_flow.py
2023-03-23 20:10:51 +01:00
Michael Hansen 3e3ece4e56
Add speech to text over binary websocket to pipeline (#90082)
* 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>
2023-03-23 14:44:19 -04:00
Jan Bouwhuis 185d6d74d7
Prepare MQTT platform tests part9 (#90133)
* Tests switch

* Tests text

* Tests update
2023-03-23 19:17:27 +01:00
Jan Bouwhuis db63c8584e
Prepare MQTT platform tests part8 (#90132)
* Tests state_vacuum

* Tests siren
2023-03-23 19:16:54 +01:00
Jan Bouwhuis 2c1b59be0e
Prepare MQTT platform tests part4 (#90107)
* Tests humidifier

* Tests legacy_vacuum
2023-03-23 19:14:44 +01:00
Jan Bouwhuis 44add1dc11
Prepare MQTT platform tests part3 (#90106)
* Tests cover

* Tests fan
2023-03-23 19:14:08 +01:00
Jan Bouwhuis 8fd88d6703
Prepare MQTT platform tests part2 (#90105)
* Tests button

* Tests camera

* Tests climate
2023-03-23 19:13:36 +01:00
Nalin Mahajan e290febb38
Bump pyControl4 to 1.1.0 (#90115)
* Bump pyControl4 to 1.1.0

* Remove mock token_expiration from control4
2023-03-23 17:34:38 +01:00
Vincent Knoop Pathuis cb578c71e0
Add Landis+Gyr missing device class (#90182)
Add missing device class for heat_previous_year_gj
2023-03-23 17:21:21 +01:00
PeteRager 73ed6e039a
Improve logging for unavailable sonos hosts (#90172)
* 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>
2023-03-23 16:15:55 +01:00
Vincent Knoop Pathuis 568a731e2d
Use snapshot test for Landis+Gyr (#90126)
Initial commit for snapshot test
2023-03-23 10:30:31 +01:00
Erik Montnemery 50ea0c5cf2
Tweak multiprotocol tests (#90163) 2023-03-23 10:12:42 +01:00
rikroe 1a2fa51ac9
Bump bimmer_connected to 0.13.0 (#90127) 2023-03-23 10:01:01 +01:00
Erik Montnemery 6739542a5d
Simplify some multi pan code (#90135)
* Simplify some multi pan code

* Adjust ZHA config flow
2023-03-23 09:18:35 +01:00
solazs b151923619
Add health mode to gree integration (#89764)
Add health mode to gree integration.
2023-03-23 08:56:47 +01:00
Paulus Schoutsen 12352b2ce1
Always enforce URL param ordering for signed URLs (#90148)
Always enforce URL param ordering
2023-03-22 22:54:09 -04:00
J. Nick Koston ca576d45ac
Cache decode of JWT tokens (#90013) 2023-03-22 16:03:41 -10:00
J. Nick Koston 8a591fa16e
Add auto repairs for events schema (#90136)
* 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
2023-03-22 21:17:36 -04:00
J. Nick Koston 31c988c4f0
Fix index not being dropped on postgresql databases with a schema prefix (#90144)
* 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
2023-03-22 21:03:26 -04:00
J. Nick Koston 99b58f157e
Bump PyJWT to 2.6.0 (#90134)
* 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
2023-03-22 20:00:47 -04:00
J. Nick Koston 4ebce9746d
Add schema auto repairs for states tables (#90083) 2023-03-22 10:05:23 -10:00
Erik Montnemery 5948347b6b
Fix switch_as_x entity naming (#89992)
* Fix switch_as_x entity naming

* Simplify name logic
2023-03-22 20:24:05 +01:00
Erik Montnemery 1ea3312ed4
Deduplicate multiprotocol addon helper (#90102)
* Deduplicate multiprotocol addon helper

* Clarify
2023-03-22 20:20:42 +01:00
Erik Montnemery 3931e11fd9
Try to load integration before starting option flow (#90111)
* Try to load integration before starting option flow

* Adjust tests
2023-03-22 20:10:10 +01:00
Franck Nijhof 6db8867b81
Update wled to 0.16.0 (#90120) 2023-03-22 13:55:50 -04:00
puddly c581116c82
ZHA network settings API (#88564)
* 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%
2023-03-22 11:15:46 -04:00
Erik Montnemery 130c8ea5f5
Update OTRB config entry if REST API port has changed (#90101)
* Update OTRB config entry if REST API port has changed

* Improve test coverage
2023-03-22 14:03:39 +01:00
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
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
epenet c416d18506
Add WAN information to SFR Box (#89678) 2023-03-15 18:49:57 +01:00
epenet 35c02ddc81
Add type hints to update coordinator tests (#89748) 2023-03-15 18:07:43 +01:00
Allen Porter b588b8b215
Bump ical to 4.5.0 (#89744) 2023-03-15 18:06:46 +01:00
J. Nick Koston a244749712
Make StatesMetaManager thread-safe when an entity_id is fully deleted from the database and than re-added (#89732)
* refactor to make StatesMetaManager threadsafe

* refactor to make StatesMetaManager threadsafe

* refactor to make StatesMetaManager threadsafe

* refactor to make StatesMetaManager threadsafe

* reduce

* comments
2023-03-15 08:54:02 -04:00