From 338f30f1e53e2ff5f0d7b75ab6507967b04cdb25 Mon Sep 17 00:00:00 2001 From: pvizeli Date: Fri, 10 Mar 2017 14:40:44 +0100 Subject: [PATCH] Bugfix rpi_rf cleanup --- 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 e646afef172709..e48ac1a4d7d674 100644 --- a/homeassistant/components/switch/rpi_rf.py +++ b/homeassistant/components/switch/rpi_rf.py @@ -8,8 +8,9 @@ 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."""