Grouped light control

At the time of writing my script, Home Assistant does not make a single API call to Hue group(s), so this is why I wrote a script that can do that for me. If you group 5 lights into a single switch or a single color wheel, for example, Home Assistant will have to make multiple API calls to Hue bridge. If you have 10 lights in one group, that’s 10 API calls and you will see the lights turn on one by one until every light is on. That’s where my script comes in.

This is very very interesting!
I have a set of IKEA Trådfri spotlight GU10 that are on a wall switch. The wall switch is z-wave enabled so I can control both lights and switch entities.
I want to group all lights (3 of them) and the switch in a new light entity so that when the switch is manually activated this light is turned on/off and vice and versa the light object in HA being toggled on/off.
I have played around with the template light component in HA so far and it works but it lacks color temperature support. I can also solve it using automation, but in my experience it sometimes introduce lags and the template light had better response time.

My idea would be to re-use this script to start with and improve it to be able to specify a switch entity to monitor the on/off status from. However I am completely ignorant in python and don’t know how to that… can someone maybe point me to head start on the very code on the Git repo and I can try to figure out the rest? Won’t need a Python for dummies! :wink:

This works great for what I’m trying to do, but I’m running in to one issue. The lights always come on at 100% brightness, and white. I’ve even notice they will flicker to white when I’ve specified a color. This is my light setup:

light:
  • platform: flux_led
    devices:
    192.168.40.8:
    name: Master Ceiling Bulb 1
    mode: “rgbw”
    192.168.40.73:
    name: Master Ceiling Bulb 2
    mode: “rgbw”
  • platform: grouped_light
    name: Master Light
    entities:
    • light.master_ceiling_bulb_1
    • light.master_ceiling_bulb_2

Any thoughts on this?

You’re referring to sending states to the lights, right? In that case I can’t think of any scenario where the grouped light could cause this. It’s then much more probably to be related to the flux_led platform (but I can’t test that, since I have no such lights).

Light groups will be added to Home Assistant in the next release, but to investigate your issue you could try using a normal group: definition. Sending light/turn_on to a “normal” group should do the more or less exactly the same as light groups.

group:
  master_light:
    name: Master Light
    entities:
      - light.master_ceiling_bulb_1
      - light.master_ceiling_bulb_2

Does anybody has intentions to build an custom component for grouped movtion-sensors? I am not able to build some by my self :frowning:

I am a non-coder but i think that this should not be a big thing? No big values, just “on” and “off”? Or am i wrong?

By the way: Why not pushing this awesome component to the official HASS-repos?

@uniquenospaces Why don’t you use template binary_sensor with device_class: motion?

binary_sensor:
  - platform: template
    sensors:
      motion_salon:
       value_template: >-
          {{ is_state('binary_sensor.motion_salon_1', 'on')
             or is_state('binary_sensor.motion_salon_2', 'on') }}

Seems to be having an issue with this component now since upgrading hassio.
Platform not found: light.grouped_light
Anybody else?

same here on hassbian 0.68.1. How to solve this?

check, full example here:

motion_in_hq:
  friendly_name: 'Motion in Headquarters'
  device_class: motion
  value_template: >
    {% if is_state("sensor.corridor_motion_sensor", "on")
        or is_state("sensor.auditorium_motion_sensor", "on")
        or is_state("sensor.dining_table_motion_sensor", "on")
        or is_state("sensor.frontdoor_motion_sensor", "on")
        or is_state("sensor.dorm_motion_sensor", "on")
        or is_state("sensor.master_bedroom_motion_sensor", "on")
          %}
      True
    {% else %}
      False
    {% endif %}

with a little customization:

binary_sensor.motion_in_hq:
  show_last_changed: true
  templates:
    icon_color: "if (state === 'on') return 'rgb(192, 39, 30)'; else return 'rgb(54, 95, 140)';"
    icon: "if (state === 'on') return 'mdi:run-fast';
                            else return 'mdi:home-alert';"
    _stateDisplay: if (state === 'on') return 'Alert'; else return 'Clear';

Light groups were integrated into the core Home Assistant code a while ago. While doing that, it was decided to call the platform group. So you need to initialize the light like this:

light:
  - platform: group
    name: ...
    entities:
      - light.a
      - light.b
1 Like