Hi everybody,
While writing this, I realized that I need xy_color
instead of rgb_color
. Is there a way to convert rgb_color to xy_color in Home Assistant to automatically “translate” the color values I already have? I searched for a rgb to xy color solution only, but the pages I found want to translate to xyz color, and Home Assistant does not want this z value…
I have created a template sensor to chose a random value from a list of colors; this sensor gets update every 2 minutes. However, when I try setting a light to the sensor’s value, it will not turn on.
What am I doing wrong?
lights/random_color.yaml
sensor:
- platform: template
sensors:
random_color:
friendly_name: "Random Color"
value_template: >
{{ (
[0, 232, 0],
[0, 232, 185],
[131, 0, 232],
[193, 0, 232],
[232, 0, 185],
[255, 111, 67],
[255, 166, 10],
[255, 240, 97],
[152, 255, 61]
) | random}}
automation:
- alias: "Reload Random Color"
trigger:
- platform: time_pattern
minutes: "/2" # alle zwei Minuten
action:
service: homeassistant.update_entity
entity_id: sensor.random_color
lights/bad_oben.yaml
action:
- service: light.turn_on
entity_id: light.zwischenzimmer_aurora_light
data_template:
brightness: 180
rgb_color: "{{ states('sensor.random_color') }}"
The sensor does return a valid value that changes every 2 minutes
…so I assume that my workflow is correct and the only problem is that I need a different color format. Is this correct? And if so, what do you suggest I do?
Thank you for your ideas