Template type error: can't multiply sequence by non-int of type 'float'

HI,
back again with this sensor:

  circadian_light:
    friendly_name: 'Circadian light'
    unit_of_measurement: 'mired'
    value_template: >
      {% if is_state('sun.sun' , 'above_horizon') %}
        {{ (float(states('sensor.length_of_day_factor') | round (5)) * 
           (float(state_attr('sun.sun','azimuth') )-180)**2 + 175) | round }}
      {% elif (as_timestamp(state_attr('sun.sun','next_dusk'))) - 
              (as_timestamp(state_attr('sun.sun','next_setting'))) < 0 or 
              (as_timestamp(state_attr('sun.sun','next_rising'))) - 
              (as_timestamp(state_attr('sun.sun','next_dawn'))) < 0 %}
        350
      {% else %}
        390
      {% endif %}

as you can see ive already added type float to both sides of the multiplication but still this error pops up at startup. what could be changed to mitigate that? I added, because without it, the same error reported. cant use int, because it simply isn’t…

this is the sensor it takes into account.

  length_of_day_factor:
    friendly_name: 'Length of day' # factor for circadian light calculation'
    value_template: >
      {% set daylength = ( (as_timestamp(state_attr('sun.sun','next_setting')) - 
                            as_timestamp(state_attr('sun.sun','next_rising')) ) / 
                             3600) + 24 %}
          {{ ((daylength*-0.0063616)+0.11131) | round(5) }}


2018-10-08 14:40:59 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.circadian_light fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
    await self.async_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/template.py", line 180, in async_update
    self._state = self._template.async_render()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 132, in async_render
    return self._compiled.render(kwargs).strip()
  File "/usr/local/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 3, in top-level template code
TypeError: can't multiply sequence by non-int of type 'float'

I think it’s because you are rounding before you float…

float(states('sensor.length_of_day_factor') | round (5))

Just use the float filter.

states('sensor.length_of_day_factor') | float | round(5)

if you really really really want to use the float method, change the order by adjusting the parenthesis:

float(states('sensor.length_of_day_factor')) | round (5)

Also side note, you don’t really need to round it here.

thanks, I tried that before since the length of day ws already rounded to (5), but it came up empty.
Doing so now gives:

 {{ ((states('sensor.length_of_day_factor') | float) * 
           ((state_attr('sun.sun','azimuth') )-180)**2 + 175) | round }}

that better?

I was a bit confused about the warning, since it says it cant multiply by a non-int of type float, Id thought it wanted an int…