From 48e899ca3ad947f17ec83eda68ea964a2a43a826 Mon Sep 17 00:00:00 2001 From: Paul Daumlechner Date: Fri, 29 Jan 2021 20:07:58 +0100 Subject: [PATCH] Add reboot_gateway service to Velux (#43198) --- homeassistant/components/velux/__init__.py | 7 +++++++ homeassistant/components/velux/services.yaml | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 homeassistant/components/velux/services.yaml diff --git a/homeassistant/components/velux/__init__.py b/homeassistant/components/velux/__init__.py index bac65c969cf..90ed0a91b14 100644 --- a/homeassistant/components/velux/__init__.py +++ b/homeassistant/components/velux/__init__.py @@ -58,11 +58,18 @@ class VeluxModule: _LOGGER.debug("Velux interface terminated") await self.pyvlx.disconnect() + async def async_reboot_gateway(service_call): + await self.pyvlx.reboot_gateway() + self._hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop) host = self._domain_config.get(CONF_HOST) password = self._domain_config.get(CONF_PASSWORD) self.pyvlx = PyVLX(host=host, password=password) + self._hass.services.async_register( + DOMAIN, "reboot_gateway", async_reboot_gateway + ) + async def async_start(self): """Start velux component.""" _LOGGER.debug("Velux interface started") diff --git a/homeassistant/components/velux/services.yaml b/homeassistant/components/velux/services.yaml new file mode 100644 index 00000000000..2460db0bbb0 --- /dev/null +++ b/homeassistant/components/velux/services.yaml @@ -0,0 +1,4 @@ +# Velux Integration services + +reboot_gateway: + description: Reboots the KLF200 Gateway.