custom_components/webrtc/utils.py

This commit is contained in:
Home Assistant Version Control
2026-07-29 17:01:31 +00:00
parent 62eefe88c0
commit 0bca647dff
+6 -2
View File
@@ -233,9 +233,10 @@ async def websocket_forward(ws_from, ws_to) -> None:
class Server(Thread):
def __init__(self, binary: str):
def __init__(self, binary: str, config_dir: str = ""):
super().__init__(name=DOMAIN, daemon=True)
self.binary = binary
self.config_dir = config_dir
self.process = None
@property
@@ -243,9 +244,12 @@ class Server(Thread):
return self.process.poll() is None if self.process else False
def run(self):
env = None
if self.config_dir:
env = {**__import__("os").environ, "CONFIG": self.config_dir + "/go2rtc.yaml"}
while self.binary:
self.process = subprocess.Popen(
[self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
[self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env
)
# check alive