Bugfix rpi_rf cleanup (#6513)

Add an optional extended description…
pull/6514/head
Pascal Vizeli 2017-03-10 14:56:13 +01:00 committed by GitHub
parent 846a0513c7
commit b5fb558c62
1 changed files with 6 additions and 2 deletions

View File

@ -8,8 +8,9 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA) from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
from homeassistant.const import (CONF_NAME, CONF_SWITCHES) from homeassistant.const import (
CONF_NAME, CONF_SWITCHES, EVENT_HOMEASSISTANT_STOP)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['rpi-rf==0.9.6'] REQUIREMENTS = ['rpi-rf==0.9.6']
@ -71,6 +72,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(devices) add_devices(devices)
hass.bus.listen_once(
EVENT_HOMEASSISTANT_STOP, lambda event: rfdevice.cleanup())
class RPiRFSwitch(SwitchDevice): class RPiRFSwitch(SwitchDevice):
"""Representation of a GPIO RF switch.""" """Representation of a GPIO RF switch."""