diff --git a/custom_components/webrtc/__init__.py b/custom_components/webrtc/__init__.py index f084e2a..5d1c11b 100644 --- a/custom_components/webrtc/__init__.py +++ b/custom_components/webrtc/__init__.py @@ -134,7 +134,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): if not binary: return False - hass.data[DOMAIN] = server = Server(binary) + hass.data[DOMAIN] = server = Server(binary, hass.config.config_dir) server.start() hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, server.stop) diff --git a/custom_components/webrtc/utils.py b/custom_components/webrtc/utils.py index b6a1e7a..a3f7205 100644 --- a/custom_components/webrtc/utils.py +++ b/custom_components/webrtc/utils.py @@ -244,9 +244,9 @@ class Server(Thread): return self.process.poll() is None if self.process else False def run(self): - env = None + env = os.environ.copy() if self.config_dir: - env = {**__import__("os").environ, "CONFIG": self.config_dir + "/go2rtc.yaml"} + env["CONFIG"] = self.config_dir + "/go2rtc.yaml" while self.binary: self.process = subprocess.Popen( [self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env