core icon indicating copy to clipboard operation
core copied to clipboard

Light Template Cannot Change Color Mode

Open zolakt opened this issue 2 years ago • 7 comments

The problem

I want to create a template light, which will combine a relay switch (for on/off) and a led controller (for color temperature, brightness, color and effects).

Functionally everything works fine. However, once I try setting a color, the color_mode attribute gets permanently stuck at hs value. So, even when I change just the ww/cw temperature, the light does change the color correctly, but color_mode is still hs, and not color_temp as it should be. This results in the handle on the color temperature slider not being show, so you don't really know what is the current temperature. You can see it while you set it, but then it disappears after you leave it alone. image

The color_mode does change as expected on the original led controller entity, but just not on the light template.

Attributes of the original led controller entity: image

Attributes of the template light entity: image

Expected behaviour: When set_temperature is called, the color_mode attribute should switch to color_temp.

What version of Home Assistant Core has the issue?

core-2023.12.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Template Light

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

Here is my YAML configuration of the whole template light:

office_light_2:
  friendly_name: "Office Light"
  unique_id: "office_light_2"
  value_template: "{{ states('light.office_light') }}"
  availability_template: "{{ states('light.office_light') != 'unavailable' }}"
  level_template: "{{ state_attr('light.office_light_controller', 'brightness') }}"
  min_mireds_template: "{{ state_attr('light.office_light_controller', 'min_mireds') }}"
  max_mireds_template: "{{ state_attr('light.office_light_controller', 'max_mireds') }}"
  temperature_template: "{{ state_attr('light.office_light_controller', 'color_temp') }}"
  hs_template: "{{ state_attr('light.office_light_controller', 'hs_color') }}"
  effect_template: "{{ state_attr('light.office_light_controller', 'effect') }}"
  effect_list_template: "{{ state_attr('light.office_light_controller', 'effect_list') }}"
  turn_on:
    service: light.turn_on
    target:
      entity_id: light.office_light
  turn_off:
    service: light.turn_off
    target:
      entity_id: light.office_light
  set_level:
    service: light.turn_on
    target:
      entity_id: light.office_light_controller
    data:
      brightness: "{{ brightness }}"
  set_temperature:
    service: light.turn_on
    target:
      entity_id: light.office_light_controller
    data:
      color_temp: "{{ color_temp }}"
  set_hs:
    service: light.turn_on
    target:
      entity_id: light.office_light_controller
    data:
      hs_color: "{{ hs }}"
  set_effect:
    service: light.turn_on
    target:
      entity_id: light.office_light_controller
    data:
      effect: "{{ effect }}"


### Anything in the logs that might be useful for us?

_No response_

### Additional information

The issue has been reported here already https://community.home-assistant.io/t/light-template-cannot-change-color-mode/444424

zolakt avatar Dec 17 '23 13:12 zolakt

I have the same issue. In my case I am using a mqtt light that is in xy color_mode.

mrbrdo avatar Mar 03 '24 19:03 mrbrdo

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

This issue still exists. It hasn't been fixed in any update

zolakt avatar Jun 04 '24 05:06 zolakt

I'm also having this issue with the latest 2024.6.1 version. Well, except I'm working with RGB instead of HS. I'm not very familiar with how these get fixed, but I see red crosses with "Review required" and "Merging is blocked". Does this mean it won't get fixed, or is this just normal procedure?

ajpanton avatar Jun 09 '24 02:06 ajpanton

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Same problem

filippopetri avatar Sep 07 '24 14:09 filippopetri

Just bumped on this issue as well, same use case as @zolakt

nanomad avatar Oct 15 '24 21:10 nanomad

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.