1 """Fully Kiosk Browser number entity."""
3 from __future__
import annotations
5 from contextlib
import suppress
12 from .
import FullyKioskConfigEntry
13 from .coordinator
import FullyKioskDataUpdateCoordinator
14 from .entity
import FullyKioskEntity
16 ENTITY_TYPES: tuple[NumberEntityDescription, ...] = (
18 key=
"timeToScreensaverV2",
19 translation_key=
"screensaver_time",
20 native_max_value=9999,
23 native_unit_of_measurement=UnitOfTime.SECONDS,
24 entity_category=EntityCategory.CONFIG,
27 key=
"screensaverBrightness",
28 translation_key=
"screensaver_brightness",
32 entity_category=EntityCategory.CONFIG,
35 key=
"timeToScreenOffV2",
36 translation_key=
"screen_off_time",
37 native_max_value=9999,
40 native_unit_of_measurement=UnitOfTime.SECONDS,
41 entity_category=EntityCategory.CONFIG,
44 key=
"screenBrightness",
45 translation_key=
"screen_brightness",
49 entity_category=EntityCategory.CONFIG,
56 config_entry: FullyKioskConfigEntry,
57 async_add_entities: AddEntitiesCallback,
59 """Set up the Fully Kiosk Browser number entities."""
60 coordinator = config_entry.runtime_data
64 for entity
in ENTITY_TYPES
65 if entity.key
in coordinator.data[
"settings"]
70 """Representation of a Fully Kiosk Browser entity."""
74 coordinator: FullyKioskDataUpdateCoordinator,
75 description: NumberEntityDescription,
77 """Initialize the number entity."""
80 self.
_attr_unique_id_attr_unique_id = f
"{coordinator.data['deviceID']}-{description.key}"
84 """Return the state of the number entity."""
90 with suppress(ValueError):
96 """Set the value of the entity."""
97 await self.coordinator.fully.setConfigurationString(
None async_set_native_value(self, float value)
None __init__(self, FullyKioskDataUpdateCoordinator coordinator, NumberEntityDescription description)
int|None native_value(self)
web.Response get(self, web.Request request, str config_key)
None async_setup_entry(HomeAssistant hass, FullyKioskConfigEntry config_entry, AddEntitiesCallback async_add_entities)