Skip to content

Commit

Permalink
Move imports to top for remote_rpi_gpio (#29286)
Browse files Browse the repository at this point in the history
  • Loading branch information
springstan authored and MartinHjelmare committed Dec 1, 2019
1 parent e2e53be commit d0ed9b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
7 changes: 3 additions & 4 deletions homeassistant/components/remote_rpi_gpio/__init__.py
@@ -1,6 +1,9 @@
"""Support for controlling GPIO pins of a Raspberry Pi."""
import logging

from gpiozero import LED, Button
from gpiozero.pins.pigpio import PiGPIOFactory

_LOGGER = logging.getLogger(__name__)

CONF_BOUNCETIME = "bouncetime"
Expand All @@ -21,8 +24,6 @@ def setup(hass, config):

def setup_output(address, port, invert_logic):
"""Set up a GPIO as output."""
from gpiozero import LED
from gpiozero.pins.pigpio import PiGPIOFactory

try:
return LED(port, active_high=invert_logic, pin_factory=PiGPIOFactory(address))
Expand All @@ -32,8 +33,6 @@ def setup_output(address, port, invert_logic):

def setup_input(address, port, pull_mode, bouncetime):
"""Set up a GPIO as input."""
from gpiozero import Button
from gpiozero.pins.pigpio import PiGPIOFactory

if pull_mode == "UP":
pull_gpio_up = True
Expand Down
8 changes: 3 additions & 5 deletions homeassistant/components/remote_rpi_gpio/binary_sensor.py
@@ -1,19 +1,17 @@
"""Support for binary sensor using RPi GPIO."""
import logging

import voluptuous as vol

import requests
import voluptuous as vol

from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice
from homeassistant.const import CONF_HOST
from homeassistant.components.binary_sensor import BinarySensorDevice, PLATFORM_SCHEMA

import homeassistant.helpers.config_validation as cv

from . import (
CONF_BOUNCETIME,
CONF_PULL_MODE,
CONF_INVERT_LOGIC,
CONF_PULL_MODE,
DEFAULT_BOUNCETIME,
DEFAULT_INVERT_LOGIC,
DEFAULT_PULL_MODE,
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/remote_rpi_gpio/switch.py
Expand Up @@ -3,9 +3,8 @@

import voluptuous as vol

from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
from homeassistant.const import DEVICE_DEFAULT_NAME, CONF_HOST

from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import CONF_HOST, DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv

from . import CONF_INVERT_LOGIC, DEFAULT_INVERT_LOGIC
Expand Down

0 comments on commit d0ed9b3

Please sign in to comment.