Update Vivotek camera component (#26754)

* Update Vivotek camera component

Load model name to instance attribute

* Update Vivotek camera component

Ensure `update` is called when the entity is added.

* Update libpyvivotek to 0.2.2

https://pypi.org/project/libpyvivotek/0.2.2/
- Retrieve camera model name anonymously
- Raise a more helpful error for invalid creds
pull/26836/head
Kevin McCormack 2019-09-22 13:06:02 -07:00 committed by Martin Hjelmare
parent e5f6f33340
commit 2d906b111a
3 changed files with 9 additions and 4 deletions

View File

@ -55,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
config[CONF_IP_ADDRESS],
),
)
add_entities([VivotekCam(**args)])
add_entities([VivotekCam(**args)], True)
class VivotekCam(Camera):
@ -68,6 +68,7 @@ class VivotekCam(Camera):
self._cam = cam
self._frame_interval = 1 / config[CONF_FRAMERATE]
self._motion_detection_enabled = False
self._model_name = None
self._name = config[CONF_NAME]
self._stream_source = stream_source
@ -117,4 +118,8 @@ class VivotekCam(Camera):
@property
def model(self):
"""Return the camera model."""
return self._cam.model_name
return self._model_name
def update(self):
"""Update entity status."""
self._model_name = self._cam.model_name

View File

@ -3,7 +3,7 @@
"name": "Vivotek",
"documentation": "https://www.home-assistant.io/components/vivotek",
"requirements": [
"libpyvivotek==0.2.1"
"libpyvivotek==0.2.2"
],
"dependencies": [],
"codeowners": []

View File

@ -732,7 +732,7 @@ libpurecool==0.5.0
libpyfoscam==1.0
# homeassistant.components.vivotek
libpyvivotek==0.2.1
libpyvivotek==0.2.2
# homeassistant.components.mikrotik
librouteros==2.3.0