From 477b60bb4981571b211cd9fe3ebb1fa30f204ef4 Mon Sep 17 00:00:00 2001 From: Alberto Geniola Date: Sun, 9 Feb 2020 22:29:48 +0100 Subject: [PATCH] - General Refactor --- custom_components/meross_cloud/light.py | 1 - custom_components/meross_cloud/switch.py | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/custom_components/meross_cloud/light.py b/custom_components/meross_cloud/light.py index 6c80de4ca2..ac6bbd0846 100644 --- a/custom_components/meross_cloud/light.py +++ b/custom_components/meross_cloud/light.py @@ -99,7 +99,6 @@ def hs_color(self): if self._state.get('capacity') == 5: # rgb mode rgb = rgb_int_to_tuple(self._state.get('rgb')) - _LOGGER.info("rgb: %s" % str(rgb)) return color_util.color_RGB_to_hs(*rgb) return None diff --git a/custom_components/meross_cloud/switch.py b/custom_components/meross_cloud/switch.py index a65a9aa834..eddfbd704c 100644 --- a/custom_components/meross_cloud/switch.py +++ b/custom_components/meross_cloud/switch.py @@ -12,22 +12,22 @@ class SwitchEntityWrapper(SwitchDevice, AbstractMerossEntityWrapper): """Wrapper class to adapt the Meross switches into the Homeassistant platform""" def __init__(self, device: GenericPlug, channel: int): - super().__init__(device) - - # Device properties - self._channel_id = channel - self._device_id = device.uuid - self._device_name = device.name - # If the current device has more than 1 channel, we need to setup the device name and id accordingly if len(device.get_channels()) > 1: - self._id = calculate_switch_id(self._device.uuid, channel) + self._id = calculate_switch_id(device.uuid, channel) channelData = device.get_channels()[channel] self._entity_name = "{} - {}".format(device.name, channelData.get('devName', 'Main Switch')) else: self._id = device.uuid self._entity_name = device.name + super().__init__(device) + + # Device properties + self._channel_id = channel + self._device_id = device.uuid + self._device_name = device.name + # Device specific state self._is_on = None if self._is_online: