Change configuration for orangepi (#23231)

This commit is contained in:
Pascal Roeleven 2019-04-19 13:26:53 +02:00 committed by Martin Hjelmare
parent 3e443d253c
commit b2a7699cdf
3 changed files with 7 additions and 7 deletions

View File

@ -6,9 +6,9 @@ from homeassistant.const import (
_LOGGER = logging.getLogger(__name__)
CONF_PINMODE = 'pinmode'
CONF_PIN_MODE = 'pin_mode'
DOMAIN = 'orangepi_gpio'
PINMODES = ['pc', 'zeroplus', 'zeroplus2', 'deo', 'neocore2']
PIN_MODES = ['pc', 'zeroplus', 'zeroplus2', 'deo', 'neocore2']
def setup(hass, config):

View File

@ -6,7 +6,7 @@ from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.const import DEVICE_DEFAULT_NAME
from . import CONF_PINMODE
from . import CONF_PIN_MODE
from .const import CONF_INVERT_LOGIC, CONF_PORTS, PORT_SCHEMA
_LOGGER = logging.getLogger(__name__)
@ -16,8 +16,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(PORT_SCHEMA)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Orange Pi GPIO devices."""
pinmode = config[CONF_PINMODE]
orangepi_gpio.setup_mode(pinmode)
pin_mode = config[CONF_PIN_MODE]
orangepi_gpio.setup_mode(pin_mode)
invert_logic = config[CONF_INVERT_LOGIC]

View File

@ -3,7 +3,7 @@ import voluptuous as vol
from homeassistant.helpers import config_validation as cv
from . import CONF_PINMODE, PINMODES
from . import CONF_PIN_MODE, PIN_MODES
CONF_INVERT_LOGIC = 'invert_logic'
CONF_PORTS = 'ports'
@ -16,6 +16,6 @@ _SENSORS_SCHEMA = vol.Schema({
PORT_SCHEMA = {
vol.Required(CONF_PORTS): _SENSORS_SCHEMA,
vol.Required(CONF_PINMODE): vol.In(PINMODES),
vol.Required(CONF_PIN_MODE): vol.In(PIN_MODES),
vol.Optional(CONF_INVERT_LOGIC, default=DEFAULT_INVERT_LOGIC): cv.boolean,
}