mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Address late review of Switcher sensor migration (#52186)
This commit is contained in:
parent
cd9fa27f2a
commit
568e1b379d
@ -13,7 +13,7 @@ from homeassistant.components.sensor import (
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import ELECTRICAL_CURRENT_AMPERE, POWER_WATT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import DiscoveryInfoType, StateType
|
||||
@ -124,8 +124,8 @@ class SwitcherSensorEntity(SensorEntity):
|
||||
)
|
||||
)
|
||||
|
||||
async def async_update_data(self, device_data: SwitcherV2Device) -> None:
|
||||
@callback
|
||||
def async_update_data(self, device_data: SwitcherV2Device) -> None:
|
||||
"""Update the entity data."""
|
||||
if device_data:
|
||||
self._device_data = device_data
|
||||
self.async_write_ha_state()
|
||||
|
@ -13,7 +13,7 @@ from aioswitcher.devices import SwitcherV2Device
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -135,9 +135,9 @@ class SwitcherControl(SwitchEntity):
|
||||
)
|
||||
)
|
||||
|
||||
async def async_update_data(self, device_data: SwitcherV2Device) -> None:
|
||||
@callback
|
||||
def async_update_data(self, device_data: SwitcherV2Device) -> None:
|
||||
"""Update the entity data."""
|
||||
if device_data:
|
||||
if self._self_initiated:
|
||||
self._self_initiated = False
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user