python-swidget 1.4.12__tar.gz → 1.4.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-swidget
3
- Version: 1.4.12
3
+ Version: 1.4.13
4
4
  Summary: Python API for Swidget smart devices
5
5
  Home-page: https://github.com/swidget/python-swidget
6
6
  License: GPL-3.0-or-later
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-swidget"
3
- version = "1.4.12"
3
+ version = "1.4.13"
4
4
  description = "Python API for Swidget smart devices"
5
5
  license = "GPL-3.0-or-later"
6
6
  authors = ["Swidget"]
@@ -924,6 +924,26 @@ class SwidgetDevice:
924
924
  {"insert": {"components": {"video": {"rtsp": {"enable": bool(enabled)}}}}}
925
925
  )
926
926
 
927
+ @property
928
+ def rtsp_stream_source(self) -> Optional[str]:
929
+ """Return the device's RTSP URL, or None when unavailable.
930
+
931
+ Path ``/ph264`` is fixed by firmware; the port comes from device
932
+ config. None if RTSP is disabled, the insert isn't video, or the
933
+ config hasn't been loaded yet.
934
+ """
935
+ if self.rtsp_enabled is not True:
936
+ return None
937
+ try:
938
+ port = int(
939
+ self.device_config.config["insert"]["components"]["video"]["rtsp"][
940
+ "port"
941
+ ]
942
+ )
943
+ except (KeyError, TypeError, ValueError):
944
+ return None
945
+ return f"rtsp://{self.ip_address}:{port}/ph264"
946
+
927
947
  async def __aenter__(self) -> "SwidgetDevice":
928
948
  """Initialize and connect the Swidget Websocket client."""
929
949
  await self.connect()