Skip to content

Commit

Permalink
Remove usless DEMO constant. Add version information in RPi.GPIO requ…
Browse files Browse the repository at this point in the history
…irement
  • Loading branch information
Guillem Barba committed Aug 6, 2015
1 parent e97e73e commit d6c7bf5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions homeassistant/components/switch/rpi_gpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
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

Expand Down Expand Up @@ -68,8 +68,7 @@ def __init__(self, name, gpio):
self._name = name or DEVICE_DEFAULT_NAME
self._state = False
self._gpio = gpio
if not DEMO:
GPIO.setup(gpio, GPIO.OUT)
GPIO.setup(gpio, GPIO.OUT)

@property
def name(self):
Expand Down Expand Up @@ -102,8 +101,7 @@ def _switch(self, new_state):
""" 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)
GPIO.output(self._gpio, 1 if new_state else 0)
except:
_LOGGER.error('GPIO "%s" output failed', self._gpio)
return False
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ https://github.com/rkabadi/temper-python/archive/master.zip
https://github.com/rkabadi/pyedimax/archive/master.zip

# RPI-GPIO platform
RPi.GPIO>=0.5.11
RPi.GPIO >=0.5.11

0 comments on commit d6c7bf5

Please sign in to comment.