1 """Support for Fully Kiosk Browser camera."""
3 from __future__
import annotations
5 from fullykiosk
import FullyKioskError
12 from .
import FullyKioskConfigEntry
13 from .coordinator
import FullyKioskDataUpdateCoordinator
14 from .entity
import FullyKioskEntity
19 entry: FullyKioskConfigEntry,
20 async_add_entities: AddEntitiesCallback,
22 """Set up the cameras."""
23 coordinator = entry.runtime_data
28 """Fully Kiosk Browser camera entity."""
31 _attr_supported_features = CameraEntityFeature.ON_OFF
33 def __init__(self, coordinator: FullyKioskDataUpdateCoordinator) ->
None:
34 """Initialize the camera."""
35 FullyKioskEntity.__init__(self, coordinator)
40 self, width: int |
None =
None, height: int |
None =
None
42 """Return bytes of camera image."""
44 image_bytes: bytes = await self.coordinator.fully.getCamshot()
45 except FullyKioskError
as err:
52 await self.coordinator.fully.enableMotionDetection()
56 """Turn off camera."""
57 await self.coordinator.fully.disableMotionDetection()
62 """Handle updated data from the coordinator."""
63 self.
_attr_is_on_attr_is_on = self.coordinator.data[
"settings"].
get(
"motionDetection")
None async_write_ha_state(self)
None _handle_coordinator_update(self)
bytes|None async_camera_image(self, int|None width=None, int|None height=None)
None __init__(self, FullyKioskDataUpdateCoordinator coordinator)
None async_turn_off(self)
None async_write_ha_state(self)
web.Response get(self, web.Request request, str config_key)
None async_setup_entry(HomeAssistant hass, FullyKioskConfigEntry entry, AddEntitiesCallback async_add_entities)