Custom Header

Quick tip if you’re going to round like that, add another ‘one’ as the last item in the array. That way if it’s 12 and it rounds up to 13 it will still be ‘one’. You could add logic to make index equal 1 if it is currently 13, but just adding ‘one’ to the end of the array seems cleaner.

  {% set word = [0,'one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','one'] %}
  {%- set hour = now().strftime('%-I')|int %}{% set minute = now().strftime('%-M')|int %}
  {%- set index = hour if minute <= 30 else hour + 1 %}mdi:clock-time-{{word[index]}}
  {{- '-outline' if states('sun.sun') != 'above_horizon' }}

Also, in the next release I think I’ll be adding logic for templates that fail. You’ll still get an error in the logs, but I’ll make CH disable itself when it happens so the default header is still available.

1 Like