From 7496fc1979b7d8c4300ba2a795a0d2fe318b5bc4 Mon Sep 17 00:00:00 2001 From: kds69 <75844627+kds69@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:34:19 +0100 Subject: [PATCH] Fix Update coordinator.py Fix to https://github.com/kvj/hass_openwrt/issues/36#issue-2674941522 --- custom_components/openwrt/coordinator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/openwrt/coordinator.py b/custom_components/openwrt/coordinator.py index 92cc94c..504947c 100644 --- a/custom_components/openwrt/coordinator.py +++ b/custom_components/openwrt/coordinator.py @@ -167,7 +167,10 @@ async def do_file_exec(self, command: str, params, env: dict, extra: dict): result = await self._ubus.api_call( "file", "exec", - dict(command=command, params=params, env=env) + if env !={}: + dict(command=command, params=params, env=env) + else: + dict(command=command, params=params) ) _LOGGER.debug(f"Execute result: {self._id}: {result}") self._coordinator.hass.bus.async_fire( @@ -326,4 +329,4 @@ def new_coordinator(hass, config: dict, all_devices: dict) -> DeviceCoordinator: _LOGGER.debug(f"new_coordinator: {config}, {all_devices}") connection = new_ubus_client(hass, config) device = DeviceCoordinator(hass, config, connection, all_devices) - return device \ No newline at end of file + return device