custom_components/webrtc/__init__.py, custom_components/webrtc/utils.py
This commit is contained in:
@@ -134,7 +134,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|||||||
if not binary:
|
if not binary:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
hass.data[DOMAIN] = server = Server(binary)
|
hass.data[DOMAIN] = server = Server(binary, hass.config.config_dir)
|
||||||
server.start()
|
server.start()
|
||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, server.stop)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, server.stop)
|
||||||
|
|||||||
@@ -244,9 +244,9 @@ class Server(Thread):
|
|||||||
return self.process.poll() is None if self.process else False
|
return self.process.poll() is None if self.process else False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
env = None
|
env = os.environ.copy()
|
||||||
if self.config_dir:
|
if self.config_dir:
|
||||||
env = {**__import__("os").environ, "CONFIG": self.config_dir + "/go2rtc.yaml"}
|
env["CONFIG"] = self.config_dir + "/go2rtc.yaml"
|
||||||
while self.binary:
|
while self.binary:
|
||||||
self.process = subprocess.Popen(
|
self.process = subprocess.Popen(
|
||||||
[self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env
|
[self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env
|
||||||
|
|||||||
Reference in New Issue
Block a user