Sync RGB light with Phillips Hue

Hello,

I have an Oil Diffuser that has been flashed with Sonoff Tasmota. The diffuser has an RGB light that I would like to set based on the value of a Phillips Hue bulb in the same room.

The diffuser is controlled by an internal MCU, so right now it can only be set to base colours via MQTT (red, green,blue)

(similar to this model)

Question:

How would I go about setting up and automation template that would trigger an event (change the colour of the diffuser to the nearest base colour) when the Phillips Hue RGB value is 255 for a particular RGB value? e.g If the value is 48,48,255 I would like the light to be blue, if the value is 100,255,19 I would like it to be green.

Something similar to this?

‘{% if is_state(states.light.desk_lamp.attributes.rgb_color == (anyValue,anyValue,255)) %}true{% endif %}’