Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move imports to top for remote_rpi_gpio #29286

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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