mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Remove usless DEMO constant. Add version information in RPi.GPIO requirement
This commit is contained in:
parent
e97e73e66e
commit
d6c7bf5ac8
@ -30,14 +30,14 @@ from homeassistant.const import (DEVICE_DEFAULT_NAME,
|
|||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
EVENT_HOMEASSISTANT_STOP)
|
EVENT_HOMEASSISTANT_STOP)
|
||||||
|
|
||||||
|
REQUIREMENTS = ['RPi.GPIO>=0.5.11']
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
DEMO = True
|
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
""" Sets up the Raspberry PI GPIO switches. """
|
""" 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.')
|
_LOGGER.error('RPi.GPIO not available. rpi_gpio switches ignored.')
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -68,7 +68,6 @@ class RPiGPIOSwitch(ToggleEntity):
|
|||||||
self._name = name or DEVICE_DEFAULT_NAME
|
self._name = name or DEVICE_DEFAULT_NAME
|
||||||
self._state = False
|
self._state = False
|
||||||
self._gpio = gpio
|
self._gpio = gpio
|
||||||
if not DEMO:
|
|
||||||
GPIO.setup(gpio, GPIO.OUT)
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -102,7 +101,6 @@ class RPiGPIOSwitch(ToggleEntity):
|
|||||||
""" Execute the actual commands """
|
""" Execute the actual commands """
|
||||||
_LOGGER.info('Setting GPIO %s to %s', self._gpio, new_state)
|
_LOGGER.info('Setting GPIO %s to %s', self._gpio, new_state)
|
||||||
try:
|
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:
|
except:
|
||||||
_LOGGER.error('GPIO "%s" output failed', self._gpio)
|
_LOGGER.error('GPIO "%s" output failed', self._gpio)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user