mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Update Foscam stream for newer models (#22744)
* Update Foscam to support stream source * Removing spaces and tabs * Changing to Python3-style string formatting * Adding '_media_port' to hopefully cover other models * changing logic for success and return none * Update Foscam stream for newer models * change if to or
This commit is contained in:
parent
8c657d4254
commit
82a1c0d0e8
@ -53,10 +53,11 @@ class FoscamCam(Camera):
|
|||||||
self._foscam_session = FoscamCamera(
|
self._foscam_session = FoscamCamera(
|
||||||
ip_address, port, self._username, self._password, verbose=False)
|
ip_address, port, self._username, self._password, verbose=False)
|
||||||
|
|
||||||
self._media_port = None
|
self._rtsp_port = None
|
||||||
result, response = self._foscam_session.get_port_info()
|
result, response = self._foscam_session.get_port_info()
|
||||||
if result == 0:
|
if result == 0:
|
||||||
self._media_port = response['mediaPort']
|
self._rtsp_port = response.get('rtspPort') or \
|
||||||
|
response.get('mediaPort')
|
||||||
|
|
||||||
def camera_image(self):
|
def camera_image(self):
|
||||||
"""Return a still image response from the camera."""
|
"""Return a still image response from the camera."""
|
||||||
@ -71,19 +72,19 @@ class FoscamCam(Camera):
|
|||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Return supported features."""
|
"""Return supported features."""
|
||||||
if self._media_port:
|
if self._rtsp_port:
|
||||||
return SUPPORT_STREAM
|
return SUPPORT_STREAM
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stream_source(self):
|
def stream_source(self):
|
||||||
"""Return the stream source."""
|
"""Return the stream source."""
|
||||||
if self._media_port:
|
if self._rtsp_port:
|
||||||
return 'rtsp://{}:{}@{}:{}/videoMain'.format(
|
return 'rtsp://{}:{}@{}:{}/videoMain'.format(
|
||||||
self._username,
|
self._username,
|
||||||
self._password,
|
self._password,
|
||||||
self._foscam_session.host,
|
self._foscam_session.host,
|
||||||
self._media_port)
|
self._rtsp_port)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user