Skip to content

Commit

Permalink
Merge branch 'dev' into risco_exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Apr 10, 2024
2 parents 720e6c3 + 0636ba3 commit 4290b46
Show file tree
Hide file tree
Showing 208 changed files with 3,230 additions and 1,850 deletions.
4 changes: 0 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ omit =
homeassistant/components/epion/sensor.py
homeassistant/components/epson/__init__.py
homeassistant/components/epson/media_player.py
homeassistant/components/epsonworkforce/sensor.py
homeassistant/components/eq3btsmart/__init__.py
homeassistant/components/eq3btsmart/climate.py
homeassistant/components/eq3btsmart/const.py
Expand Down Expand Up @@ -542,12 +541,9 @@ omit =
homeassistant/components/hko/weather.py
homeassistant/components/hlk_sw16/__init__.py
homeassistant/components/hlk_sw16/switch.py
homeassistant/components/home_connect/__init__.py
homeassistant/components/home_connect/api.py
homeassistant/components/home_connect/binary_sensor.py
homeassistant/components/home_connect/entity.py
homeassistant/components/home_connect/light.py
homeassistant/components/home_connect/sensor.py
homeassistant/components/home_connect/switch.py
homeassistant/components/homematic/__init__.py
homeassistant/components/homematic/binary_sensor.py
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ jobs:
if: needs.info.outputs.test_full_suite == 'true'
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3.1.3
action: codecov/codecov-action@v4.3.0
with: |
fail_ci_if_error: true
flags: full-suite
Expand All @@ -1101,7 +1101,7 @@ jobs:
if: needs.info.outputs.test_full_suite == 'false'
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3.1.3
action: codecov/codecov-action@v4.3.0
with: |
fail_ci_if_error: true
token: ${{ env.CODECOV_TOKEN }}
Expand Down Expand Up @@ -1236,7 +1236,7 @@ jobs:
if: needs.info.outputs.test_full_suite == 'true'
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3.1.3
action: codecov/codecov-action@v4.3.0
with: |
fail_ci_if_error: true
flags: full-suite
Expand All @@ -1247,7 +1247,7 @@ jobs:
if: needs.info.outputs.test_full_suite == 'false'
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3.1.3
action: codecov/codecov-action@v4.3.0
with: |
fail_ci_if_error: true
token: ${{ env.CODECOV_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ build.json @home-assistant/supervisor
/tests/components/epion/ @lhgravendeel
/homeassistant/components/epson/ @pszafer
/tests/components/epson/ @pszafer
/homeassistant/components/epsonworkforce/ @ThaStealth
/homeassistant/components/eq3btsmart/ @eulemitkeule @dbuezas
/tests/components/eq3btsmart/ @eulemitkeule @dbuezas
/homeassistant/components/escea/ @lazdavila
Expand Down
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ RUN \
uv pip install homeassistant/home_assistant_*.whl; \
fi \
&& if [ "${BUILD_ARCH}" = "i386" ]; then \
LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \
MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \
linux32 uv pip install \
--no-build \
-r homeassistant/requirements_all.txt; \
else \
LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \
MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \
uv pip install \
--no-build \
-r homeassistant/requirements_all.txt; \
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/auth/jwt_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def verify_and_decode(
key: str,
algorithms: list[str],
issuer: str | None = None,
leeway: int | float | timedelta = 0,
leeway: float | timedelta = 0,
options: dict[str, Any] | None = None,
) -> dict[str, Any]:
"""Verify a JWT's signature and claims."""
Expand Down
5 changes: 0 additions & 5 deletions homeassistant/brands/epson.json

This file was deleted.

10 changes: 5 additions & 5 deletions homeassistant/components/alexa/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ class AlexaPresetResource(AlexaCapabilityResource):
def __init__(
self,
labels: list[str],
min_value: int | float,
max_value: int | float,
precision: int | float,
min_value: float,
max_value: float,
precision: float,
unit: str | None = None,
) -> None:
"""Initialize an Alexa presetResource."""
Expand All @@ -306,7 +306,7 @@ def __init__(
if unit in AlexaGlobalCatalog.__dict__.values():
self._unit_of_measure = unit

def add_preset(self, value: int | float, labels: list[str]) -> None:
def add_preset(self, value: float, labels: list[str]) -> None:
"""Add preset to configuration presets array."""
self._presets.append({"value": value, "labels": labels})

Expand Down Expand Up @@ -405,7 +405,7 @@ def add_states_to_value(self, states: list[str], value: Any) -> None:
)

def add_states_to_range(
self, states: list[str], min_value: int | float, max_value: int | float
self, states: list[str], min_value: float, max_value: float
) -> None:
"""Add StatesToRange stateMappings."""
self._add_state_mapping(
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/alexa/state_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ async def _async_entity_state_listener(
EVENT_STATE_CHANGED,
_async_entity_state_listener,
event_filter=_async_entity_state_filter,
run_immediately=True,
)


Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ def _async_save_changed_entities(
cancel_listen = hass.bus.async_listen(
EVENT_STATE_CHANGED,
_async_save_changed_entities,
run_immediately=True,
)

try:
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/apple_tv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ async def on_hass_stop(event: Event) -> None:
await manager.disconnect()

entry.async_on_unload(
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, on_hass_stop, run_immediately=True
)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop)
)

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/apple_tv/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,7 @@ async def async_find_device(self, allow_exist: bool = False) -> None:
},
)
if entry.source != SOURCE_IGNORE:
self.hass.async_create_task(
self.hass.config_entries.async_reload(entry.entry_id)
)
self.hass.config_entries.async_schedule_reload(entry.entry_id)
if not allow_exist:
raise DeviceAlreadyConfigured

Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/august/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def _async_setup_listeners(self) -> None:
self._stop_interval = self._hass.bus.async_listen(
EVENT_HOMEASSISTANT_STOP,
self._async_cancel_update_interval,
run_immediately=True,
)

@callback
Expand Down
17 changes: 3 additions & 14 deletions homeassistant/components/automation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,10 @@ def __init__(
raw_config: ConfigType | None,
) -> None:
"""Initialize an automation entity."""
self._name = name
self._attr_name = name
self._attr_unique_id = automation_id
self.raw_config = raw_config

@property
def name(self) -> str:
"""Return the name of the entity."""
return self._name

@cached_property
def referenced_labels(self) -> set[str]:
"""Return a set of referenced labels."""
Expand Down Expand Up @@ -488,7 +483,7 @@ def __init__(
trace_config: ConfigType,
) -> None:
"""Initialize an automation entity."""
self._name = name
self._attr_name = name
self._trigger_config = trigger_config
self._async_detach_triggers: CALLBACK_TYPE | None = None
self._cond_func = cond_func
Expand All @@ -504,11 +499,6 @@ def __init__(
self._trace_config = trace_config
self._attr_unique_id = automation_id

@property
def name(self) -> str:
"""Return the name of the entity."""
return self._name

@property
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the entity state attributes."""
Expand Down Expand Up @@ -732,7 +722,7 @@ def started_action() -> None:
translation_placeholders={
"service": f"{err.domain}.{err.service}",
"entity_id": self.entity_id,
"name": self.name or self.entity_id,
"name": self._attr_name or self.entity_id,
"edit": f"/config/automation/edit/{self.unique_id}",
},
)
Expand Down Expand Up @@ -782,7 +772,6 @@ async def async_enable(self) -> None:
self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STARTED,
self._async_enable_automation,
run_immediately=True,
)
self.async_write_ha_state()

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/azure_event_hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async def async_start(self) -> None:
"""
logging.getLogger("azure.eventhub").setLevel(logging.WARNING)
self._listener_remover = self.hass.bus.async_listen(
MATCH_ALL, self.async_listen, run_immediately=True
MATCH_ALL, self.async_listen
)
self._schedule_next_send()

Expand Down
5 changes: 1 addition & 4 deletions homeassistant/components/bluetooth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ def _async_shutdown_debouncer(_: Event) -> None:
"""Shutdown debouncer."""
discovery_debouncer.async_shutdown()

hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer, run_immediately=True
)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_shutdown_debouncer)

async def _async_call_debouncer(now: datetime.datetime) -> None:
"""Call the debouncer at a later time."""
Expand Down Expand Up @@ -201,7 +199,6 @@ def _async_trigger_discovery() -> None:
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP,
hass_callback(lambda event: cancel()),
run_immediately=True,
)


Expand Down
6 changes: 2 additions & 4 deletions homeassistant/components/bluetooth/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@ async def async_setup(self) -> None:
self._bluetooth_adapters, self.storage
)
self._cancel_logging_listener = self.hass.bus.async_listen(
EVENT_LOGGING_CHANGED, self._async_logging_changed, run_immediately=True
)
self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self.async_stop, run_immediately=True
EVENT_LOGGING_CHANGED, self._async_logging_changed
)
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop)
seen: set[str] = set()
for address, service_info in itertools.chain(
self._connectable_history.items(), self._all_history.items()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bluetooth/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"quality_scale": "internal",
"requirements": [
"bleak==0.21.1",
"bleak-retry-connector==3.4.0",
"bleak-retry-connector==3.5.0",
"bluetooth-adapters==0.18.0",
"bluetooth-auto-recovery==1.4.0",
"bluetooth-data-tools==1.19.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ async def _async_save_processor_data_at_stop(_event: Event) -> None:
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP,
_async_save_processor_data_at_stop,
run_immediately=True,
)


Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/bond/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def _async_stop_event(*_: Any) -> None:

entry.async_on_unload(_async_stop_event)
entry.async_on_unload(
hass.bus.async_listen(
EVENT_HOMEASSISTANT_STOP, _async_stop_event, run_immediately=True
)
hass.bus.async_listen(EVENT_HOMEASSISTANT_STOP, _async_stop_event)
)
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = BondData(hub, bpup_subs)

Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/caldav/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
username=entry.data[CONF_USERNAME],
password=entry.data[CONF_PASSWORD],
ssl_verify_cert=entry.data[CONF_VERIFY_SSL],
timeout=10,
)
try:
await hass.async_add_executor_job(client.principal)
Expand Down
8 changes: 2 additions & 6 deletions homeassistant/components/camera/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,7 @@ async def preload_stream(_event: Event) -> None:
stream.add_provider("hls")
await stream.start()

hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STARTED, preload_stream, run_immediately=True
)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, preload_stream)

@callback
def update_tokens(t: datetime) -> None:
Expand All @@ -432,9 +430,7 @@ def unsub_track_time_interval(_event: Event) -> None:
"""Unsubscribe track time interval timer."""
unsub()

hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, unsub_track_time_interval, run_immediately=True
)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, unsub_track_time_interval)

component.async_register_entity_service(
SERVICE_ENABLE_MOTION, {}, "async_enable_motion_detection"
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ async def _shutdown(event: Event) -> None:
"""Shutdown event."""
await cloud.stop()

hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, _shutdown, run_immediately=True
)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _shutdown)

_remote_handle_prefs_updated(cloud)

Expand Down
4 changes: 0 additions & 4 deletions homeassistant/components/conversation/default_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,20 @@ def _listen_clear_slot_list(self) -> None:
self.hass.bus.async_listen(
ar.EVENT_AREA_REGISTRY_UPDATED,
self._async_clear_slot_list,
run_immediately=True,
),
self.hass.bus.async_listen(
fr.EVENT_FLOOR_REGISTRY_UPDATED,
self._async_clear_slot_list,
run_immediately=True,
),
self.hass.bus.async_listen(
er.EVENT_ENTITY_REGISTRY_UPDATED,
self._async_clear_slot_list,
event_filter=self._filter_entity_registry_changes,
run_immediately=True,
),
self.hass.bus.async_listen(
EVENT_STATE_CHANGED,
self._async_clear_slot_list,
event_filter=self._filter_state_changes,
run_immediately=True,
),
async_listen_entity_updates(self.hass, DOMAIN, self._async_clear_slot_list),
]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/demo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __init__(
self,
unique_id: str,
device_name: str | None,
state: float | int | str | None,
state: float | str | None,
device_class: SensorDeviceClass,
state_class: SensorStateClass | None,
unit_of_measurement: str | None,
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/device_tracker/config_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ def handle_device_event(ev: Event[EventDeviceRegistryUpdatedData]) -> None:
# Enable entity
ent_reg.async_update_entity(entity_id, disabled_by=None)

hass.bus.async_listen(
dr.EVENT_DEVICE_REGISTRY_UPDATED, handle_device_event, run_immediately=True
)
hass.bus.async_listen(dr.EVENT_DEVICE_REGISTRY_UPDATED, handle_device_event)


class BaseTrackerEntity(Entity):
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/device_tracker/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@ def _on_hass_stop(_: Event) -> None:
"""
cancel_update_stale()

hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, _on_hass_stop, run_immediately=True
)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _on_hass_stop)


@attr.s
Expand Down
Loading

0 comments on commit 4290b46

Please sign in to comment.