Rename async_track_state_reported_event to async_track_state_report_event (#120637)

* Rename async_track_state_reported_event to async_track_state_report_event

* Update tests
pull/120662/head
Erik Montnemery 2024-06-27 13:45:15 +02:00 committed by GitHub
parent 1f54180807
commit 8de771de96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 12 deletions

View File

@ -46,7 +46,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.event import (
async_call_later,
async_track_state_change_event,
async_track_state_reported_event,
async_track_state_report_event,
)
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
@ -449,7 +449,7 @@ class IntegrationSensor(RestoreSensor):
)
)
self.async_on_remove(
async_track_state_reported_event(
async_track_state_report_event(
self.hass,
self._sensor_source_id,
handle_state_report,

View File

@ -60,8 +60,8 @@ from .typing import TemplateVarsType
_TRACK_STATE_CHANGE_DATA: HassKey[_KeyedEventData[EventStateChangedData]] = HassKey(
"track_state_change_data"
)
_TRACK_STATE_REPORTED_DATA: HassKey[_KeyedEventData[EventStateReportedData]] = HassKey(
"track_state_reported_data"
_TRACK_STATE_REPORT_DATA: HassKey[_KeyedEventData[EventStateReportedData]] = HassKey(
"track_state_report_data"
)
_TRACK_STATE_ADDED_DOMAIN_DATA: HassKey[_KeyedEventData[EventStateChangedData]] = (
HassKey("track_state_added_domain_data")
@ -379,15 +379,15 @@ def _async_track_state_change_event(
)
_KEYED_TRACK_STATE_REPORTED = _KeyedEventTracker(
key=_TRACK_STATE_REPORTED_DATA,
_KEYED_TRACK_STATE_REPORT = _KeyedEventTracker(
key=_TRACK_STATE_REPORT_DATA,
event_type=EVENT_STATE_REPORTED,
dispatcher_callable=_async_dispatch_entity_id_event,
filter_callable=_async_state_filter,
)
def async_track_state_reported_event(
def async_track_state_report_event(
hass: HomeAssistant,
entity_ids: str | Iterable[str],
action: Callable[[Event[EventStateReportedData]], Any],
@ -395,7 +395,7 @@ def async_track_state_reported_event(
) -> CALLBACK_TYPE:
"""Track EVENT_STATE_REPORTED by entity_id without lowercasing."""
return _async_track_event(
_KEYED_TRACK_STATE_REPORTED, hass, entity_ids, action, job_type
_KEYED_TRACK_STATE_REPORT, hass, entity_ids, action, job_type
)

View File

@ -40,7 +40,7 @@ from homeassistant.helpers.event import (
async_track_state_change_event,
async_track_state_change_filtered,
async_track_state_removed_domain,
async_track_state_reported_event,
async_track_state_report_event,
async_track_sunrise,
async_track_sunset,
async_track_template,
@ -4916,8 +4916,8 @@ async def test_track_point_in_time_repr(
await hass.async_block_till_done(wait_background_tasks=True)
async def test_async_track_state_reported_event(hass: HomeAssistant) -> None:
"""Test async_track_state_reported_event."""
async def test_async_track_state_report_event(hass: HomeAssistant) -> None:
"""Test async_track_state_report_event."""
tracker_called: list[ha.State] = []
@ha.callback
@ -4925,7 +4925,7 @@ async def test_async_track_state_reported_event(hass: HomeAssistant) -> None:
new_state = event.data["new_state"]
tracker_called.append(new_state)
unsub = async_track_state_reported_event(
unsub = async_track_state_report_event(
hass, ["light.bowl", "light.top"], single_run_callback
)
hass.states.async_set("light.bowl", "on")