Commit Graph

60450 Commits (485a78e0cfece8bb489bbc2c0a37a5b94c613a90)

Author SHA1 Message Date
epenet 485a78e0cf
Improve light type hints in integrations (#90035)
* Improve light type hints in integrations

* Improve
2023-03-21 11:40:33 +01:00
epenet 33e698d67f
Improve notify type hints in integrations (#90034) 2023-03-21 11:40:19 +01:00
epenet 86b4354477
Improve native_value type hints in integrations (#90033) 2023-03-21 11:40:06 +01:00
epenet 0e1c76f81f
Improve sensor type hints in integrations (#90031)
* Improve sensor type hints in integrations

* Improve
2023-03-21 11:39:42 +01:00
epenet 4836404288
Improve media_player type hints in integrations (#90029)
Fix some media_player type hints
2023-03-21 11:10:12 +01:00
epenet 04872f72ea
Improve humidifier type hints in integrations (#90030)
Fix humidifier type hints in integrations
2023-03-21 10:32:13 +01:00
epenet 292feb4e24
Enable inheritance checks on ExtraStoredData (#90021) 2023-03-21 09:51:05 +01:00
Allen Porter 43ce6f843c
Update the calendar trigger based on PR feedback (#90017) 2023-03-21 09:21:14 +01:00
Jan Bouwhuis d865440012
Prepare MQTT common tests part3 (#90022) 2023-03-21 09:19:20 +01:00
Franck Nijhof 23f136e9d6
Add state translations for Siren entities (#89994) 2023-03-21 09:16:32 +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
J. Nick Koston a8e95684fa
Fix websocket back pressure bottleneck (#89905) 2023-03-20 21:51:39 -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
J. Nick Koston 0303618705
Handle cancelation of wait_for_ble_connections_free in esphome bluetooth (#90014)
Handle cancelation in wait_for_ble_connections_free

If `wait_for_ble_connections_free` was canceled due to timeout or
the esp disconnecting from Home Assistant the future would get
canceled. When we reconnect and get the next callback we need
to handle it being done.

fixes
```
2023-03-21 02:34:36.876 ERROR (MainThread) [homeassistant] Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 868, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/_frame_helper.py", line 195, in data_received
    self._callback_packet(msg_type_int, bytes(packet_data))
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/_frame_helper.py", line 110, in _callback_packet
    self._on_pkt(Packet(type_, data))
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 688, in _process_packet
    handler(msg)
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 482, in on_msg
    on_bluetooth_connections_free_update(resp.free, resp.limit)
  File "/usr/src/homeassistant/homeassistant/components/esphome/entry_data.py", line 136, in async_update_ble_connection_limits
    fut.set_result(free)
asyncio.exceptions.InvalidStateError: invalid state
```
2023-03-20 23:49:59 -04:00
J. Nick Koston 7158dbc142
Bump yalexs-ble to 2.1.1 (#90015)
* Bump yalexs-ble to 2.1.1

There was another task that could be prematurely GCed

changelog: https://github.com/bdraco/yalexs-ble/compare/v2.1.0...v2.1.1

* fixes
2023-03-20 23:49:30 -04: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
J. Nick Koston 49f08ad71d
Filter out duplicate updates in esphome state dispatch (#89779) 2023-03-20 20:04:46 +01:00
Jon Caruana 20c9ed6d89
Mark LiteJet as Platinum integration (#88623) 2023-03-20 20:01:14 +01:00
J. Nick Koston 6bb80adbb9
Rollback the session after performing stats schema validation (#89904) 2023-03-20 17:15:11 +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
Steven Looman 9a5ceb9ef8
Use default rounding/presentation mechanism for upnp (#89954) 2023-03-20 15:44:05 +01:00
Franck Nijhof 9949ca13aa
Adjust state class of Toon monetary sensors (#89985) 2023-03-20 08:42:59 -04:00
Franck Nijhof b9ff69d3ac
Extend attribute state translations for Camera (#89876)
* Extend attribute state translations for Camera

* Add common generic translations
2023-03-20 08:39:20 -04: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
Joakim Plate 9f1e170851
Correct missing wordswap for S series nibe (#89866)
Correct missing wordswap for nibe
2023-03-20 12:08:27 +01:00
J. Nick Koston 146a31163c
Use bluetooth address instead of uuid on MacOS (#89926) 2023-03-20 12:07:41 +01:00
Michael e258f36ded
Remove deprecated binary update sensor from AVM FRITZ!Box Tools (#89940) 2023-03-20 12:06:40 +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
micha91 f3b3818d1f
Bump aiomusiccast to 0.14.8 (#89978) 2023-03-20 11:59:27 +01:00
Jesse Moody c4ee35570d
Update django github references to main instead of master branch. (#89951) 2023-03-20 10:27:55 +01:00
epenet 9a784fddef
Fail CI on lingering timers (#89292) 2023-03-20 10:20:19 +01:00
J. Nick Koston f62bb0e2ea
Bump zeroconf to 0.47.4 (#89973) 2023-03-20 09:32:21 +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
starkillerOG 939fce4607
Shield Reolink webhook callback from cancelation (#89798)
* shield Reolink webhook callback from cancelation

* Update homeassistant/components/reolink/host.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* fix styling

* fix black

* Revert to using asyncio.shield

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2023-03-19 23:35:16 -04: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 affb48d271
Avoid joining states_meta for statistics queries (#89941) 2023-03-19 16:44:35 -10:00
J. Nick Koston bf63e6cbd4
Set unique on StatesMeta and EventTypes database tables (#89971)
Set unique on StatesMeta and EventTypes

These should have been marked unique originally to prevent
collision bugs from going unnoticed. These have not been
to beta yet so this is not a breaking change
2023-03-19 22:30:01 -04:00
J. Nick Koston 817ba97227
Remove unneeded lambda_stmt in place add in statistics (#89943)
We can generate this entire query in a single lambda_stmt
so there is no need to add two which increases the size
of the cache key
2023-03-19 22:05:39 -04:00
J. Nick Koston f27d73fc34
Remove legacy event lookups from logbook (#89945)
Events recorded with Home Assistant 2022.5.x or older will no
longer display context information in the logbook
2023-03-19 22:05:07 -04: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 7f3e4cb3af
Guard against selecting all invalid entity_ids in history (#89929)
If all the entity_ids that were provided do not exist we would
end up passing an empty list of ids to the SQL query which
would do an unbounded select
2023-03-19 22:03:12 -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