Add a calendar entity to Ridwell (#88108)
* Subclass a `DataUpdateCoordinator` for Ridwell * Add a calendar entity to Ridwell * Simpler unique ID * Fix tests * Docstring
This commit is contained in:
parent
0666a4750c
commit
ff135ecdc6
10 changed files with 131 additions and 25 deletions
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
from typing import Any
|
||||
|
||||
from aioridwell.errors import RidwellError
|
||||
from aioridwell.model import EventState
|
||||
from aioridwell.model import EventState, RidwellAccount
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -38,7 +38,19 @@ async def async_setup_entry(
|
|||
|
||||
|
||||
class RidwellSwitch(RidwellEntity, SwitchEntity):
|
||||
"""Define a Ridwell button."""
|
||||
"""Define a Ridwell switch."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: RidwellDataUpdateCoordinator,
|
||||
account: RidwellAccount,
|
||||
description: SwitchEntityDescription,
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
super().__init__(coordinator, account)
|
||||
|
||||
self._attr_unique_id = f"{account.account_id}_{description.key}"
|
||||
self.entity_description = description
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue