Add control of Amcrest indicator light (#23986)
Enable feature by default but allow it to be disabled by "control_light: false" in config. Get brand from camera instead of assuming Amcrest (since this works with other cameras, too.) Retrieve RTSP URL in update method instead of in stream_source property and in handle_async_mjpeg_stream method. Move amcrest imports from methods to global.
This commit is contained in:
parent
3c1cdecb88
commit
d966e0cfce
3 changed files with 45 additions and 30 deletions
|
@ -2,6 +2,8 @@
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from amcrest import AmcrestError
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDevice, DEVICE_CLASS_MOTION)
|
||||
from homeassistant.const import CONF_NAME, CONF_BINARY_SENSORS
|
||||
|
@ -58,8 +60,6 @@ class AmcrestBinarySensor(BinarySensorDevice):
|
|||
|
||||
def update(self):
|
||||
"""Update entity."""
|
||||
from amcrest import AmcrestError
|
||||
|
||||
_LOGGER.debug('Pulling data from %s binary sensor', self._name)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue