From b5fb558c6261fb6a91435189b1020a61b87db988 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 10 Mar 2017 14:56:13 +0100 Subject: [PATCH] Bugfix rpi_rf cleanup (#6513) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an optional extended description… --- homeassistant/components/switch/rpi_rf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/switch/rpi_rf.py b/homeassistant/components/switch/rpi_rf.py index e646afef172..e48ac1a4d7d 100644 --- a/homeassistant/components/switch/rpi_rf.py +++ b/homeassistant/components/switch/rpi_rf.py @@ -8,8 +8,9 @@ import logging import voluptuous as vol -from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA) -from homeassistant.const import (CONF_NAME, CONF_SWITCHES) +from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA +from homeassistant.const import ( + CONF_NAME, CONF_SWITCHES, EVENT_HOMEASSISTANT_STOP) import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['rpi-rf==0.9.6'] @@ -71,6 +72,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None): add_devices(devices) + hass.bus.listen_once( + EVENT_HOMEASSISTANT_STOP, lambda event: rfdevice.cleanup()) + class RPiRFSwitch(SwitchDevice): """Representation of a GPIO RF switch."""