Remove usless DEMO constant. Add version information in RPi.GPIO requirement

This commit is contained in:
Guillem Barba 2015-08-02 23:24:36 +02:00
parent e97e73e66e
commit d6c7bf5ac8
2 changed files with 5 additions and 7 deletions

View file

@ -30,14 +30,14 @@ from homeassistant.const import (DEVICE_DEFAULT_NAME,
EVENT_HOMEASSISTANT_START,
EVENT_HOMEASSISTANT_STOP)
REQUIREMENTS = ['RPi.GPIO>=0.5.11']
_LOGGER = logging.getLogger(__name__)
DEMO = True
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Raspberry PI GPIO switches. """
if not DEMO and GPIO is None:
if GPIO is None:
_LOGGER.error('RPi.GPIO not available. rpi_gpio switches ignored.')
return
@ -68,7 +68,6 @@ class RPiGPIOSwitch(ToggleEntity):
self._name = name or DEVICE_DEFAULT_NAME
self._state = False
self._gpio = gpio
if not DEMO:
GPIO.setup(gpio, GPIO.OUT)
@property
@ -102,7 +101,6 @@ class RPiGPIOSwitch(ToggleEntity):
""" Execute the actual commands """
_LOGGER.info('Setting GPIO %s to %s', self._gpio, new_state)
try:
if not DEMO:
GPIO.output(self._gpio, 1 if new_state else 0)
except:
_LOGGER.error('GPIO "%s" output failed', self._gpio)