|
@@ -26,6 +26,7 @@ async def async_setup_entry(
|
|
|
async_add_entities([
|
|
async_add_entities([
|
|
|
ForceRefreshButton(coordinator, entry, device_name),
|
|
ForceRefreshButton(coordinator, entry, device_name),
|
|
|
TestNextGuestButton(coordinator, entry, device_name),
|
|
TestNextGuestButton(coordinator, entry, device_name),
|
|
|
|
|
+ OverrideCurrentButton(coordinator, entry, device_name),
|
|
|
OverrideEmptyButton(coordinator, entry, device_name),
|
|
OverrideEmptyButton(coordinator, entry, device_name),
|
|
|
GuestArrivedButton(coordinator, entry, device_name),
|
|
GuestArrivedButton(coordinator, entry, device_name),
|
|
|
GuestDepartedButton(coordinator, entry, device_name),
|
|
GuestDepartedButton(coordinator, entry, device_name),
|
|
@@ -85,6 +86,31 @@ class TestNextGuestButton(CoordinatorEntity[RoomCalCoordinator], ButtonEntity):
|
|
|
await self.coordinator.async_start_override(OverrideData(current=override_current))
|
|
await self.coordinator.async_start_override(OverrideData(current=override_current))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+class OverrideCurrentButton(CoordinatorEntity[RoomCalCoordinator], ButtonEntity):
|
|
|
|
|
+ _attr_has_entity_name = True
|
|
|
|
|
+ _attr_translation_key = "override_current"
|
|
|
|
|
+ _attr_icon = "mdi:calendar-edit"
|
|
|
|
|
+
|
|
|
|
|
+ def __init__(
|
|
|
|
|
+ self,
|
|
|
|
|
+ coordinator: RoomCalCoordinator,
|
|
|
|
|
+ entry: ConfigEntry,
|
|
|
|
|
+ device_name: str,
|
|
|
|
|
+ ) -> None:
|
|
|
|
|
+ super().__init__(coordinator)
|
|
|
|
|
+ self._attr_unique_id = f"{entry.entry_id}_override_current"
|
|
|
|
|
+ self._attr_device_info = DeviceInfo(
|
|
|
|
|
+ identifiers={(DOMAIN, f"{entry.entry_id}_room_state")},
|
|
|
|
|
+ name=device_name,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ async def async_press(self) -> None:
|
|
|
|
|
+ current = self.coordinator.data.current if self.coordinator.data else None
|
|
|
|
|
+ if current is None:
|
|
|
|
|
+ return
|
|
|
|
|
+ await self.coordinator.async_start_override(OverrideData(current=current))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
class OverrideEmptyButton(CoordinatorEntity[RoomCalCoordinator], ButtonEntity):
|
|
class OverrideEmptyButton(CoordinatorEntity[RoomCalCoordinator], ButtonEntity):
|
|
|
_attr_has_entity_name = True
|
|
_attr_has_entity_name = True
|
|
|
_attr_translation_key = "override_empty"
|
|
_attr_translation_key = "override_empty"
|