Skip to content

Commit

Permalink
- General Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
albertogeniola committed Feb 9, 2020
1 parent 238dfd0 commit 477b60b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion custom_components/meross_cloud/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions custom_components/meross_cloud/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 477b60b

Please sign in to comment.