Commit Graph

45803 Commits (906d3977363be1c46933e0ddb6dbb290effe229f)

Author SHA1 Message Date
jan iversen b11539fb04
Move connect method into a task (#88452)
Move connect() into a task.
2023-02-20 08:32:47 +01:00
epenet 488d78571e
Add missing device class triggers (#88316)
* Add constant tests for sensor device classes

* Add missing strings

* Adjust tests

* Add missing conditions

* Add missing trigger

* Cleanup
2023-02-20 08:30:51 +01:00
Paulus Schoutsen 69e42d0e4d
Fix Vulcan break CI (#88469)
* Fix Vulcan break CI

* Remove unrelated change

* Flake8 ignore
2023-02-19 23:49:42 -05:00
Paulus Schoutsen 79c6dcb3ca
Disable vulcan (#88466)
Disable Vulcan integration
2023-02-19 22:06:01 -05:00
Marc Mueller f3c6558db4
Improve conversation typing (#88440) 2023-02-19 21:27:30 -05:00
J. Nick Koston c2b770bcb9
Load pending state attributes and event data ids at startup (#88444)
* Load pending state attributes and event data ids at startup

Since we queue all events to be processed after startup
we can have a thundering herd of queries to prime the
LRUs of event data and state attributes ids. Since we
know we are about to process a chunk of events we can
fetch all the ids in two queries

* lru

* fix hang

* Fix recorder LRU being destroyed if event session is reopened

We would clear the LRU in _close_event_session but
it would never get replaced with an LRU again so
it would leak memory if the event session is reopened

* Fix recorder LRU being destroyed if event session is reopened

We would clear the LRU in _close_event_session but
it would never get replaced with an LRU again so
it would leak memory if the event session is reopened

* cleanup
2023-02-19 21:26:38 -05:00
J. Nick Koston 3533e77ec9
Fix using MariaDB slow range select workaround with Postgresql (#88459)
* Mark PostgreSQL range select as fast

Currently we were using the slow range select workaround for
PostgreSQL that was original developed for MariaDB but
its actually slower on PostgreSQ

fixes #83253

* Mark PostgreSQL range select as fast

Currently we were using the slow range select workaround for
PostgreSQL that was original developed for MariaDB but
its actually slower on PostgreSQ

fixes #83253
2023-02-19 21:08:43 -05:00
J. Nick Koston 0b311c8c7f
Fix statistics_at_time query not using index (#88460)
* Fix statistics_at_time query not using index

fixes #82411

* fix refactoring error

* fix query so sqlalc does not get confused

* split it

* write as subquery

* reduce

* cleanup

* reduce

* Revert "reduce"

This reverts commit 43b4b55778.
2023-02-19 21:07:31 -05:00
J. Nick Koston eac9ad8437
Fix most recent states query not using the index for group by (#88461)
* Fix most recent states query not using the index for group by

fixes #87851

* Apply suggestions from code review

* reduce
2023-02-19 21:05:45 -05:00
J. Nick Koston 9a6bcc2b63
Fix incorrect created and created_ts columns in statistics database schema (#88462)
* Remove default from created statistics schema

We were still inserting created times because even though
None was passed when creating the object explictly, the
default would still be used

* adjust column

* preserve original pre sql alc 2.0 behavior
2023-02-19 21:00:49 -05:00
Franck Nijhof 68e1aaa0be
Refactor Elgato tests (#88376) 2023-02-19 20:14:18 +01:00
J. Nick Koston a9731a7b26
Make the recorder LRU adjustment threadsafe (#88443) 2023-02-19 19:30:08 +01:00
J. Nick Koston 08cdb0e3ee
Fix recorder LRU being destroyed if event session is reopened (#88448) 2023-02-19 19:20:01 +01:00
starkillerOG 1cdd914411
Bump motionblinds to 0.6.17 (#88450) 2023-02-19 19:15:28 +01:00
J. Nick Koston 9df00bd285
Adjust recorder LRU cache to align with the number of entities (#88350)
* Adjust size of recorder LRU based on number of entities

If there are a large number of entities the cache would
get thrashed as there were more state attributes being
recorded than the size of the cache. This meant we had
to go back to the database to do lookups frequently when
an instance has more than 2048 entities that change
frequently

* add a test

* do not actually record 4096 states

* patch target

* patch target
2023-02-19 00:02:36 -05:00
spycle e799f24853
Update keymitt dependency (#88430) 2023-02-18 22:43:28 -06:00
Chris Talkington 04fabf4838
Update rokuecp to 0.17.1 (#88425) 2023-02-18 22:40:02 -06:00
Teemu R 1d928f05fa
Update python-kasa to 0.5.1 (#88416) 2023-02-18 22:39:08 -06:00
J. Nick Koston d4376b2041
Use a single session to compile statistics (#88405)
We had two session_scope contexts in compile_statistics which causes
a commit to happen twice during the compile.
2023-02-18 20:23:47 -05:00
J. Nick Koston 3ca9f3c0d5
Only build the recorder SupportedDialect enum once (#88402)
Every call to dialect_name was creating a new enum object
in the recorder
2023-02-18 20:21:14 -05:00
jjlawren 496ab49d80
Bump `SoCo` to 0.29.1 (#88410)
Bump soco to 0.29.1
2023-02-18 15:02:03 -05:00
Erik Montnemery 1eb20affa1
Update use of sqlalchemy with_variant (#88395) 2023-02-18 09:18:01 -06:00
Tom Harris d84fde8c54
Insteon scenes (#87803)
* Add Insteon scene support

* Bump to pyinsteon 1.3.1

* Add tests

* Bump Insteon Panel to 0.3.1

* Change docstring
2023-02-18 15:52:49 +01:00
Franck Nijhof 1caacab8dd
Enable Ruff B014 (#88377) 2023-02-18 07:38:04 -06:00
Erik Montnemery 83e5bf7ae8
Use entity_sources to determine integration in recorder platforms (#88382) 2023-02-18 07:21:41 -06:00
mletenay 728f0d5b3b
Fix goodwe text(enum) sensors device class (#87914) 2023-02-18 13:39:38 +01:00
Guido Schmitz 1279868bf5
Bump devolo_plc_api to 1.2.0 (#88348) 2023-02-18 13:34:26 +01:00
Erik Montnemery f0b7343993
Change state class of weight sensors from total to measurement (#88314) 2023-02-18 13:26:53 +01:00
stickpin 4f17f2ef5f
Upgrade caldav to 1.1.1 (#88378) 2023-02-18 13:16:46 +01:00
Jon Caruana e5e551f4ea
Code quality/test improvement to available attributes of LiteJet (#86683)
* PR feedback, and add related tests.

* PR feedback.

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-02-18 12:43:32 +01:00
jjlawren beaa36c36e
Guard against duplicate Sonos discoveries (#88305) 2023-02-18 10:41:25 +01:00
J. Nick Koston 714328d2ca
Handle key change in Yale Access Bluetooth after first connect (#88282) 2023-02-18 10:40:51 +01:00
Mike Heath 4265def234
Allow user FKB config flow to take precendence (#88281) 2023-02-18 10:40:21 +01:00
J. Nick Koston 0a7cf2b88c
Speed up formatting history data (#88230) 2023-02-18 10:34:44 +01:00
Joakim Plate f7609e4f92
Make use of new background task in arcam_fmj (#88351) 2023-02-18 10:28:42 +01:00
J. Nick Koston 289bab6f87
Make recorder platform attribute exclude integration aware (#88357) 2023-02-18 10:08:59 +01:00
J. Nick Koston 5c09d81f86
Ensure doorbird always prefers internal url (#88369)
* Ensure doorbird always uses internal url

The doorbird should always use the internal url to
ensure the webhooks work. The doorbird does not
verify ssl so there is no concern about ssl matching
according to the LAN-2-LAN API v0.32 Dec 21 2022

* adjust

* Update homeassistant/components/doorbird/__init__.py
2023-02-18 09:33:40 +01:00
Paulus Schoutsen db3cd8e276
Fix danglin task for util.timeout (#88366)
Fix danglin task for util timeout
2023-02-18 00:11:35 -05:00
Franck Nijhof 1e05697080
Enable Ruff B007 (#88356)
* Enable Ruff B007

* Adjust existing cases
2023-02-17 21:08:18 -05:00
modrisb 9fd35d53e7
Change core return code processing (#88326)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-17 20:56:02 -05:00
Franck Nijhof 2ea5811e3a
Hold strong references to tasks in WLED (#88257) 2023-02-17 23:21:28 +01:00
Michael Hansen 325674ec44
Only expose default cloud domains in Assist default agent (#88274)
* Only expose default cloud domains in default agent

* Copy exposed domain list to conversation

* Implement requested changes

* Add test for exposed devices/areas
2023-02-17 16:19:22 -05:00
J. Nick Koston 331102e592
Dismiss discoveries when the underlying device disappears (#88340)
* Implement discovery removals

Bluetooth, HomeKit, SSDP, and Zeroconf now implement
dismissing discoveries when the underlying discovered
device disappears

* cover

* add zeroconf test

* cover

* cover bluetooth

* fix rediscover
2023-02-17 15:51:19 -05:00
Paulus Schoutsen 710b250c1d
Fix dangling task for bluetooth_le_tracker (#88284) 2023-02-17 20:57:45 +01:00
Paulus Schoutsen 91ecdc83b2
Fix dangling task for livisi (#88294) 2023-02-17 20:57:00 +01:00
Paulus Schoutsen d866b0ddcb
Fix dangling task for squeezebox (#88299) 2023-02-17 20:56:27 +01:00
Paulus Schoutsen 99c904ea5d
Fix dangling task for plum_lightpad (#88295) 2023-02-17 20:55:13 +01:00
Paulus Schoutsen 0a363fa004
Fix dangling task for sense (#88296) 2023-02-17 20:54:34 +01:00
Paulus Schoutsen 4b3b2fb693
Fix dangling task for smart_meter_texas (#88297) 2023-02-17 20:53:49 +01:00
Paulus Schoutsen 28a09199ac
Fix dangling task for insteon (#88293) 2023-02-17 20:53:06 +01:00
Paulus Schoutsen 517e88600c
Fix dangling task for mysensors (#88290)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-02-17 20:52:30 +01:00
Paulus Schoutsen 5a31bb2ff3
Fix dangling task for crownstone (#88292) 2023-02-17 20:51:22 +01:00
Franck Nijhof 26f0de0d80
Update pyfido to 2.1.2 (#88343) 2023-02-17 19:51:36 +01:00
Paulus Schoutsen 3a32d2bdcb
Add background tasks to config entries (#88335)
* Use a set for config entries task tracking

* Allow adding background tasks to config entries

* Add tests for config entry add tasks

* Update docstrings on core create task

* Migrate roon and august

* Use in more places

* Guard for None
2023-02-17 13:50:05 -05:00
Erik Montnemery 45829b016c
Remove conditional test of self.hass from tplink_omada switch (#88325) 2023-02-17 19:16:37 +01:00
J. Nick Koston 30384501af
Cleanup august binary sensors (#88332) 2023-02-17 19:15:56 +01:00
jjlawren b51836a57b
Detect when battery-powered Sonos devices are turned off (#87606) 2023-02-17 19:13:22 +01:00
Paulus Schoutsen f465561536
Fix dangling task for cast (#88285) 2023-02-17 18:43:40 +01:00
dcmeglio da046f93f4
Add additional characteristics for Airversa Homekit Air Purifiers (#85660) 2023-02-17 15:55:31 +00:00
Ernst Klamer aeb09678a8
Bump xiaomi-ble to 0.16.4 (#88333) 2023-02-17 15:45:18 +00:00
Paulus Schoutsen a223b30924
Fix dangling task for roon (#88291) 2023-02-17 16:42:45 +01:00
Paulus Schoutsen f3e4783a5e
Fix dangling task for wiz (#88301) 2023-02-17 08:29:46 -06:00
epenet dfdd279add
Fix incorrect condition for atmospheric_pressure (#88320) 2023-02-17 14:00:32 +01:00
J. Nick Koston 5ff87e6110
Bump ha-ffmpeg to 3.1.0 (#88304)
changelog: https://github.com/home-assistant-libs/ha-ffmpeg/compare/3.0.2...3.1.0
2023-02-17 09:19:12 +01:00
Paulus Schoutsen a356f35638
Fix dangling task for google (#88287) 2023-02-16 20:31:06 -08:00
Paulus Schoutsen 0904848579
Fix dangling task for homeassistant integration (#88288) 2023-02-16 22:23:44 -06:00
Paulus Schoutsen 509d968814
Fix dangling task for elkm1 (#88286)
* Fix dangling task for elkm1

* Update homeassistant/components/elkm1/__init__.py

Co-authored-by: J. Nick Koston <nick@koston.org>

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-16 23:22:34 -05:00
J. Nick Koston 3212a43e6b
Fix handling of dns resolution failure during sense setup (#88279)
```
2023-02-16 20:44:54.516 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry alexander for sense
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1152, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1152, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 861, in _resolve_host
    await event.wait()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/locks.py", line 34, in wait
    raise self._exc
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 874, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 860, in getaddrinfo
    return await self.run_in_executor(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 381, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/sense/__init__.py", line 83, in async_setup_entry
    await gateway.get_monitor_data()
  File "/usr/local/lib/python3.10/site-packages/sense_energy/asyncsenseable.py", line 214, in get_monitor_data
    json = await self._api_call("app/monitors/%s/overview" % self.sense_monitor_id)
  File "/usr/local/lib/python3.10/site-packages/sense_energy/asyncsenseable.py", line 174, in _api_call
    async with self._client_session.get(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.sense.com:443 ssl:default [Try again]  ```
2023-02-16 23:18:16 -05:00
J. Nick Koston b9f29c27ab
Cleanup stale recorder code (#88275)
- Removes dead commit function
- Small cleanup to debug handling in execute
2023-02-16 23:12:11 -05:00
Paulus Schoutsen 3c68907351
Fix dangling task for homekit (#88289) 2023-02-16 23:07:54 -05:00
Paulus Schoutsen baee6b1f5e
Fix dangling task for sonos (#88298) 2023-02-16 23:07:35 -05:00
Paulus Schoutsen 093f7d6bf1
Fix dangling task for zha (#88302) 2023-02-16 23:07:15 -05:00
Paulus Schoutsen a5170340a3
Fix dangling task for unifiprotect (#88300) 2023-02-16 22:05:06 -06:00
Jesse Hills a26d41f260
Implement Switchbot Blind Tilt (#86591)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: BelowAverageDeveloper <90269575+BelowAverageDev@users.noreply.github.com>
2023-02-16 21:06:02 -06:00
Paulus Schoutsen 6cab27f378
Add support for background tasks in HA (#88265)
* Add support for background tasks

* make name mandatory for background tasks

* Update docstring

* async_create_background_task

* Grammar
2023-02-16 20:39:29 -05:00
J. Nick Koston 2ce631733a
Switch ld2410_ble to use no_devices_found (#88270) 2023-02-16 22:52:57 +01:00
J. Nick Koston a059cd7f80
Switch keymitt_ble to use no_devices_found (#88271)
* Switch keymitt_ble to use no_devices_found

* Switch keymitt_ble to use no_devices_found
2023-02-16 22:52:29 +01:00
J. Nick Koston 06b1bf9c92
Switch led_ble to use no_devices_found (#88269) 2023-02-16 22:51:57 +01:00
J. Nick Koston ffa7cac38e
Switch switchbot to use no_devices_found (#88268) 2023-02-16 22:51:27 +01:00
J. Nick Koston b2a1df19a0
Switch yalexs_ble to use no_devices_found (#88267) 2023-02-16 22:50:49 +01:00
Michael Hansen dc30210237
Use blocking in intent service calls and verify results (#88035)
* Use blocking in service calls and verify result

* Block for 2 seconds and update states after

* Small timeout in service call to allow exceptions

* Move sun test
2023-02-16 14:01:41 -05:00
J. Nick Koston 5fe8829cf6
Speed up compiling hourly statistics (#88225) 2023-02-16 12:55:25 -06:00
mkmer d46bbcf5a3
Bump aiosomecomfort to 0.0.8 (#88195)
* Update is_aux_heat in runtime

* Fix merge mistake

* Merge fixes 2.0

* Bump aiosomecomfort to 0.0.8
2023-02-16 13:54:26 -05:00
epenet 8c821c8969
Add JSON support to load_fixture (#88076)
* Add JSON support to load_fixture

* More tests

* Remove lru_cache on load_json
2023-02-16 19:40:47 +01:00
Paulus Schoutsen bc2b35765e
Stop processing when we hit bad encryption in mobile app (#88150)
* Stop processing when we hit bad encryption

* Accept webhook payload that is a list

* Rename functions because we import them

* Revert a debug thing

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-16 13:05:16 -05:00
Jan Bouwhuis 57738fbb8c
Replace deprecated SSLContext constant PROTOCOL_TLS in mqtt (#88214)
Replace deprecated SSLContext constants
2023-02-16 13:01:28 -05:00
J. Nick Koston c79157208b
Add python 3.11 to the CI (#88038)
* Remove profiler.memory service

guppy3 is not python3.11 compat
https://github.com/zhuyifei1999/guppy3/issues/41

This service will return if and when guppy3 becomes
python3.11 compat

* squash

* temp remove

* temp dump tests

* temp dump tests

* drop a few more to get a run

* drop a few more to get a run

* Account for changed python3.11 enum.IntFlag behavior in zha

There may be additional changes needed, but I could only
see what needed to be updated based on the tests

* merge

* restore

* restore

* legacy value

* tweak a bit for the python 3.11 timings

* block cchardet

* conditional

* adjust est

* test

* not yet

* tweak

* give a little leeway for timing

* Fix otbr tests

* Increase database test timeout

It looks like we need a little more time to run
with the addiitonal tests in #87019

* Increase database test timeout

It looks like we need a little more time to run
with the addiitonal tests in #87019

* Fix aprs tests with python 3.11

* merge fix

* hints

* Update homeassistant/package_constraints.txt

* Update script/gen_requirements_all.py

* Constrain uamqp for Python 3.10 only

* Bump vulcan-api to 2.3.0

see https://github.com/kapi2289/vulcan-api/pull/126
see https://github.com/home-assistant/core/pull/88038
see https://github.com/home-assistant/docker/pull/260

* add ban

* Bump python-matter-server to 2.1.1

* revert

* Update tests/asyncio_legacy.py

---------

Co-authored-by: Erik <erik@montnemery.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
2023-02-16 12:38:32 -05:00
J. Nick Koston 6c542bd314
Speed up formatting statistics data (#88228)
* Speed up fetching statistics by using attrgetter

Uses the faster native code vs a lambda
4aeae28671/Modules/_operator.c (L1406)

* avoid dict lookups

* avoid dict lookups

* naming

* split

* Revert "split"

This reverts commit 0ead89603d.

* Revert "Revert "split""

This reverts commit 20014af168.

* tweak

* tweak

* tweak

* tweak

* Revert "tweak"

This reverts commit d5e4aac7c5.

* Revert "tweak"

This reverts commit 0cebae33f8.

* Revert "tweak"

This reverts commit 0184e47e24.

* comment

* comment

* comment

* reduce local vars

* less
2023-02-16 12:34:20 -05:00
Kevin Stillhammer 792538c124
Fix default value for departure time in google_travel_time (#88255)
Fix default value for departure time
2023-02-16 12:28:39 -05:00
J. Nick Koston d2277fa6db
Fix restore of MQTT subscriptions from reload (#88220) 2023-02-16 11:14:26 -06:00
Marcel van der Veldt d03655cb6f
Bump python-matter-server to 2.1.1 (#88258) 2023-02-16 18:53:03 +02:00
J. Nick Koston cd57cdf8c4
Bump vulcan-api to 2.3.0 for python 3.11 (#88254)
Bump vulcan-api to 2.3.0

see https://github.com/kapi2289/vulcan-api/pull/126
see https://github.com/home-assistant/core/pull/88038
see https://github.com/home-assistant/docker/pull/260
2023-02-16 18:48:43 +02:00
Erik Montnemery 601ac3d9a9
Drop unnecessary copy from entitydescription.name to _attr_name (#88251) 2023-02-16 13:54:32 +01:00
epenet ba23816a0c
Inverse json import logic (#88099)
* Fix helpers and util

* Adjust components

* Move back errors

* Add report

* mypy

* mypy

* Assert deprecation messages

* Move test_json_loads_object

* Adjust tests

* Fix rebase

* Adjust pylint plugin

* Fix plugin

* Adjust references

* Adjust backup tests
2023-02-16 11:37:57 +01:00
Franck Nijhof 580869a9a6
Update typing-extensions to 4.5.0 (#88236) 2023-02-16 11:21:54 +01:00
Brandon Rothweiler 0748e12341
Fix capitalization of OwnTone integration (#88219) 2023-02-16 10:16:32 +01:00
J. Nick Koston c83ea297b5
Refactor zeroconf task handling (#88204)
* Refactor zeroconf task handling

- Avoid the need to create tasks for most callbacks
- Fixes the untracked task that could get unexpectedly GCed

* be consistant

* be consistant

* fix zeroconf tests

* runtime

* Revert "runtime"

This reverts commit 19e6b61837.

* precalc

* refactor

* tweak

* update tests
2023-02-15 21:44:11 -05:00
J. Nick Koston c0e22be7a8
Fix allowing identical flows to be created before startup (#88213)
The check for identical flows only worked after
the start event. We now check against pending
flows as well

If startup took a while we could end up
with quite the thundering herd
2023-02-15 21:36:00 -05:00
rappenze 57cea6d637
Update pyfibaro to version 0.6.8 (#88203)
Update pyfibaro library to version 0.6.8
2023-02-15 23:28:44 +01:00
Kevin Stillhammer a190bcdc3f
Bump voluptuous-serialize to 2.6.0 (#88211) 2023-02-15 23:14:45 +01:00