Rename BinarySensorDevice to BinarySensorEntity (#34462)
* Rename BinarySensorDevice to BinarySensorEntity * Tweak * Move deprecation warning to __new__, add test * Move deprecation warning back to __init__ * Move deprecation warning to __init_subclass
This commit is contained in:
parent
0b64f49e3a
commit
b022e08db9
147 changed files with 371 additions and 352 deletions
|
@ -8,7 +8,7 @@ from surepy import SureLocationID, SureProductID
|
|||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_CONNECTIVITY,
|
||||
DEVICE_CLASS_PRESENCE,
|
||||
BinarySensorDevice,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_ID, CONF_TYPE
|
||||
from homeassistant.core import callback
|
||||
|
@ -55,7 +55,7 @@ async def async_setup_platform(
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class SurePetcareBinarySensor(BinarySensorDevice):
|
||||
class SurePetcareBinarySensor(BinarySensorEntity):
|
||||
"""A binary sensor implementation for Sure Petcare Entities."""
|
||||
|
||||
def __init__(
|
||||
|
@ -105,7 +105,7 @@ class SurePetcareBinarySensor(BinarySensorDevice):
|
|||
return None if not self._device_class else self._device_class
|
||||
|
||||
@property
|
||||
def unique_id(self: BinarySensorDevice) -> str:
|
||||
def unique_id(self: BinarySensorEntity) -> str:
|
||||
"""Return an unique ID."""
|
||||
return f"{self._spc_data['household_id']}-{self._id}"
|
||||
|
||||
|
@ -214,7 +214,7 @@ class DeviceConnectivity(SurePetcareBinarySensor):
|
|||
return f"{self._name}_connectivity"
|
||||
|
||||
@property
|
||||
def unique_id(self: BinarySensorDevice) -> str:
|
||||
def unique_id(self: BinarySensorEntity) -> str:
|
||||
"""Return an unique ID."""
|
||||
return f"{self._spc_data['household_id']}-{self._id}-connectivity"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue