Replace EventType with Event [h-i] (#112740)
parent
25237e0377
commit
8f1e2f1a7b
|
@ -36,7 +36,6 @@ from homeassistant.helpers.event import (
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.json import json_bytes
|
from homeassistant.helpers.json import json_bytes
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from .const import EVENT_COALESCE_TIME, MAX_PENDING_HISTORY_STATES
|
from .const import EVENT_COALESCE_TIME, MAX_PENDING_HISTORY_STATES
|
||||||
|
@ -373,7 +372,7 @@ def _async_subscribe_events(
|
||||||
assert is_callback(target), "target must be a callback"
|
assert is_callback(target), "target must be a callback"
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _forward_state_events_filtered(event: EventType[EventStateChangedData]) -> None:
|
def _forward_state_events_filtered(event: Event[EventStateChangedData]) -> None:
|
||||||
"""Filter state events and forward them."""
|
"""Filter state events and forward them."""
|
||||||
if (new_state := event.data["new_state"]) is None or (
|
if (new_state := event.data["new_state"]) is None or (
|
||||||
old_state := event.data["old_state"]
|
old_state := event.data["old_state"]
|
||||||
|
|
|
@ -6,14 +6,13 @@ from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback
|
||||||
from homeassistant.exceptions import TemplateError
|
from homeassistant.exceptions import TemplateError
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.start import async_at_start
|
from homeassistant.helpers.start import async_at_start
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
from .data import HistoryStats, HistoryStatsState
|
from .data import HistoryStats, HistoryStatsState
|
||||||
|
@ -88,7 +87,7 @@ class HistoryStatsUpdateCoordinator(DataUpdateCoordinator[HistoryStatsState]):
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _async_update_from_event(
|
async def _async_update_from_event(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Process an update from an event."""
|
"""Process an update from an event."""
|
||||||
self.async_set_updated_data(await self._history_stats.async_update(event))
|
self.async_set_updated_data(await self._history_stats.async_update(event))
|
||||||
|
|
|
@ -6,10 +6,9 @@ from dataclasses import dataclass
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from homeassistant.components.recorder import get_instance, history
|
from homeassistant.components.recorder import get_instance, history
|
||||||
from homeassistant.core import HomeAssistant, State
|
from homeassistant.core import Event, HomeAssistant, State
|
||||||
from homeassistant.helpers.event import EventStateChangedData
|
from homeassistant.helpers.event import EventStateChangedData
|
||||||
from homeassistant.helpers.template import Template
|
from homeassistant.helpers.template import Template
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from .helpers import async_calculate_period, floored_timestamp
|
from .helpers import async_calculate_period, floored_timestamp
|
||||||
|
@ -59,7 +58,7 @@ class HistoryStats:
|
||||||
self._end = end
|
self._end = end
|
||||||
|
|
||||||
async def async_update(
|
async def async_update(
|
||||||
self, event: EventType[EventStateChangedData] | None
|
self, event: Event[EventStateChangedData] | None
|
||||||
) -> HistoryStatsState:
|
) -> HistoryStatsState:
|
||||||
"""Update the stats at a given time."""
|
"""Update the stats at a given time."""
|
||||||
# Get previous values of start and end
|
# Get previous values of start and end
|
||||||
|
|
|
@ -19,7 +19,14 @@ from homeassistant.const import (
|
||||||
CONF_PLATFORM,
|
CONF_PLATFORM,
|
||||||
CONF_VALUE_TEMPLATE,
|
CONF_VALUE_TEMPLATE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CALLBACK_TYPE, HassJob, HomeAssistant, State, callback
|
from homeassistant.core import (
|
||||||
|
CALLBACK_TYPE,
|
||||||
|
Event,
|
||||||
|
HassJob,
|
||||||
|
HomeAssistant,
|
||||||
|
State,
|
||||||
|
callback,
|
||||||
|
)
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import (
|
||||||
condition,
|
condition,
|
||||||
config_validation as cv,
|
config_validation as cv,
|
||||||
|
@ -32,7 +39,7 @@ from homeassistant.helpers.event import (
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
||||||
from homeassistant.helpers.typing import ConfigType, EventType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_T = TypeVar("_T", bound=dict[str, Any])
|
_T = TypeVar("_T", bound=dict[str, Any])
|
||||||
|
|
||||||
|
@ -152,7 +159,7 @@ async def async_attach_trigger(
|
||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def state_automation_listener(event: EventType[EventStateChangedData]) -> None:
|
def state_automation_listener(event: Event[EventStateChangedData]) -> None:
|
||||||
"""Listen for state changes and calls action."""
|
"""Listen for state changes and calls action."""
|
||||||
entity_id = event.data["entity_id"]
|
entity_id = event.data["entity_id"]
|
||||||
from_s = event.data["old_state"]
|
from_s = event.data["old_state"]
|
||||||
|
|
|
@ -10,7 +10,14 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import exceptions
|
from homeassistant import exceptions
|
||||||
from homeassistant.const import CONF_ATTRIBUTE, CONF_FOR, CONF_PLATFORM, MATCH_ALL
|
from homeassistant.const import CONF_ATTRIBUTE, CONF_FOR, CONF_PLATFORM, MATCH_ALL
|
||||||
from homeassistant.core import CALLBACK_TYPE, HassJob, HomeAssistant, State, callback
|
from homeassistant.core import (
|
||||||
|
CALLBACK_TYPE,
|
||||||
|
Event,
|
||||||
|
HassJob,
|
||||||
|
HomeAssistant,
|
||||||
|
State,
|
||||||
|
callback,
|
||||||
|
)
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import (
|
||||||
config_validation as cv,
|
config_validation as cv,
|
||||||
entity_registry as er,
|
entity_registry as er,
|
||||||
|
@ -23,7 +30,7 @@ from homeassistant.helpers.event import (
|
||||||
process_state_match,
|
process_state_match,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
||||||
from homeassistant.helpers.typing import ConfigType, EventType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -125,7 +132,7 @@ async def async_attach_trigger(
|
||||||
_variables = trigger_info["variables"] or {}
|
_variables = trigger_info["variables"] or {}
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def state_automation_listener(event: EventType[EventStateChangedData]) -> None:
|
def state_automation_listener(event: Event[EventStateChangedData]) -> None:
|
||||||
"""Listen for state changes and calls action."""
|
"""Listen for state changes and calls action."""
|
||||||
entity = event.data["entity_id"]
|
entity = event.data["entity_id"]
|
||||||
from_s = event.data["old_state"]
|
from_s = event.data["old_state"]
|
||||||
|
|
|
@ -13,7 +13,14 @@ from homeassistant.const import (
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CALLBACK_TYPE, HassJob, HomeAssistant, State, callback
|
from homeassistant.core import (
|
||||||
|
CALLBACK_TYPE,
|
||||||
|
Event,
|
||||||
|
HassJob,
|
||||||
|
HomeAssistant,
|
||||||
|
State,
|
||||||
|
callback,
|
||||||
|
)
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
|
@ -22,7 +29,7 @@ from homeassistant.helpers.event import (
|
||||||
async_track_time_change,
|
async_track_time_change,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
||||||
from homeassistant.helpers.typing import ConfigType, EventType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
_TIME_TRIGGER_SCHEMA = vol.Any(
|
_TIME_TRIGGER_SCHEMA = vol.Any(
|
||||||
|
@ -72,7 +79,7 @@ async def async_attach_trigger(
|
||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def update_entity_trigger_event(event: EventType[EventStateChangedData]) -> None:
|
def update_entity_trigger_event(event: Event[EventStateChangedData]) -> None:
|
||||||
"""update_entity_trigger from the event."""
|
"""update_entity_trigger from the event."""
|
||||||
return update_entity_trigger(event.data["entity_id"], event.data["new_state"])
|
return update_entity_trigger(event.data["entity_id"], event.data["new_state"])
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ from homeassistant.const import (
|
||||||
from homeassistant.core import (
|
from homeassistant.core import (
|
||||||
CALLBACK_TYPE,
|
CALLBACK_TYPE,
|
||||||
Context,
|
Context,
|
||||||
|
Event,
|
||||||
HomeAssistant,
|
HomeAssistant,
|
||||||
State,
|
State,
|
||||||
callback as ha_callback,
|
callback as ha_callback,
|
||||||
|
@ -54,7 +55,6 @@ from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
from homeassistant.util.decorator import Registry
|
from homeassistant.util.decorator import Registry
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
|
@ -478,7 +478,7 @@ class HomeAccessory(Accessory): # type: ignore[misc]
|
||||||
|
|
||||||
@ha_callback
|
@ha_callback
|
||||||
def async_update_event_state_callback(
|
def async_update_event_state_callback(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle state change event listener callback."""
|
"""Handle state change event listener callback."""
|
||||||
new_state = event.data["new_state"]
|
new_state = event.data["new_state"]
|
||||||
|
@ -530,7 +530,7 @@ class HomeAccessory(Accessory): # type: ignore[misc]
|
||||||
|
|
||||||
@ha_callback
|
@ha_callback
|
||||||
def async_update_linked_battery_callback(
|
def async_update_linked_battery_callback(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle linked battery sensor state change listener callback."""
|
"""Handle linked battery sensor state change listener callback."""
|
||||||
if (new_state := event.data["new_state"]) is None:
|
if (new_state := event.data["new_state"]) is None:
|
||||||
|
@ -543,7 +543,7 @@ class HomeAccessory(Accessory): # type: ignore[misc]
|
||||||
|
|
||||||
@ha_callback
|
@ha_callback
|
||||||
def async_update_linked_battery_charging_callback(
|
def async_update_linked_battery_charging_callback(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle linked battery charging sensor state change listener callback."""
|
"""Handle linked battery charging sensor state change listener callback."""
|
||||||
if (new_state := event.data["new_state"]) is None:
|
if (new_state := event.data["new_state"]) is None:
|
||||||
|
|
|
@ -17,13 +17,12 @@ from pyhap.util import callback as pyhap_callback
|
||||||
from homeassistant.components import camera
|
from homeassistant.components import camera
|
||||||
from homeassistant.components.ffmpeg import get_ffmpeg_manager
|
from homeassistant.components.ffmpeg import get_ffmpeg_manager
|
||||||
from homeassistant.const import STATE_ON
|
from homeassistant.const import STATE_ON
|
||||||
from homeassistant.core import HomeAssistant, State, callback
|
from homeassistant.core import Event, HomeAssistant, State, callback
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
async_track_time_interval,
|
async_track_time_interval,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
|
|
||||||
from .accessories import TYPES, HomeAccessory, HomeDriver
|
from .accessories import TYPES, HomeAccessory, HomeDriver
|
||||||
from .const import (
|
from .const import (
|
||||||
|
@ -284,7 +283,7 @@ class Camera(HomeAccessory, PyhapCamera): # type: ignore[misc]
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_update_motion_state_event(
|
def _async_update_motion_state_event(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle state change event listener callback."""
|
"""Handle state change event listener callback."""
|
||||||
if not state_changed_event_is_same_state(event):
|
if not state_changed_event_is_same_state(event):
|
||||||
|
@ -311,7 +310,7 @@ class Camera(HomeAccessory, PyhapCamera): # type: ignore[misc]
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_update_doorbell_state_event(
|
def _async_update_doorbell_state_event(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle state change event listener callback."""
|
"""Handle state change event listener callback."""
|
||||||
if not state_changed_event_is_same_state(event):
|
if not state_changed_event_is_same_state(event):
|
||||||
|
|
|
@ -34,12 +34,11 @@ from homeassistant.const import (
|
||||||
STATE_OPEN,
|
STATE_OPEN,
|
||||||
STATE_OPENING,
|
STATE_OPENING,
|
||||||
)
|
)
|
||||||
from homeassistant.core import State, callback
|
from homeassistant.core import Event, State, callback
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
|
|
||||||
from .accessories import TYPES, HomeAccessory
|
from .accessories import TYPES, HomeAccessory
|
||||||
from .const import (
|
from .const import (
|
||||||
|
@ -147,7 +146,7 @@ class GarageDoorOpener(HomeAccessory):
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_update_obstruction_event(
|
def _async_update_obstruction_event(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle state change event listener callback."""
|
"""Handle state change event listener callback."""
|
||||||
self._async_update_obstruction_state(event.data["new_state"])
|
self._async_update_obstruction_state(event.data["new_state"])
|
||||||
|
|
|
@ -25,12 +25,11 @@ from homeassistant.const import (
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.core import State, callback
|
from homeassistant.core import Event, State, callback
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
|
|
||||||
from .accessories import TYPES, HomeAccessory
|
from .accessories import TYPES, HomeAccessory
|
||||||
from .const import (
|
from .const import (
|
||||||
|
@ -195,7 +194,7 @@ class HumidifierDehumidifier(HomeAccessory):
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_update_current_humidity_event(
|
def async_update_current_humidity_event(
|
||||||
self, event: EventType[EventStateChangedData]
|
self, event: Event[EventStateChangedData]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle state change event listener callback."""
|
"""Handle state change event listener callback."""
|
||||||
self._async_update_current_humidity(event.data["new_state"])
|
self._async_update_current_humidity(event.data["new_state"])
|
||||||
|
|
|
@ -38,11 +38,10 @@ from homeassistant.const import (
|
||||||
CONF_TYPE,
|
CONF_TYPE,
|
||||||
UnitOfTemperature,
|
UnitOfTemperature,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, State, callback, split_entity_id
|
from homeassistant.core import Event, HomeAssistant, State, callback, split_entity_id
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.event import EventStateChangedData
|
from homeassistant.helpers.event import EventStateChangedData
|
||||||
from homeassistant.helpers.storage import STORAGE_DIR
|
from homeassistant.helpers.storage import STORAGE_DIR
|
||||||
from homeassistant.helpers.typing import EventType
|
|
||||||
from homeassistant.util.unit_conversion import TemperatureConverter
|
from homeassistant.util.unit_conversion import TemperatureConverter
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
|
@ -624,7 +623,7 @@ def state_needs_accessory_mode(state: State) -> bool:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def state_changed_event_is_same_state(event: EventType[EventStateChangedData]) -> bool:
|
def state_changed_event_is_same_state(event: Event[EventStateChangedData]) -> bool:
|
||||||
"""Check if a state changed event is the same state."""
|
"""Check if a state changed event is the same state."""
|
||||||
event_data = event.data
|
event_data = event.data
|
||||||
old_state = event_data["old_state"]
|
old_state = event_data["old_state"]
|
||||||
|
|
|
@ -27,7 +27,7 @@ from homeassistant.const import (
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
UnitOfTime,
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import Event, HomeAssistant, callback
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import (
|
||||||
config_validation as cv,
|
config_validation as cv,
|
||||||
device_registry as dr,
|
device_registry as dr,
|
||||||
|
@ -39,7 +39,7 @@ from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, EventType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_ROUND_DIGITS,
|
CONF_ROUND_DIGITS,
|
||||||
|
@ -293,7 +293,7 @@ class IntegrationSensor(RestoreSensor):
|
||||||
self._unit_of_measurement = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
self._unit_of_measurement = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def calc_integration(event: EventType[EventStateChangedData]) -> None:
|
def calc_integration(event: Event[EventStateChangedData]) -> None:
|
||||||
"""Handle the sensor state changes."""
|
"""Handle the sensor state changes."""
|
||||||
old_state = event.data["old_state"]
|
old_state = event.data["old_state"]
|
||||||
new_state = event.data["new_state"]
|
new_state = event.data["new_state"]
|
||||||
|
|
|
@ -18,12 +18,12 @@ from homeassistant.const import (
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, State, callback
|
from homeassistant.core import Event, HomeAssistant, State, callback
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
EventStateChangedData,
|
EventStateChangedData,
|
||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import ConfigType, EventType, StateType
|
from homeassistant.helpers.typing import ConfigType, StateType
|
||||||
|
|
||||||
from .const import CONF_RESPOND_TO_READ, KNX_ADDRESS
|
from .const import CONF_RESPOND_TO_READ, KNX_ADDRESS
|
||||||
from .schema import ExposeSchema
|
from .schema import ExposeSchema
|
||||||
|
@ -149,9 +149,7 @@ class KNXExposeSensor:
|
||||||
return str(value)[:14]
|
return str(value)[:14]
|
||||||
return value
|
return value
|
||||||
|
|
||||||
async def _async_entity_changed(
|
async def _async_entity_changed(self, event: Event[EventStateChangedData]) -> None:
|
||||||
self, event: EventType[EventStateChangedData]
|
|
||||||
) -> None:
|
|
||||||
"""Handle entity change."""
|
"""Handle entity change."""
|
||||||
new_state = event.data["new_state"]
|
new_state = event.data["new_state"]
|
||||||
if (new_value := self._get_expose_value(new_state)) is None:
|
if (new_value := self._get_expose_value(new_state)) is None:
|
||||||
|
|
Loading…
Reference in New Issue