Supress trackback and upgrade PyMata to 2.14 (#7176)
This commit is contained in:
parent
5179832f6f
commit
a41d0aced7
2 changed files with 25 additions and 23 deletions
|
@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||||
from homeassistant.const import CONF_PORT
|
from homeassistant.const import CONF_PORT
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['PyMata==2.13']
|
REQUIREMENTS = ['PyMata==2.14']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -29,18 +29,25 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Setup the Arduino component."""
|
"""Set up the Arduino component."""
|
||||||
import serial
|
import serial
|
||||||
|
|
||||||
|
port = config[DOMAIN][CONF_PORT]
|
||||||
|
|
||||||
global BOARD
|
global BOARD
|
||||||
try:
|
try:
|
||||||
BOARD = ArduinoBoard(config[DOMAIN][CONF_PORT])
|
BOARD = ArduinoBoard(port)
|
||||||
except (serial.serialutil.SerialException, FileNotFoundError):
|
except (serial.serialutil.SerialException, FileNotFoundError):
|
||||||
_LOGGER.exception("Your port is not accessible.")
|
_LOGGER.error("Your port %s is not accessible", port)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if BOARD.get_firmata()[1] <= 2:
|
try:
|
||||||
_LOGGER.error("The StandardFirmata sketch should be 2.2 or newer.")
|
if BOARD.get_firmata()[1] <= 2:
|
||||||
return False
|
_LOGGER.error("The StandardFirmata sketch should be 2.2 or newer")
|
||||||
|
return False
|
||||||
|
except IndexError:
|
||||||
|
_LOGGER.warning("The version of the StandardFirmata sketch was not"
|
||||||
|
"detected. This may lead to side effects")
|
||||||
|
|
||||||
def stop_arduino(event):
|
def stop_arduino(event):
|
||||||
"""Stop the Arduino service."""
|
"""Stop the Arduino service."""
|
||||||
|
@ -67,25 +74,20 @@ class ArduinoBoard(object):
|
||||||
def set_mode(self, pin, direction, mode):
|
def set_mode(self, pin, direction, mode):
|
||||||
"""Set the mode and the direction of a given pin."""
|
"""Set the mode and the direction of a given pin."""
|
||||||
if mode == 'analog' and direction == 'in':
|
if mode == 'analog' and direction == 'in':
|
||||||
self._board.set_pin_mode(pin,
|
self._board.set_pin_mode(
|
||||||
self._board.INPUT,
|
pin, self._board.INPUT, self._board.ANALOG)
|
||||||
self._board.ANALOG)
|
|
||||||
elif mode == 'analog' and direction == 'out':
|
elif mode == 'analog' and direction == 'out':
|
||||||
self._board.set_pin_mode(pin,
|
self._board.set_pin_mode(
|
||||||
self._board.OUTPUT,
|
pin, self._board.OUTPUT, self._board.ANALOG)
|
||||||
self._board.ANALOG)
|
|
||||||
elif mode == 'digital' and direction == 'in':
|
elif mode == 'digital' and direction == 'in':
|
||||||
self._board.set_pin_mode(pin,
|
self._board.set_pin_mode(
|
||||||
self._board.INPUT,
|
pin, self._board.INPUT, self._board.DIGITAL)
|
||||||
self._board.DIGITAL)
|
|
||||||
elif mode == 'digital' and direction == 'out':
|
elif mode == 'digital' and direction == 'out':
|
||||||
self._board.set_pin_mode(pin,
|
self._board.set_pin_mode(
|
||||||
self._board.OUTPUT,
|
pin, self._board.OUTPUT, self._board.DIGITAL)
|
||||||
self._board.DIGITAL)
|
|
||||||
elif mode == 'pwm':
|
elif mode == 'pwm':
|
||||||
self._board.set_pin_mode(pin,
|
self._board.set_pin_mode(
|
||||||
self._board.OUTPUT,
|
pin, self._board.OUTPUT, self._board.PWM)
|
||||||
self._board.PWM)
|
|
||||||
|
|
||||||
def get_analog_inputs(self):
|
def get_analog_inputs(self):
|
||||||
"""Get the values from the pins."""
|
"""Get the values from the pins."""
|
||||||
|
|
|
@ -26,7 +26,7 @@ PyJWT==1.4.2
|
||||||
PyMVGLive==1.1.3
|
PyMVGLive==1.1.3
|
||||||
|
|
||||||
# homeassistant.components.arduino
|
# homeassistant.components.arduino
|
||||||
PyMata==2.13
|
PyMata==2.14
|
||||||
|
|
||||||
# homeassistant.components.rpi_gpio
|
# homeassistant.components.rpi_gpio
|
||||||
# RPi.GPIO==0.6.1
|
# RPi.GPIO==0.6.1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue