mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Add optional rtsp_port for Foscam (#22786)
* add optional rtsp port for config * getting rid of default=None * removing vol.Any
This commit is contained in:
parent
192ed90773
commit
2b490e4486
@ -14,6 +14,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
REQUIREMENTS = ['libpyfoscam==1.0']
|
REQUIREMENTS = ['libpyfoscam==1.0']
|
||||||
|
|
||||||
CONF_IP = 'ip'
|
CONF_IP = 'ip'
|
||||||
|
CONF_RTSP_PORT = 'rtsp_port'
|
||||||
|
|
||||||
DEFAULT_NAME = 'Foscam Camera'
|
DEFAULT_NAME = 'Foscam Camera'
|
||||||
DEFAULT_PORT = 88
|
DEFAULT_PORT = 88
|
||||||
@ -26,6 +27,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
vol.Required(CONF_USERNAME): cv.string,
|
vol.Required(CONF_USERNAME): cv.string,
|
||||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||||
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
|
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
|
||||||
|
vol.Optional(CONF_RTSP_PORT): cv.port
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +55,8 @@ 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._rtsp_port = None
|
self._rtsp_port = device_info.get(CONF_RTSP_PORT)
|
||||||
|
if not self._rtsp_port:
|
||||||
result, response = self._foscam_session.get_port_info()
|
result, response = self._foscam_session.get_port_info()
|
||||||
if result == 0:
|
if result == 0:
|
||||||
self._rtsp_port = response.get('rtspPort') or \
|
self._rtsp_port = response.get('rtspPort') or \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user