Relative Brightness Light Group

Relative Brightness Light Group

Adjust the brightness of a group of lights while maintaining the relative brightness between individual lights! :tada:

When adjusting the brightness of a group using the built-in light group, all the lights within the group would end up getting the same level no matter their previous level. I took a stab trying to fix that once before, but using a template light made it hard to maintain and it hurt reusability.

Now with the power of a custom component that’s built on top of the core light group, it’s as easy as adding just a few lines to your configuration.yaml file :slight_smile:

Installation

HACS

In HACS, add a custom repository:

  • Repostiory: https://github.com/oscarb/relative-brightness-light-group
  • Category: Integration

Then search for Relative brightness light group to find and install it. Set up any lights you wish in your configuration file and restart Home Assistant if necessary.

Manually

  1. Head over to the repository at GitHub, click the Code button and download the files either as a ZIP-file or using git.
  2. From the downloaded files, move the folder that’s inside the custom_components folder into the custom_components folder in your HA config folder.
  3. Restart Home Assistant

Configuration

To use, simply add this to your configuration.yaml file:

light:
  - platform: relative_brightness_light_group
    name: The Office
    entities:
      - light.office_desk
      - light.office_spotlights

Enjoy! :bulb: And let me know how well it works for you or if you have any other thoughts or questions :slight_smile:

2 Likes

Note: Since I changed from using the IKEA Tradfri hub to the Philips Hue bridge, my brightness sliders started showing this “bouncy” behavior where it takes a second before all sliders are in the right place.

However, as far as I can tell this isn’t a problem introduced with my component ('ve seen the same happen with the core light group) so instead there’s something that needs fixing way beyond this component. Fingers crossed that it works better with your setup than in mine :crossed_fingers: :smile:

Nice! Actually I have been waiting for this for a very long time. I will test this as soon as possible. Before, I achieved this using scripts and helpers, which was getting annoying to mantain as soon as the number of lights grew.

I would love to use this, by I cannot find a way. I try
Dashboard → add card → manual (yaml) card
But i only get

„No card type configured“

What am I doing wrong?

Thank you
Juergen

Hi Juergen,

This is not a card for the dashboard but instead a way to create a new light entity.

Once you’ve gotten the files needed into your Home Assistant (either by downloading them or using HACS as mentioned in the first post), then you can add the code you quoted into your configuration.yaml file.

When that is done you can use any card for your dashboard that supports lights, for example the light card or tile, and then reference a new light.the_office that’s been created for you.

However, if you want the same look and feel as in the card I’ve done above, you’ll first need lovelace-slider-entity-row and then you can add a manual card with this YAML to your dashboard:

type: grid
columns: 1
square: false
cards:
  - type: entities
    state_color: true
    title: Office lights
    show_header_toggle: true
    entities:
      - entity: light.the_office
        type: custom:slider-entity-row
        step: 1
        full_row: true
      - entity: light.office_desk
        type: custom:slider-entity-row
        step: 1
        toggle: true
      - entity: light.office_spotlights
        type: custom:slider-entity-row
        step: 1
        toggle: true

Good luck!

Hi Oscar,
I found out, that the manual adding in HACS gives an error, it says: there is a shop entry (or similar) i than searched in HACS and added your system, than the small sample was there, but there was no difference to a groug (still saw this one round slider around a lightbulb). I‘ll just try your suggestion and givea notice, if it worled.
Many thanks
Juergen

Hi Oscar,
I added this to my configuration.yaml

light:
  - platform: relative_brightness_light_group
    name: Gartenlampen
    unique_id: gartenlampen
    entities:
      - light.shellydimmer2_4cebd6edf3a3
      - light.shellydimmer2_4cebd6edf72a

and this to the yaml card:

type: grid
columns: 1
square: false
cards:
  - type: entities
    state_color: true
    title: Gartenlampen
    show_header_toggle: true
    entities:
      - entity: light.shellydimmer2_4cebd6edf3a3
        name: lampe links
        type: custom:slider-entity-row
        step: 1
        full_row: true
      - entity: light.shellydimmer2_4cebd6edf72a
        name: lampe rechts
        type: custom:slider-entity-row
        step: 1
        toggle: true

But only get this:

which turn on both lights with the main switch and the “rechts” light with the correct one, the long slider without a name is the one for the “links”, the on/off on top makes both lamps on and off, the “links” has no on/off. So it works “somehow”, but not as expected. I have absolutely no idea, where to search. I did install “relativ-brightness-light-geoup” and “slider-entity-row” thru the HACS Shop today so I think it should be the newest version.

any ideas?

many thanks
Juergen

The difference from your current setup to mine is that in my card I have included three lights:

  • The first one, the one with the full width, is the group one, the light.the_office for the whole office
  • The second and third one, not full width, are the individual lights in my office, the desk lamp (light.office_desk) and spotlights (light.office_spotlights) respectively.

So then when I change the brightness on the the first one the other two on the card will change too but in a way so that their “relative brightness” to each other is somewhat maintained.

So make sure to add your light.gartenlampen to your card as the first one. If no light.gartenlampen shows up that you can control, you might have to restart HA.

Hi Oscar,
thanks a lot. Now it is working!
Thanks for your patience, I learned a lot.

Juergen

Hello

I have added the integration and added to the config file and restarted.

I assume this creates and entity light.the_office but i cant find it.

Have i missed a step somewhere?

Thanks

Jeremy

Would anyone be able to help please? Its a great utility - i just need it to work!

HI,
after the last update to 2024.5.2 in HA I get the following error:

2024-05-08 07:39:37.705 ERROR (MainThread) [homeassistant.config] Platform error: cover - No module named 'custom_components.relative_brightness_light_group.cover'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1439, in _async_load_and_validate_platform_integration
    platform = await p_integration.integration.async_get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1074, in async_get_platform
    platforms = await self.async_get_platforms((platform_name,))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1151, in async_get_platforms
    import_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1121, in async_get_platforms
    await self.hass.async_add_import_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1064, in _load_platforms
    platform_name: self._load_platform(platform_name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1238, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1270, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 144, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.relative_brightness_light_group.cover'
2024-05-08 07:39:38.142 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hacs' accesses hass.components.frontend. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to import functions used from frontend directly at custom_components/hacs/frontend.py, line 68: hass.components.frontend.async_register_built_in_panel(, please create a bug report at https://github.com/hacs/integration/issues
2024-05-08 07:39:39.256 WARNING (ImportExecutor_0) [homeassistant.helpers.typing] HomeAssistantType was used from dwd_weather, this is a deprecated alias which will be removed in HA Core 2025.5. Use homeassistant.core.HomeAssistant instead, please report it to the author of the 'dwd_weather' custom integration

any ideas?
Juergen

Hi,
I just noticed, that everything seems to work as before. So maybe this error comes from an old configuration I did when testing the system? I see the error, but it works, I do want to remove the error. Any idea, how to debug where it is coming from?

thanks
Juergen

Hmm, I noticed that your logs mentions “cover” at the end of the name of the integration:

custom_components.relative_brightness_light_group.cover

Have you tried using the integration with covers? I only think it will support lights. Or anything else in your configuration.yaml where there might be a conflict with covers and this integration?

Hi,
yes I am very successfully using it with covers :slight_smile: It worked all before the last updates. Now this error occurs. But as I am a total newbie, I do not know if this is a configuration error on my side, or “something” has to be changed in the programming of this extension (I would beg for doing the change.) I see the error, but as far as I see it, it still works with the covers, “only” this python error occurs.
I hope/assum it is something that can be easily fixed.

The frontend config from the dashboard:

type: entities
state_color: true
title: Rolläden
show_header_toggle: false
entities:
  - entity: cover.rolladen
    name: links
    type: custom:slider-entity-row
    step: 1
    full_row: true
    toggle: false
    hide_state: false
    hide_when_off: false
    show_icon: false
    colorize: true
  - entity: cover.l1
    name: L1
    type: custom:slider-entity-row
    step: 1
    toggle: true
  - entity: cover.l2
    name: L2
    type: custom:slider-entity-row
    step: 1
    toggle: true
  - entity: cover.l3
    name: L3
    type: custom:slider-entity-row
    step: 1
    toggle: true
  - entity: cover.l4
    name: L4
    type: custom:slider-entity-row
    step: 1
    toggle: true
  - entity: cover.r1
    name: R1
    type: custom:slider-entity-row
    step: 1
    toggle: true
  - entity: cover.r2
    name: R2
    type: custom:slider-entity-row
    step: 1
    toggle: true
  - entity: cover.r3
    name: R3
    type: custom:slider-entity-row
    step: 1
    toggle: true
  - entity: cover.r4
    name: R4
    type: custom:slider-entity-row
    step: 1
    toggle: true

my configuration.yaml

cover:
  - platform: relative_brightness_light_group
    name: cover
    entities:
      - entity: cover.l1
      - entity: cover.l2
      - entity: cover.l3
      - entity: cover.l4
      - entity: cover.r1
      - entity: cover.r2
      - entity: cover.r3
      - entity: cover.r4

thanks
Juergen