Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for light component (rgb) fails - error in logs #96

Closed
jurgen272 opened this issue Jul 2, 2020 · 5 comments
Closed

Update for light component (rgb) fails - error in logs #96

jurgen272 opened this issue Jul 2, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@jurgen272
Copy link

Describe the bug
RGB light is working correct, but I still have some errors in the loggings.

Errors:

Logboekdetails (ERROR)
Logger: homeassistant.helpers.entity
Source: custom_components/tahoma/light.py:160
First occurred: 8:06:58 (327 occurrences)
Last logged: 10:58:22

Update for light.light_terras_rgb fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
self.update # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/tahoma/light.py", line 160, in update
CORE_BLUE_COLOR_INTENSITY_STATE
TypeError: color_RGB_to_hs() missing 2 required positional arguments: 'iG' and 'iB'

Environment (please complete the following information):

  • Home Assistant version: 0.112.0

Device: (if your problem is related to a specific device)

  • Type: io:DimmableRGBLightIOCompo
@jurgen272 jurgen272 added the bug Something isn't working label Jul 2, 2020
@jurgen272 jurgen272 changed the title Update for light component (rgb) fails Update for light component (rgb) fails - error in logs Jul 2, 2020
@vlebourl
Copy link
Collaborator

vlebourl commented Jul 2, 2020

Hi,
Thanks for the report. Can you edit file light.py (using File Editor add-on for instance) and change line 151 to the end with:

       if CORE_RED_COLOR_INTENSITY_STATE in self.tahoma_device.active_states:
            self._hs_color = color_util.color_RGB_to_hs(
                self.tahoma_device.active_states.get(CORE_RED_COLOR_INTENSITY_STATE),
                self.tahoma_device.active_states.get(CORE_GREEN_COLOR_INTENSITY_STATE),
                self.tahoma_device.active_states.get(CORE_BLUE_COLOR_INTENSITY_STATE),
            )

Restart HA and let me know whether you still get the errors.
Thanks

vlebourl added a commit that referenced this issue Jul 2, 2020
@jurgen272
Copy link
Author

Hi,

I changed:

    if CORE_RED_COLOR_INTENSITY_STATE in self.tahoma_device.active_states:
        self._hs_color = color_util.color_RGB_to_hs(
            [
                self.tahoma_device.active_states.get(
                    CORE_RED_COLOR_INTENSITY_STATE
                ),
                self.tahoma_device.active_states.get(
                    CORE_GREEN_COLOR_INTENSITY_STATE
                ),
                self.tahoma_device.active_states.get(
                    CORE_BLUE_COLOR_INTENSITY_STATE
                ),
            ]
        )

With:

   if CORE_RED_COLOR_INTENSITY_STATE in self.tahoma_device.active_states:
        self._hs_color = color_util.color_RGB_to_hs(
            self.tahoma_device.active_states.get(CORE_RED_COLOR_INTENSITY_STATE),
            self.tahoma_device.active_states.get(CORE_GREEN_COLOR_INTENSITY_STATE),
            self.tahoma_device.active_states.get(CORE_BLUE_COLOR_INTENSITY_STATE),
        )

But get en error in the loggings:

Error setting up entry xxx@xxx for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 220, in async_setup
hass, self
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 280, in async_setup_entry
return await hass.data[DOMAIN].async_setup_entry(entry)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 150, in async_setup_entry
platform_type,
File "/usr/src/homeassistant/homeassistant/setup.py", line 278, in async_prepare_setup_platform
platform = integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 322, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 724, in exec_module
File "", line 860, in get_code
File "", line 791, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/tahoma/light.py", line 150
if CORE_RED_COLOR_INTENSITY_STATE in self.tahoma_device.active_states:
^
IndentationError: unindent does not match any outer indentation level

@vlebourl
Copy link
Collaborator

vlebourl commented Jul 2, 2020

Python is very picky with indentation, github copy and paste might have messed it up... I think the if line is one space too far left. You should have 8 whitespaces before the if, 12 on the next line and 16 on the three lines inside parenthesis.

@jurgen272
Copy link
Author

Indeed, indentation problem.
It is working now without errors.

@vlebourl
Copy link
Collaborator

vlebourl commented Jul 2, 2020

Fixed in 1.5alpha2 by #97

@vlebourl vlebourl closed this as completed Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants