Commit Graph

62389 Commits (cc12698f260683f70ab20b893817a9e23128a344)

Author SHA1 Message Date
J. Nick Koston cc12698f26
Make diagnostics dataclasses sloted (#93600)
Now available since our minimum python version is 3.10

Saves a tiny bit of ram
2023-05-27 20:04:39 -04:00
J. Nick Koston 0a9c4f15c4
Add event helper to dispatch device registry updates by device_id (#93602)
* Add event helper to dispatch device registry updates by device_id

* Update homeassistant/helpers/event.py

* dry

* dry

* reduce

* reduce

* reorder

* reduce

* cleanup stack depth

* dry

* fix double lookup

* remove unused

* collapse
2023-05-27 20:04:09 -04:00
J. Nick Koston e1b7d68134
Speed up processing subscribe_events and subscribe_entites when user has read all permissions (#93611)
Speed up processing subscribe_events and subscribe_entites when user the read all permissions
2023-05-27 19:59:46 -04:00
J. Nick Koston 67d9fa8b22
Disable call_soon for device tracker device registry updates (#93638)
Run device tracker device registry updates immediately
without the call_soon delay. This listener does not
need a delay and it only adds overhead in this case.
2023-05-27 19:58:27 -04:00
J. Nick Koston b966ff7a3d
Await in sequence when we know we will be blocked by the entity platform semaphore (#93649)
* Defer creating tasks we know are going to wait on the entity platform semaphore

When looking at whats going on with aiomonitor-ng, I noticed
we end up creating a lot of tasks that block waiting for the
executor because of the entity platform parallel_updates semaphore.

When we know the tasks are going to block we now await them
in sequence to avoid feeding the loop a herd of tasks that
will block on the semaphore

* change during iteration fix

* change during iteration fix

* cleanup

* cleanup

* fix vizio test
2023-05-27 19:58:02 -04:00
J. Nick Koston a56b5994e5
Disable polling for samsungtv remote entities (#93650)
These entities do not have a defined state, there is no reason to poll
2023-05-27 19:55:48 -04:00
J. Nick Koston 460d04fc07
Disable polling on energy sensors (#93651)
These sensors do not implement async_update so no
polling is needed
2023-05-27 19:54:40 -04:00
J. Nick Koston 5feceee588
Improve performance when serializing small bits of JSON (#93653)
* Improve performance when serializing small bits of JSON

Making json_bytes a partial reduced the run time to
build the small JSON messages by ~18.75%

We serialize a lot of small messages over the websocket

* typing
2023-05-27 19:53:52 -04:00
J. Nick Koston c721cbd10c
Collapse valid state check when creating a state (#93655)
Inline valid state check when creating a state

This was added in #9696 and only used in one place so
it does not need to be another function
2023-05-27 19:53:08 -04:00
J. Nick Koston 560e744f1e
Reduce overhead to filter entities in the recorder (#93656)
* Reduce overhead to filter entities in the recorder

* fix type
2023-05-27 19:52:42 -04:00
J. Nick Koston 5a0b25479e
Use httpx instead of requests for mjpeg camera images that need digest to avoid jump to executor (#93244)
* Use httpx instead of requests for mjpeg camera images that need digest

Avoids jump to executor

* Use httpx instead of requests for mjpeg camera images that need digest

Avoids jump to executor

* stream as well

* fix

* fix
2023-05-27 19:46:46 -04:00
J. Nick Koston 3a1389c3b4
Switch some frequently called call_laters to call_at (#93659)
* Switch some frequently called call_laters to call_at

call_at is a bit faster than call_later since call_later
is a wrapper around call_at.

We call at lot of these at startup so it helps a bit when
we are resource constrained

* update test

* update test
2023-05-27 19:45:35 -04:00
Álvaro Fernández Rojas 94ad9643b5
Update aioairzone to v0.6.1 (#93629) 2023-05-27 18:25:49 -05:00
Joost Lekkerkerker e4c51d43f0
Add YouTube integration (#92988)
* Add YouTube stub

* Add YouTube stub

* Add YouTube stub

* Add YouTube stub

* Add Youtube stub

* Add Youtube stub

* Add tests

* Add tests

* Add tests

* Clean up

* Add test for options flow

* Fix feedback

* Fix feedback

* Remove obsolete request

* Catch exceptions

* Parallelize latest video calls

* Apply suggestions from code review

Co-authored-by: Robert Hillis <tkdrob4390@yahoo.com>

* Add youtube to google brands

* Fix feedback

* Fix feedback

* Fix test

* Fix test

* Add unit test for http error

* Update homeassistant/components/youtube/coordinator.py

Co-authored-by: Robert Hillis <tkdrob4390@yahoo.com>

* Fix black

* Fix feedback

* Fix feedback

* Fix tests

---------

Co-authored-by: Robert Hillis <tkdrob4390@yahoo.com>
2023-05-27 11:21:12 -07:00
Aaron Godfrey bb170a2bbf
Fix todoist end time for tasks with due date in the future (#91874)
Fix end time for tasks with due date in the future.

Co-authored-by: Allen Porter <allen@thebends.org>
2023-05-27 10:09:11 -07:00
Artem Draft c5e425d075
Bump androidtvremote2 to 0.0.9 (#93634) 2023-05-27 09:49:57 +02:00
Raj Laud 236ee8be04
Bump pysqueezebox to 0.6.2 (#93573) 2023-05-26 14:53:40 -05:00
Erik Montnemery d4462829f5
Add CONFIG_SCHEMA to analytics (#93598) 2023-05-26 16:29:32 +02:00
Paul Frank 0bf9bb15f6
Use entity attributes in mystrom (#93591)
* Migrated proprties to _attr_

* Update homeassistant/components/mystrom/light.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/mystrom/light.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/mystrom/light.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/mystrom/light.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/mystrom/light.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/mystrom/light.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/mystrom/switch.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/mystrom/switch.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* review comment

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-05-26 16:22:59 +02:00
Erik Montnemery 5671934b34
Fix sharkiq tests (#93597) 2023-05-26 15:35:06 +02:00
Erik Montnemery 5b654c8b79
Fix mill tests (#93596) 2023-05-26 15:20:46 +02:00
Bram Kragten b51f82719e
Update frontend to 20230526.0 (#93581) 2023-05-26 12:39:52 +02:00
G Johansson af9ee8bc4a
Remove obihai YAMl configuration (#93549) 2023-05-26 08:41:21 +02:00
G Johansson 1f467fcc6a
Remove EDL21 YAML configuration (#93551) 2023-05-26 08:38:44 +02:00
G Johansson 3633062024
Remove platform yaml Frontier Silicon (#93552) 2023-05-26 08:24:08 +02:00
Jan Bouwhuis d852ba8b09
Remove redundant stub_blueprint_populate fixture for MQTT integration (#93570)
Remove redundant stub_blueprint_populate fixture
2023-05-26 08:13:45 +02:00
Jan Bouwhuis ec98e22330
Add type hints for stub_blueprint_populate fixture (#93568)
Add typehints for stub_blueprint_populate fixture
2023-05-26 08:13:13 +02:00
Franck Nijhof 9e53bca452
Add entity name translations to Rituals Perfume Genie (#92549) 2023-05-26 08:09:29 +02:00
J. Nick Koston 88893121a1
Increase timeout for test_purge_many_old_events (#93579) 2023-05-25 22:38:44 -05:00
J. Nick Koston 48485fc2bf
Complete persistent notifications migration (#92828)
* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* fixes

* fixes

* fixes

* ws test

* update tests

* update tests

* fix more tests

* fix more tests

* more fixes

* fix

* fix person

* fix person

* keep whitelist

* use singleton
2023-05-25 23:09:13 -04:00
J. Nick Koston e2b69fc470
Significantly improve performance of conversation default_agent listening for new states (#93577)
Use the async_track_state_added_domain helper instead of tracking
all state changes and rejecting them as it is already optimized
for this job
2023-05-25 23:04:38 -04:00
J. Nick Koston f251c464e2
Fix history start time state returning None with some postgresql versions (#93555)
* Add additional coverage to history websocket api

related issue #93258

* Add additional coverage to history websocket api

related issue #93258

* Fix results when union query ends up at the end instead of front

* Apply suggestions from code review

* resort

* zero instead

* fix exception

* fix tests
2023-05-25 22:18:19 -04:00
J. Nick Koston 61e57872c3
Fix not retrying on connection reset during nexia config entry setup (#93576)
* Fix not retrying on connection reset during nexia config entry setup

fixes
```
2023-05-26 00:15:39.129 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Alexander for nexia
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 558, in _request
    resp = await req.send(conn)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 670, in send
    await writer.write_headers(status_line, self.headers)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 130, in write_headers
    self._write(buf)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 75, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

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 387, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/nexia/__init__.py", line 47, in async_setup_entry
    await nexia_home.login()
  File "/usr/local/lib/python3.11/site-packages/nexia/home.py", line 385, in login
    request = await self.post_url(self.API_MOBILE_ACCOUNTS_SIGN_IN_URL, payload)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nexia/home.py", line 157, in post_url
    response: aiohttp.ClientResponse = await self.session.post(
                                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 572, in _request
    raise ClientOSError(*exc.args) from exc
aiohttp.client_exceptions.ClientOSError: Cannot write to closing transport
```

* coverage
2023-05-25 21:52:44 -04:00
J. Nick Koston d9b43fc43f
Significantly speed up recorder event listener (#93532)
* Significantly speed up recorder event listener

This code is called every time an event happens since it
subscribes to all events. Its our most frequently called
listener out of the box.

It used to have a seperate filter function but it was
later combined after core had some previous refactoring.

It was never optimized after that happened.

This change reduces the run time by ~70%

* decruft
2023-05-25 21:44:12 -04:00
J. Nick Koston 10aa49be2b
Speed up async_active_zone by avoiding dict lookups (#93427)
Speed up async_active_zone by avoding dict lookups
2023-05-25 21:37:18 -04:00
Justin Vanderhooft accee4b5ef
Add support for configuring built-in Melnor Bluetooth scheduling system (#93333) 2023-05-25 20:06:22 -05:00
Maciej Bieniek e6a214595b
Avoid KeyError when specifying the consumption type in Shelly integration (#93561)
Avoid KeyError when specifying the consumption type
2023-05-25 23:12:25 +02:00
Maciej Bieniek eb058a3d41
Add illuminance sensor for Shelly gen2 devices (#93559) 2023-05-25 23:10:44 +02:00
starkillerOG f5358d3863
Bump reolink-aio to 0.5.16 (#93540) 2023-05-25 22:15:33 +02:00
Artem Draft 70e20815c7
Mark as `assumed_state` LG Netcast media player (#93543)
Mark as assumed_state LG Netcast media player
2023-05-25 22:47:13 +03:00
Erik Montnemery a71c097aeb
Revert "Allow setting an entity's name by its device class" (#93539) 2023-05-25 17:20:54 +02:00
Álvaro Fernández Rojas f7404e2ee0
Update aioairzone-cloud to v0.1.6 (#93513) 2023-05-25 17:18:28 +02:00
J. Nick Koston 25a33b6b37
Bump zeroconf to 0.63.0 (#93533)
changelog: https://github.com/python-zeroconf/python-zeroconf/compare/0.62.0...0.63.0

performance improvements
2023-05-25 16:52:31 +02:00
Dominik eb617e85f3
Use DEFAULT_SCAN_INTERVAL as update interval for glances (#93535)
Use default scan interval constant
2023-05-25 16:51:57 +02:00
Philip Peitsch 6c66af4e41
Add ability to send custom keys to Samsung TV (#83439)
* Add SamsungTV Remote entity with support for turn-off and send command

* Fix SamsungTV remote tests
2023-05-25 15:55:44 +02:00
Joost Lekkerkerker a96215bf2e
Lastfm config flow (#92299)
* Move constant values to separate file

* Move constant values to separate file

* Add config flow to lastfm

* Add tests

* Add config flow to lastfm

* Add tests

* Add tests

* Add tests

* Add extra form for main user and autofill with friends

* Add extra form for main user and autofill with friends

* Add extra form for main user and autofill with friends

* Add extra form for main user and autofill with friends

* Add OptionsFlow

* Add tests

* Fix feedback

* Fix feedback

* Fix feedback

* Fix feedback

* Fix test

* Apply suggestions from code review

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Update config_flow.py

* Update config_flow.py

* Update config_flow.py

* Update homeassistant/components/lastfm/config_flow.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Add tests

* Cleanup

* Update config_flow.py

* Update config_flow.py

* Update config_flow.py

* Fix test

* Fix feedback

* Codeowner lastfm

* Fix feedback

* Fix feedback

* Parametrize errors

* Parametrize errors

* Parametrize errors

* Finish tests

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2023-05-25 14:48:16 +02:00
J. Nick Koston e09e4f14d6
Speed up setting state (#93472) 2023-05-25 07:34:07 -05:00
Erik Montnemery 3cca338c6e
Improve blueprint test fixtures (#93519) 2023-05-25 13:45:19 +02:00
badewanne1234 393dbb6dc0
Fix of cover-tilt in homekit_controller (#91631)
* Fix of cover-tilt in homekit_controller

* Fix of cover-tilt and its tests
2023-05-25 12:41:42 +02:00
IceBotYT 9231010402
Code quality improvements and debug logs for LaCrosse View (#91979)
* Code quality improvements and debug logs for LaCrosse View

* Remove unrelated files

* Remove version bump

* Revert "Remove version bump"

This reverts commit ed440899f9.

* Revert "Remove unrelated files"

This reverts commit d9b48ae4f9.
2023-05-25 12:37:16 +02:00