albertogeniola / meross-homeassistant

Custom component that leverages the Meross IoT library to integrate with Homeassistant
MIT License
687 stars 76 forks source link

Constantly failing requiring reboot of Meross Cloud #473

Open wizardofozzie opened 7 months ago

wizardofozzie commented 7 months ago

Describe the bug After a short amount of time, automations don't work which include Meross lights using this Integration. Invariably, all Meross devices will have the Red error icon until I restart HA.

Log reads

Logger: homeassistant.components.light
Source: helpers/entity_platform.py:367
Integration: Light ([documentation](https://www.home-assistant.io/integrations/light), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+light%22))
First occurred: 7:29:56 PM (1 occurrences)
Last logged: 7:29:56 PM

Error while setting up meross_cloud platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1005, in state_attributes
    color_mode = self._light_internal_color_mode if self.is_on else None
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 838, in _light_internal_color_mode
    if ColorMode.HS in supported and self.hs_color is not None:
                                     ^^^^^^^^^^^^^
  File "/config/custom_components/meross_cloud/light.py", line 100, in hs_color
    return color_util.color_RGB_to_hs(*rgb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.util.color.color_RGB_to_hs() argument after * must be an iterable, not NoneType

Your environment HomeAssistant version: -- 2023.11.2 -- Hassio Version (if applicable): -- PLEASE SPECIFY -- Hardware environment: -- Raspberry Pi 4B 4Gb --

Logs taken when the issue happened

--- PASTE LOGS HERE ---
davecowell commented 5 months ago

I am also having the same issue - did you manage to get a response anywhere?