1 """Support for Broadlink device time."""
3 from __future__
import annotations
5 from datetime
import time
14 from .
import BroadlinkDevice
15 from .const
import DOMAIN
16 from .entity
import BroadlinkEntity
21 config_entry: ConfigEntry,
22 async_add_entities: AddEntitiesCallback,
24 """Set up the Broadlink time."""
25 device = hass.data[DOMAIN].devices[config_entry.entry_id]
30 """Representation of a Broadlink device time."""
32 _attr_has_entity_name =
True
33 _attr_native_value: time |
None =
None
35 def __init__(self, device: BroadlinkDevice) ->
None:
36 """Initialize the sensor."""
42 """Update the state of the entity."""
43 if data
is None or "hour" not in data
or "min" not in data
or "sec" not in data:
50 tzinfo=dt_util.get_default_time_zone(),
54 """Change the value."""
55 await self.
_device_device.async_request(
56 self.
_device_device.api.set_time,
None _update_state(self, dict[str, Any] data)
None async_set_value(self, time value)
None __init__(self, BroadlinkDevice device)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
bool time(HomeAssistant hass, dt_time|str|None before=None, dt_time|str|None after=None, str|Container[str]|None weekday=None)