Condition template getting hue color_temp

I am scratching my head here and can’t quite get the correct syntax to get the color_temp of the hue light.
I’ve double check and the current color_temp while testing is ‘346’.

But the test would give me condition fail if I have ‘= 346’ outside of the curly braces.
If I put ‘=346’ inside the curly brace, I get a syntax error.

My use case is “if light is in this color, then change it to different color, otherwise do something else.”

condition: template
value_template: "{{ state_attr('light.hue_ambiance_downlight_8_2', 'color_temp') }}  = '346' "

A condition has to be true or false.

Copy your code into the template section of Developer Tools and see the result.

It has to be


condition: template
value_template: "{{ state_attr('light.hue_ambiance_downlight_8_2', 'color_temp') == 346 }}" 

Thank you!

I never thought that the condition has to be true or false.

All good now and working correctly.