1 """Support for Freebox Delta, Revolution and Mini 4K."""
3 from __future__
import annotations
8 from freebox_api.exceptions
import InsufficientPermissionsError
16 from .const
import DOMAIN
17 from .router
import FreeboxRouter
19 _LOGGER = logging.getLogger(__name__)
22 SWITCH_DESCRIPTIONS = [
26 entity_category=EntityCategory.CONFIG,
32 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
34 """Set up the switch."""
35 router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
38 for entity_description
in SWITCH_DESCRIPTIONS
44 """Representation of a freebox switch."""
47 self, router: FreeboxRouter, entity_description: SwitchEntityDescription
49 """Initialize the switch."""
56 """Turn the switch on or off."""
58 await self.
_router_router.wifi.set_global_config({
"enabled": enabled})
59 except InsufficientPermissionsError:
61 "Home Assistant does not have permissions to modify the Freebox"
62 " settings. Please refer to documentation"
66 """Turn the switch on."""
70 """Turn the switch off."""
74 """Get the state and update it."""
75 data = await self.
_router_router.wifi.get_global_config()
None _async_set_state(self, bool enabled)
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None __init__(self, FreeboxRouter router, SwitchEntityDescription entity_description)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)