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:
Aaron Bach 2023-03-28 01:31:36 -06:00 committed by GitHub
parent 0666a4750c
commit ff135ecdc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 131 additions and 25 deletions

View file

@ -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: