IKEA Tradfri issue on hass.io v0.57.2

Hi.

I’m having trouble getting a stable control of my IKEA Tradfri lights in HA. It’s been pretty much hit or miss for my automations to turn on the lights (automations are from 0.55). Sometimes they turn on and some times don’t. They on the other hand always turn off.
I have tried with light.turn_on and homeassistant.turn_on with same hit or miss results, no errors in the log.
The gateway was reset when Tradfri forced the firmware update, but since then nothing changed on the gateway, removed the key from configuration and typed it in the frontend.
Does anyone have some ideas? Do I need to reset the gateway again (some work 8+ bulbs) or do I have other options?

Hi @skeptizzle,

Try setting the brightness to 254 (or less) when turning your lights on. The previous gateway firmware supported 255 as the max value.

Hi @epsylon.

Thanks for your reply, much appreciated! The automation (see below) is not hitting max brightness, never has as it is too bright at 255 or 254 even. So this should not be the issue right?
I’m thinking of doing a complete reset of the gateway tomorrow, do you know if i could run into any issues with the new way of configuring the security key in hass.io? And calling the groups and bulbs the same names again?

Thanks again for your reply! :slight_smile:

This turns the light on or up.

- alias: Hallway - Turn up if movement
  trigger:
    - platform: state
      entity_id: binary_sensor.hallway_motion
      to: 'on'
    - platform: state
      entity_id: group.family
      to: 'home'
  condition:
    condition: and 
    conditions:
      - condition: state
        entity_id: group.family
        state: 'home'
      - condition: state
        entity_id: input_boolean.override_hallway
        state: 'off'
  action:
    - service: homeassistant.turn_on
      #THIS IS TRADFRI GATEWAY GROUP WITH TWO PANELS
      entity_id: light.hallway
      data:
        transition: 1
      data_template:
        brightness: >
          {%- if ('sun.sun', 'above_horizon') and now().hour >= 09 and now().hour < 11 %}
          50
          {%- elif ('sun.sun', 'above_horizon') and now().hour >= 11 and now().hour < 13 %}
          130
          {%- elif ('sun.sun', 'above_horizon') and now().hour >= 13 and now().hour < 16 %}
          200
          {%- elif ('sun.sun', 'above_horizon') and now().hour >= 16 and now().hour < 18 %}
          130
          {%- elif ('sun.sun', 'above_horizon') and now().hour >= 18 and now().hour < 20 %}
          50
          {%- else %}
          1
          {% endif %}

This turns the light down again. Turn off is third different automation.

- alias: Hallway - Turn down if no movement
  trigger:
    - platform: state
      entity_id: binary_sensor.hallway_motion
      to: 'off'
      for:
        seconds: 15
  condition:
    condition: and 
    conditions:
      - condition: state
        entity_id: group.family
        state: 'home'
      - condition: state
        entity_id: input_boolean.override_hallway
        state: 'off'
  action:
    - service: homeassistant.turn_on
      #THIS IS TRADFRI GATEWAY GROUP WITH TWO PANELS
      entity_id: light.hallway 
      data:
        brightness: 1
        transition: 7

I’ve not seen both data: and data_template: declarations in the same service before; it’s usually one or the other. Maybe try removing the data:?

I see but it has been working fine, and works fine when the light is already on. I will try and removing data: from the automation later today and report back.
Although i have another automation for another Tradfri group of bulbs that look like this, and this is not working (the hallway one is more hit or miss). I tried using both homeassistant.turn_on and light.turn_on, again xxx.turn_off works fine everytime.

Thanks again for your ideas @epsylon !

- alias: Livingroom - Turn on Tripod when TV turns on
  trigger:
    - platform: state
      entity_id: media_player.livingroom_tv
      to: 'on'
  condition:
    - condition: template 
      value_template: '{{ states.sun.sun.attributes.elevation < 0 }}'
  action: 
    - service: homeassistant.turn_on 
      #THIS IS TRADFRI GATEWAY GROUP WITH THREE BULBS
      entity_id: light.livingroom_tripod
      data:
        brightness: 180
        transition: 900

Hi,

Just an update on my problem. It seems that it has something to do with me trying to turn on tradfri gateway groups, when i turn on individual lights/bulbs it works fine, all the time. So i guess i have to live with the delay turning on the three bulbs i have in one fixture unless i can group them as a light which i haven’t tried yet…
It has nothing to do with me mixing data: and data_template: in the same automation.

TL;DR

This works sometimes:

action:
  - service: light.turn_on
    #THIS IS TRADFRI GATEWAY GROUP WITH TWO PANELS
    entity_id: light.hallway
    data:
      brightness: 250
      transition: 7

This works all the time:

action:
  - service: light.turn_on
    #THIS IS INDIVIDUAL TRADFRI PANELS
    entity_id: 
      - light.hallway_panel_1
      - light.hallway_panel_2
    data:
      brightness: 250
      transition: 7
1 Like