Tradfri lighting dimming and groups

Hi,

I’ve set up the Tradfri integration and can see my two lightbulbs. In the Tradfri app on my phone, I can see these two bulbs as a group, so I can control them together.

Is it possible to set up homeassistant to allow me to control these lights as a group and also allow dimming and colour temperature?

Thanks, Matt

It’s currently not possible. The Tradfri integration is work in progress. Support for groups was added to the underlying library and I would expect that it will be added soon to HA’s integration.

1 Like

If what you’re referring to is having a group in HASS to turn all the lights on and off, color temp and brightness changes, it is possible. I have it on my config.

I have a group called LivingRoomLights:


In my groups.yaml:

LivingRoomLights:
  - light.googlelamp
  - light.couch_right
  - light.couch_left

Since installing the Tradfri configuration, I had no issues putting them in my already established group and living room view card. As you can see, I can turn all of them on and off, change the brightness and the color. I hope this is what you’re looking for.

1 Like

Thank you 355iguy for the images. That screen cap has me about 95% sure I’m getting these Tradfri lights.

Does anyone know if there’s a limit to the number of bulbs you can sync up to the Tradfri hub? I see the proprietary Tradfri remote controls up to 10 in one group. I’m interested in 15 bulbs scripted independently to dim and change white-spectrum colortemp in different rooms throughout the day via HASS.

And while I’m at it, what happens when you turn their power off/on with the traditional light switch connected to their circuit?

I’m sure you can get more than 10. I think the limit is just 10 per group, with unlimited groups. I plan on getting more myself. I only have 3 for my living room, but plan on getting another 3 for my master bedroom and a couple more for various areas.

Just updating this thread now that I know more.

My current setup

Details

  • The Remotes must pair to the Gateway first (each remote shows up as a software group inside the Tradfri smartphone app). Then each remote can pair to bulbs around the house (each bulb then shows up inside a remote’s group in the Tradfri smartphone app).

  • When new lightbulbs are detected by the smartphone app (after having been paired by a Remote), they are auto-added into a Tradfri Remote’s group. You can make a new group, that doesn’t have a Remote attached, and move lightbulbs over to that group. I’ve added more than 12 bulbs to one group and had eveyrthing controllable by one remote.

    • Important notes: I haven’t fully tested whether more than 10 bulbs will pair using just one remote, but there shouldn’t be any problems.
      • I first added all 15 bulbs using one remote. I had some HASS programming weirdness that I think was my own fault / user error. I reset everything, then re-added bulbs using two remotes.
      • I eventually figured out the code errors and got stuff working, so I deleted one remote from my setup and everything still worked.
  • The lightbulbs get a default naming convention when they’re first detected, but you can rename lightbulbs and groups inside the smartphone app. These user-defined lightbulb names and group names get detected by HASS as the user-defined names (default 1 --renamed-> Kitchen Light 1 gets detected by HASS as light.kitchen_light_1) (group 1 --renamed-> Kitchen gets detected by HASS as light.kitchen and is treated light a single light-bulb in HASS). Both the individual lightbulbs and the groups get detected by HASS, so HASS will let you control a whole light fixture and/or just its individual bulbs if you like.

  • The bulbs get really hot inside the fixtures - I need oven mits to handle them after they’ve been on a while. I haven’t had one burn anything or burn up.

  • Lights must be grouped together in the Tradfri smartphone app first to come on all at once at the same time when asked to by HASS, otherwise they will come on in quick sequence.

    • For example: Let’s say we have three light fixtures, which each contain four lightbulbs.
      • If we group each fixture’s lightbulbs together in the Tradfri smartphone app as “Fixture 1”, “Fixture 2”, “Fixture 3”, then write a script in HASS to turn on fixture_1, fixture_2, fixture_3 all at once: There will be a slight delay between each fixture turning when the HASS script is run.
      • Similarly, we have a HASS script turn on all the individual bulbs in the house ‘at once’ then you will see each bulb quickly turn on in sequence until all bulbs are on in the house. It’s very quick and subtle, but a cosmetic thing that I think is worth mentioning.
      • If we instead group all the lightbulbs from all three light fixtures together inside the Tradfri smartphone app as a group called Livingroom, then have HASS turn on “Livingroom,” then all of the lightbulbs will turn on/off at EXACTLY the same time. (If we have HASS turn on individual lightbulbs from this group in a script though, we won’t get everything on/off exactly anymore - it will be a sequence again).
    • THUS: To have full control of the house lighting (truly sync’d on/off for all lights option, but also individual light bulb control) you’ll have to define every bulb in a house zone inside of one large Tradfri smartphone app group, then have HASS turn that smartphone/Tradfri group on/off. You can then also still make HASS groups of individual lightbulbs to turn on/off clusters of bulbs inside those same fixtures.
    • To add to the confusion, currently (HASS 0.50.1) it seems that the Tradfri smartphone app groups don’t have color temp control (they do have dimming), but the same individual lightbulbs defined in HASS do have color temp control (and also dimming).
      • Another option: You can make a HASS group of HASS groups of lights (HASS groups of individual lights, all inside a HASS group): This will turn on/off in sequence (not exactly on/off at the same time), but will also give you color temp and dimming control.

Current favorite functionality

  • Dimming to off when media plays on Kodi. Then having lights come up at the end of the movie, while Chromecast Audio’s start playing music from an internet radio stream.
2 Likes

Thanks for this comprehensive summary on the group handling. However, since I reset my gateway and added it again to HASS, my groups are not reliably turn on. I described it here:

Does someone has an idea how to further debug this?

I’ve had some spotty on/off behavior too since a few versions back. My lights work fine though if I don’t try to flick on/off lights repeatedly very quickly. Here’s my code in case it helps:

##Tradfri-related code only from my configuration.yaml .  I believe that the Tradfri light's names were defined in the Ikea gateway/software (phone app).  I couldn't remember if the bulbs' names were defined in my config file, but I don't believe they are (this is all the lightbulb code I could find).

tradfri:
  # Tradfri software setup depends on the Tradfri iPhone/Android app to identify new remotes and lights.  HomeAssistant imports the iPhone/Android app's identities.
  # As far as I know, at least one Tradfri remote is required to set up the light/gateway/app system.  Follow on-screen instructions in the iPhone/Android app.
  host: 192.168.1.15
  allow_tradfri_groups: true

####SWITCHES
switch:
  # Controls color temperature of lights in the house for circadian rhythms (similar to f.lux for computer, or nightshift of iPhone)
  #   https://home-assistant.io/components/switch.flux/
  - platform: flux
    lights:
#      - light.kitchen
#      - light.livingroom
#      - light.bedroom
#      - light.bathroom
      - light.livingroom_1
      - light.livingroom_2
      - light.livingroom_3
      - light.livingroom_4
      - light.kitchen_1
      - light.kitchen_2
      - light.kitchen_table_1
      - light.kitchen_table_2
      - light.hallway
      - light.bedroom_1
      - light.bedroom_2
      - light.bathroom_1
      - light.bathroom_2
      - light.bathroom_3
      - light.bathroom_4
    name: Fluxer
    start_time: '6:00'
    stop_time: '21:30'
    start_colortemp: 5000
    sunset_colortemp: 3500
    stop_colortemp: 2300
    mode: mired
    
####GROUPS
group:
  livingroom_lights:
    name: Livingroom
    entities:
      - light.livingroom_1
      - light.livingroom_2
      - light.livingroom_3
      - light.livingroom_4
  kitchen_lights:
    name: Kitchen
    entities:
      - light.kitchen_1
      - light.kitchen_2
  kitchen_table_lights:
    name: Kitchen Table
    entities:
      - light.kitchen_table_1
      - light.kitchen_table_2
  bedroom_lights:
    name: Bedroom
    entities:
      - light.bedroom_1
      - light.bedroom_2
  bathroom_lights:
    name: Bathroom
    entities:
      - light.bathroom_1
      - light.bathroom_2
      - light.bathroom_3
      - light.bathroom_4

  #HASS only allows manual color temp control (with manual brightness control) if the individual Tradrfi bulbs are grouped together by HASS.  However, bulbs will not turn on/off in synchrony when turned off as a group this way.
  color_temperature:
    name: Brightness / Temperature
    entities:
      - group.livingroom_lights
      - group.kitchen_lights
      - group.kitchen_table_lights
      - light.hallway
      - group.bathroom_lights
      - group.bedroom_lights

  #Using the Tradfri gateway's groups only enables manual brightness control in HASS (no manual color temp control per group).  However, bulbs WILL turn on/off in synchrony when turned off as a group this way -- looks slightly more aesthetically pleasing.
  tradfri_lights:
    name: Lights
    entities:
      - light.livingroom
      - light.kitchen
      - light.bedroom
      - light.bathroom

####VIEWS
  lights_view:
    view: yes
    name: LUX
    entities:
      - switch.fluxer
      - switch.porch_light
      - group.color_temperature
      - group.tradfri_lights

My “LUX” view/tab:

HASS only allows manual color temp control (with brightness control) if the individual Tradrfi bulbs are grouped together by HASS. However, bulbs will not turn on/off in synchrony when turned off as a group this way:

Using the Tradfri gateway’s groups only enables manual brightness control in HASS (no manual color temp control per group). However, bulbs WILL turn on/off in synchrony when turned off as a group this way – looks slightly more aesthetically pleasing:

Control of brightness/temp or choosing an Ikea Software group vs HASS software group to shut off / on is no issue using scripts.

2 Likes

Could you give an example of how to set color temp of a IKEA software group using a script? I can’t seem to get it working with a scene that looks like this

- id: '1611350719667'
  name: Relaxation nation
  entities:
    light.living_room:
      brightness: 1
      color_temp: 454
      supported_features: 35
      state: 'on'

where light.living_room is an IKEA software group