From ee657f3c2ff84b8649cc3fa32e923ab11ee67e37 Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Sat, 7 Dec 2019 12:09:43 +0100 Subject: [PATCH] Add service to reboot the Freebox (#29525) --- homeassistant/components/freebox/__init__.py | 6 ++++++ homeassistant/components/freebox/services.yaml | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 homeassistant/components/freebox/services.yaml diff --git a/homeassistant/components/freebox/__init__.py b/homeassistant/components/freebox/__init__.py index 64c59c3ef2a..96874ddeb94 100644 --- a/homeassistant/components/freebox/__init__.py +++ b/homeassistant/components/freebox/__init__.py @@ -71,6 +71,12 @@ async def async_setup_freebox(hass, config, host, port): else: hass.data[DATA_FREEBOX] = fbx + async def async_freebox_reboot(call): + """Handle reboot service call.""" + await fbx.system.reboot() + + hass.services.async_register(DOMAIN, "reboot", async_freebox_reboot) + hass.async_create_task(async_load_platform(hass, "sensor", DOMAIN, {}, config)) hass.async_create_task( async_load_platform(hass, "device_tracker", DOMAIN, {}, config) diff --git a/homeassistant/components/freebox/services.yaml b/homeassistant/components/freebox/services.yaml new file mode 100644 index 00000000000..be7afa60562 --- /dev/null +++ b/homeassistant/components/freebox/services.yaml @@ -0,0 +1,5 @@ +# Freebox service entries description. + +reboot: + # Description of the service + description: Reboots the Freebox.