9 from .const
import DOMAIN
10 from .device
import ONVIFDevice
11 from .entity
import ONVIFBaseEntity
16 config_entry: ConfigEntry,
17 async_add_entities: AddEntitiesCallback,
19 """Set up ONVIF button based on a config entry."""
20 device = hass.data[DOMAIN][config_entry.unique_id]
25 """Defines a ONVIF reboot button."""
27 _attr_device_class = ButtonDeviceClass.RESTART
28 _attr_entity_category = EntityCategory.CONFIG
30 def __init__(self, device: ONVIFDevice) ->
None:
31 """Initialize the button entity."""
37 """Send out a SystemReboot command."""
38 device_mgmt = await self.device.device.create_devicemgmt_service()
39 await device_mgmt.SystemReboot()
43 """Defines a ONVIF SetSystemDateAndTime button."""
45 _attr_entity_category = EntityCategory.CONFIG
47 def __init__(self, device: ONVIFDevice) ->
None:
48 """Initialize the button entity."""
50 self.
_attr_name_attr_name = f
"{self.device.name} Set System Date and Time"
54 """Send out a SetSystemDateAndTime command."""
55 await self.device.async_manually_set_date_and_time()