Upgrade numpy to 1.14.0 (#11542)
This commit is contained in:
parent
13effee679
commit
8b267e3faf
4 changed files with 26 additions and 32 deletions
|
@ -11,21 +11,19 @@ import math
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASSES_SCHEMA, ENTITY_ID_FORMAT, PLATFORM_SCHEMA,
|
||||
BinarySensorDevice)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, CONF_DEVICE_CLASS, CONF_ENTITY_ID,
|
||||
CONF_FRIENDLY_NAME, STATE_UNKNOWN)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDevice, ENTITY_ID_FORMAT, PLATFORM_SCHEMA,
|
||||
DEVICE_CLASSES_SCHEMA)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME,
|
||||
CONF_DEVICE_CLASS, CONF_ENTITY_ID, CONF_FRIENDLY_NAME,
|
||||
STATE_UNKNOWN)
|
||||
from homeassistant.helpers.entity import generate_entity_id
|
||||
from homeassistant.helpers.event import async_track_state_change
|
||||
from homeassistant.util import utcnow
|
||||
|
||||
REQUIREMENTS = ['numpy==1.13.3']
|
||||
REQUIREMENTS = ['numpy==1.14.0']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -36,21 +34,21 @@ ATTR_INVERT = 'invert'
|
|||
ATTR_SAMPLE_DURATION = 'sample_duration'
|
||||
ATTR_SAMPLE_COUNT = 'sample_count'
|
||||
|
||||
CONF_SENSORS = 'sensors'
|
||||
CONF_ATTRIBUTE = 'attribute'
|
||||
CONF_INVERT = 'invert'
|
||||
CONF_MAX_SAMPLES = 'max_samples'
|
||||
CONF_MIN_GRADIENT = 'min_gradient'
|
||||
CONF_INVERT = 'invert'
|
||||
CONF_SAMPLE_DURATION = 'sample_duration'
|
||||
CONF_SENSORS = 'sensors'
|
||||
|
||||
SENSOR_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_ENTITY_ID): cv.entity_id,
|
||||
vol.Optional(CONF_ATTRIBUTE): cv.string,
|
||||
vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA,
|
||||
vol.Optional(CONF_FRIENDLY_NAME): cv.string,
|
||||
vol.Optional(CONF_INVERT, default=False): cv.boolean,
|
||||
vol.Optional(CONF_MAX_SAMPLES, default=2): cv.positive_int,
|
||||
vol.Optional(CONF_MIN_GRADIENT, default=0.0): vol.Coerce(float),
|
||||
vol.Optional(CONF_INVERT, default=False): cv.boolean,
|
||||
vol.Optional(CONF_SAMPLE_DURATION, default=0): cv.positive_int,
|
||||
})
|
||||
|
||||
|
@ -129,11 +127,11 @@ class SensorTrend(BinarySensorDevice):
|
|||
return {
|
||||
ATTR_ENTITY_ID: self._entity_id,
|
||||
ATTR_FRIENDLY_NAME: self._name,
|
||||
ATTR_INVERT: self._invert,
|
||||
ATTR_GRADIENT: self._gradient,
|
||||
ATTR_INVERT: self._invert,
|
||||
ATTR_MIN_GRADIENT: self._min_gradient,
|
||||
ATTR_SAMPLE_DURATION: self._sample_duration,
|
||||
ATTR_SAMPLE_COUNT: len(self.samples),
|
||||
ATTR_SAMPLE_DURATION: self._sample_duration,
|
||||
}
|
||||
|
||||
@property
|
||||
|
|
|
@ -8,16 +8,15 @@ from datetime import timedelta
|
|||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import split_entity_id
|
||||
from homeassistant.components.image_processing import (
|
||||
CONF_SOURCE, CONF_ENTITY_ID, CONF_NAME, PLATFORM_SCHEMA,
|
||||
CONF_ENTITY_ID, CONF_NAME, CONF_SOURCE, PLATFORM_SCHEMA,
|
||||
ImageProcessingEntity)
|
||||
from homeassistant.core import split_entity_id
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['numpy==1.13.3']
|
||||
REQUIREMENTS = ['numpy==1.14.0']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -73,7 +72,7 @@ def _create_processor_from_config(hass, camera_entity, config):
|
|||
|
||||
def _get_default_classifier(dest_path):
|
||||
"""Download the default OpenCV classifier."""
|
||||
_LOGGER.info('Downloading default classifier')
|
||||
_LOGGER.info("Downloading default classifier")
|
||||
req = requests.get(CASCADE_URL, stream=True)
|
||||
with open(dest_path, 'wb') as fil:
|
||||
for chunk in req.iter_content(chunk_size=1024):
|
||||
|
@ -84,14 +83,13 @@ def _get_default_classifier(dest_path):
|
|||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up the OpenCV image processing platform."""
|
||||
try:
|
||||
# Verify opencv python package is preinstalled
|
||||
# Verify that the OpenCV python package is pre-installed
|
||||
# pylint: disable=unused-import,unused-variable
|
||||
import cv2 # noqa
|
||||
except ImportError:
|
||||
_LOGGER.error("No opencv library found! " +
|
||||
"Install or compile for your system " +
|
||||
"following instructions here: " +
|
||||
"http://opencv.org/releases.html")
|
||||
_LOGGER.error(
|
||||
"No OpenCV library found! Install or compile for your system "
|
||||
"following instructions here: http://opencv.org/releases.html")
|
||||
return
|
||||
|
||||
entities = []
|
||||
|
@ -105,8 +103,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
for camera in config[CONF_SOURCE]:
|
||||
entities.append(OpenCVImageProcessor(
|
||||
hass, camera[CONF_ENTITY_ID], camera.get(CONF_NAME),
|
||||
config[CONF_CLASSIFIER]
|
||||
))
|
||||
config[CONF_CLASSIFIER]))
|
||||
|
||||
add_devices(entities)
|
||||
|
||||
|
@ -121,8 +118,7 @@ class OpenCVImageProcessor(ImageProcessingEntity):
|
|||
if name:
|
||||
self._name = name
|
||||
else:
|
||||
self._name = "OpenCV {0}".format(
|
||||
split_entity_id(camera_entity)[1])
|
||||
self._name = "OpenCV {0}".format(split_entity_id(camera_entity)[1])
|
||||
self._classifiers = classifiers
|
||||
self._matches = {}
|
||||
self._total_matches = 0
|
||||
|
@ -157,8 +153,8 @@ class OpenCVImageProcessor(ImageProcessingEntity):
|
|||
import numpy
|
||||
|
||||
# pylint: disable=no-member
|
||||
cv_image = cv2.imdecode(numpy.asarray(bytearray(image)),
|
||||
cv2.IMREAD_UNCHANGED)
|
||||
cv_image = cv2.imdecode(
|
||||
numpy.asarray(bytearray(image)), cv2.IMREAD_UNCHANGED)
|
||||
|
||||
for name, classifier in self._classifiers.items():
|
||||
scale = DEFAULT_SCALE
|
||||
|
|
|
@ -508,7 +508,7 @@ nuheat==0.3.0
|
|||
|
||||
# homeassistant.components.binary_sensor.trend
|
||||
# homeassistant.components.image_processing.opencv
|
||||
numpy==1.13.3
|
||||
numpy==1.14.0
|
||||
|
||||
# homeassistant.components.google
|
||||
oauth2client==4.0.0
|
||||
|
|
|
@ -94,7 +94,7 @@ mficlient==0.3.0
|
|||
|
||||
# homeassistant.components.binary_sensor.trend
|
||||
# homeassistant.components.image_processing.opencv
|
||||
numpy==1.13.3
|
||||
numpy==1.14.0
|
||||
|
||||
# homeassistant.components.mqtt
|
||||
# homeassistant.components.shiftr
|
||||
|
|
Loading…
Add table
Reference in a new issue