From 9f795e9aec01ba4b74c809a83f0924e3dabe29f7 Mon Sep 17 00:00:00 2001 From: Sanjoy Ghosh Date: Wed, 28 Feb 2024 20:37:00 +0530 Subject: [PATCH] Bug Fix --- custom_components/dirigera_platform/__init__.py | 10 +++++----- custom_components/dirigera_platform/binary_sensor.py | 5 ++--- custom_components/dirigera_platform/cover.py | 3 +-- custom_components/dirigera_platform/light.py | 3 +-- custom_components/dirigera_platform/switch.py | 3 +-- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/custom_components/dirigera_platform/__init__.py b/custom_components/dirigera_platform/__init__.py index 0985920..0ae291c 100644 --- a/custom_components/dirigera_platform/__init__.py +++ b/custom_components/dirigera_platform/__init__.py @@ -71,11 +71,11 @@ async def async_setup_entry(hass: core.HomeAssistant, entry: config_entries.Conf hass.data[DOMAIN][entry.entry_id] = hass_data # Setup the entities - #hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "light")) - #hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "switch")) - #hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "binary_sensor")) - #hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "sensor")) - #hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "cover")) + hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "light")) + hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "switch")) + hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "binary_sensor")) + hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "sensor")) + hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "cover")) hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "fan")) logger.debug("Complete async_setup_entry...") diff --git a/custom_components/dirigera_platform/binary_sensor.py b/custom_components/dirigera_platform/binary_sensor.py index cb5d695..c580789 100644 --- a/custom_components/dirigera_platform/binary_sensor.py +++ b/custom_components/dirigera_platform/binary_sensor.py @@ -33,13 +33,12 @@ async def async_setup_entry( if config[CONF_IP_ADDRESS] == "mock": logger.warning("Setting up mock motion sensors") mock_motion_sensor1 = ikea_motion_sensor_mock() - mock_motion_sensor2 = ikea_motion_sensor_mock() - motion_sensors = [mock_motion_sensor1,mock_motion_sensor2] + motion_sensors = [mock_motion_sensor1] logger.warning("Setting up mock open/close sensors") mock_open_close_sensor1 = ikea_open_close_mock() mock_open_close_sensor2 = ikea_open_close_mock() - open_close_sensors = [mock_open_close_sensor1,mock_open_close_sensor2] + open_close_sensors = [mock_open_close_sensor1] else: hub_motion_sensors = await hass.async_add_executor_job(hub.get_motion_sensors) diff --git a/custom_components/dirigera_platform/cover.py b/custom_components/dirigera_platform/cover.py index 773bacb..14859f9 100644 --- a/custom_components/dirigera_platform/cover.py +++ b/custom_components/dirigera_platform/cover.py @@ -26,8 +26,7 @@ async def async_setup_entry(hass: core.HomeAssistant, config_entry: config_entri if config[CONF_IP_ADDRESS] == "mock": logger.warning("Setting up mock blinds...") mock_blind1 = ikea_blinds_mock(hub,"mock_blind1") - mock_blind2 = ikea_blinds_mock(hub,"mock_blind2") - blinds = [mock_blind1,mock_blind2] + blinds = [mock_blind1] else: hub_blinds = await hass.async_add_executor_job(hub.get_blinds) blinds = [ikea_blinds(hub, blind) for blind in hub_blinds] diff --git a/custom_components/dirigera_platform/light.py b/custom_components/dirigera_platform/light.py index d2a3b0b..754b01a 100644 --- a/custom_components/dirigera_platform/light.py +++ b/custom_components/dirigera_platform/light.py @@ -39,8 +39,7 @@ async def async_setup_entry( if config[CONF_IP_ADDRESS] == "mock": logger.warning("Setting up mock bulbs") mock_bulb1 = ikea_bulb_mock() - mock_bulb2 = ikea_bulb_mock() - lights = [mock_bulb1,mock_bulb2] + lights = [mock_bulb1] else: hub_lights = await hass.async_add_executor_job(hub.get_lights) lights = [ikea_bulb(hub, light) for light in hub_lights] diff --git a/custom_components/dirigera_platform/switch.py b/custom_components/dirigera_platform/switch.py index 019cd9b..53141b4 100644 --- a/custom_components/dirigera_platform/switch.py +++ b/custom_components/dirigera_platform/switch.py @@ -26,8 +26,7 @@ async def async_setup_entry(hass: core.HomeAssistant, config_entry: config_entri if config[CONF_IP_ADDRESS] == "mock": logger.warning("Setting up mock outlets...") mock_outlet1 = ikea_outlet_mock(hub,"mock_outlet1") - mock_outlet2 = ikea_outlet_mock(hub,"mock_outlet2") - outlets = [mock_outlet1,mock_outlet2] + outlets = [mock_outlet1] else: hub_outlets = await hass.async_add_executor_job(hub.get_outlets) outlets = [ikea_outlet(hub, outlet) for outlet in hub_outlets]