|
|
@@ -25,6 +25,7 @@ async def async_setup_entry(
|
|
|
async_add_entities([
|
|
|
ForceRefreshButton(coordinator, entry, device_name),
|
|
|
PromoteFromNextButton(coordinator, entry, device_name),
|
|
|
+ ClearCurrentButton(coordinator, entry, device_name),
|
|
|
TestNextGuestButton(coordinator, entry, device_name),
|
|
|
])
|
|
|
|
|
|
@@ -71,6 +72,27 @@ class PromoteFromNextButton(ButtonEntity):
|
|
|
await self._coordinator.async_promote_next_to_current()
|
|
|
|
|
|
|
|
|
+class ClearCurrentButton(ButtonEntity):
|
|
|
+ _attr_has_entity_name = True
|
|
|
+ _attr_name = "Clear Current"
|
|
|
+
|
|
|
+ def __init__(
|
|
|
+ self,
|
|
|
+ coordinator: RoomCalCoordinator,
|
|
|
+ entry: ConfigEntry,
|
|
|
+ device_name: str,
|
|
|
+ ) -> None:
|
|
|
+ self._coordinator = coordinator
|
|
|
+ self._attr_unique_id = f"{entry.entry_id}_clear_current"
|
|
|
+ self._attr_device_info = DeviceInfo(
|
|
|
+ identifiers={(DOMAIN, f"{entry.entry_id}_room_state")},
|
|
|
+ name=device_name,
|
|
|
+ )
|
|
|
+
|
|
|
+ async def async_press(self) -> None:
|
|
|
+ await self._coordinator.async_clear_current()
|
|
|
+
|
|
|
+
|
|
|
class TestNextGuestButton(CoordinatorEntity[RoomCalCoordinator], ButtonEntity):
|
|
|
_attr_has_entity_name = True
|
|
|
_attr_name = "Test Next Guest"
|