Merge pull request #9 from chunkysteveo/patch-2

Correct nigh time symbols when Sun has set
pull/8/head^2
Madelena Mak 2 years ago committed by GitHub
commit c20207bf68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,7 +68,9 @@ template:
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond0_time = as_timestamp(state_attr('weather.hourly', 'forecast')[0].datetime) %} {% set cond0_time = as_timestamp(state_attr('weather.hourly', 'forecast')[0].datetime) %}
{% if cond0_time > next_setting and cond0_time < next_rising %} {% if states('sun.sun') == 'above_horizon' and cond0_time > next_setting %}
{% if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %}
{% elif states('sun.sun') == 'below_horizon' and cond0_time < next_rising %}
{% if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %} {% if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %}
{% else %} {% else %}
{{ cond0 }} {{ cond0 }}
@ -83,7 +85,9 @@ template:
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond1_time = as_timestamp(state_attr('weather.hourly', 'forecast')[1].datetime) %} {% set cond1_time = as_timestamp(state_attr('weather.hourly', 'forecast')[1].datetime) %}
{% if cond1_time > next_setting and cond1_time < next_rising %} {% if states('sun.sun') == 'above_horizon' and cond1_time > next_setting %}
{% if cond1 == 'sunny' %} night {% elif cond1 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond1 }} {% endif %}
{% elif states('sun.sun') == 'below_horizon' and cond1_time < next_rising %}
{% if cond1 == 'sunny' %} night {% elif cond1 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond1 }} {% endif %} {% if cond1 == 'sunny' %} night {% elif cond1 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond1 }} {% endif %}
{% else %} {% else %}
{{ cond1 }} {{ cond1 }}
@ -98,7 +102,9 @@ template:
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond2_time = as_timestamp(state_attr('weather.hourly', 'forecast')[2].datetime) %} {% set cond2_time = as_timestamp(state_attr('weather.hourly', 'forecast')[2].datetime) %}
{% if cond2_time > next_setting and cond2_time < next_rising %} {% if states('sun.sun') == 'above_horizon' and cond2_time > next_setting %}
{% if cond2 == 'sunny' %} night {% elif cond2 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond2 }} {% endif %}
{% elif states('sun.sun') == 'below_horizon' and cond2_time < next_rising %}
{% if cond2 == 'sunny' %} night {% elif cond2 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond2 }} {% endif %} {% if cond2 == 'sunny' %} night {% elif cond2 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond2 }} {% endif %}
{% else %} {% else %}
{{ cond2 }} {{ cond2 }}
@ -113,7 +119,9 @@ template:
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %} {% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %} {% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond3_time = as_timestamp(state_attr('weather.hourly', 'forecast')[3].datetime) %} {% set cond3_time = as_timestamp(state_attr('weather.hourly', 'forecast')[3].datetime) %}
{% if cond3_time > next_setting and cond3_time < next_rising %} {% if states('sun.sun') == 'above_horizon' and cond3_time > next_setting %}
{% if cond3 == 'sunny' %} night {% elif cond3 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond3 }} {% endif %}
{% elif states('sun.sun') == 'below_horizon' and cond3_time < next_rising %}
{% if cond3 == 'sunny' %} night {% elif cond3 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond3 }} {% endif %} {% if cond3 == 'sunny' %} night {% elif cond3 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond3 }} {% endif %}
{% else %} {% else %}
{{ cond3 }} {{ cond3 }}

Loading…
Cancel
Save