mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Adjust inheritance in homeworks (#77265)
This commit is contained in:
parent
4d02cccd11
commit
7ee47f0f26
@ -16,6 +16,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.discovery import load_platform
|
from homeassistant.helpers.discovery import load_platform
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||||
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
@ -95,30 +96,18 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class HomeworksDevice:
|
class HomeworksDevice(Entity):
|
||||||
"""Base class of a Homeworks device."""
|
"""Base class of a Homeworks device."""
|
||||||
|
|
||||||
|
_attr_should_poll = False
|
||||||
|
|
||||||
def __init__(self, controller, addr, name):
|
def __init__(self, controller, addr, name):
|
||||||
"""Initialize Homeworks device."""
|
"""Initialize Homeworks device."""
|
||||||
self._addr = addr
|
self._addr = addr
|
||||||
self._name = name
|
self._attr_name = name
|
||||||
|
self._attr_unique_id = f"homeworks.{self._addr}"
|
||||||
self._controller = controller
|
self._controller = controller
|
||||||
|
|
||||||
@property
|
|
||||||
def unique_id(self):
|
|
||||||
"""Return a unique identifier."""
|
|
||||||
return f"homeworks.{self._addr}"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Device name."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def should_poll(self):
|
|
||||||
"""No need to poll."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
class HomeworksKeypadEvent:
|
class HomeworksKeypadEvent:
|
||||||
"""When you want signals instead of entities.
|
"""When you want signals instead of entities.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user