I'm trying to increment/decrement one of the rgb values for a light. The use case is I have a standard 44 key IR remote made for controlling lights. It has Inc/Dec buttons for each color. I'd like to be able to use those to fine tune the light's color from the remote.
I thought a script might be a good way to go so here's my attempt at adding 10 to the current red value from an rgbww bulb. Unfortunately it doesn't do anything. Am I close?
alias: Increase Livingroom Red
fields:
entity_id:
name: athom_rgbww_light_9980ba_rgbcw_bulb
required: true
selector:
entity:
domain: light
sequence:
- variables:
current_state: '{{ states(athom_rgbww_light_9980ba_rgbcw_bulb) }}'
current_rgbww: '{{ state_attr(athom_rgbww_light_9980ba_rgbcw_bulb, ''rgb_color'')
| default([0, 255, 255, 0, 255]) }}'
current_r: '{{ current_rgbww[0] }}'
new_r: '{{ ([current_r + 10, 255]) | min }}'
new_rgbww: '[{{ new_r }}, {{ current_rgbww[1] }}, {{ current_rgbww[2] }}, {{
current_rgbww[3] }}, {{ current_rgbww[4] }}]'
- target:
entity_id: '{{ athom_rgbww_light_9980ba_rgbcw_bulb }}'
data:
rgbww_color: '{{ new_rgbww }}'
action: light.turn_on```