Improve type hints in demo [1/3] (#77180)
This commit is contained in:
parent
575ac5ae0a
commit
7eb8e1f25d
13 changed files with 156 additions and 247 deletions
|
@ -48,6 +48,8 @@ async def async_setup_entry(
|
|||
class DemoBinarySensor(BinarySensorEntity):
|
||||
"""representation of a Demo binary sensor."""
|
||||
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
unique_id: str,
|
||||
|
@ -57,7 +59,7 @@ class DemoBinarySensor(BinarySensorEntity):
|
|||
) -> None:
|
||||
"""Initialize the demo sensor."""
|
||||
self._unique_id = unique_id
|
||||
self._name = name
|
||||
self._attr_name = name
|
||||
self._state = state
|
||||
self._sensor_type = device_class
|
||||
|
||||
|
@ -82,16 +84,6 @@ class DemoBinarySensor(BinarySensorEntity):
|
|||
"""Return the class of this sensor."""
|
||||
return self._sensor_type
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""No polling needed for a demo binary sensor."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the binary sensor."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if the binary sensor is on."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue