One template and multiplay instance

What would be the easiest way to create a template/object preferible a python script and then call it multiple times with input from Hass.io? My idea is to have a template that shall have lux and time a day as input and will adjust light and ambient color as output.

Thanks for any help!