Use _attr_should_poll in camera entities (#77173)

This commit is contained in:
epenet 2022-08-22 20:30:35 +02:00 committed by GitHub
parent 03ed552ca9
commit df5f6bdfc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 38 deletions

View file

@ -36,6 +36,8 @@ def setup_platform(
class ZoneMinderCamera(MjpegCamera):
"""Representation of a ZoneMinder Monitor Stream."""
_attr_should_poll = True # Cameras default to False
def __init__(self, monitor, verify_ssl):
"""Initialize as a subclass of MjpegCamera."""
super().__init__(
@ -48,11 +50,6 @@ class ZoneMinderCamera(MjpegCamera):
self._is_available = None
self._monitor = monitor
@property
def should_poll(self):
"""Update the recording state periodically."""
return True
def update(self):
"""Update our recording state from the ZM API."""
_LOGGER.debug("Updating camera state for monitor %i", self._monitor.id)