Fix basement lights sync issue sensor becoming unavailable

This commit is contained in:
2023-03-20 16:09:28 -04:00
parent a98f9a24e5
commit 466726a270

View File

@ -340,38 +340,18 @@ template:
- name: Basement Lights Sync Issue - name: Basement Lights Sync Issue
unique_id: 781d7a1e-ade3-44c3-b0f2-a15a5188107e unique_id: 781d7a1e-ade3-44c3-b0f2-a15a5188107e
state: > state: >
{% set colortemp = states('sensor.basement_studio_lights_colortemp_diff') | float %} {% set colortemp = states('sensor.basement_studio_lights_colortemp_diff') | float(0) %}
{% set brightness = states('sensor.basement_studio_lights_brightness_diff') | float %} {% set brightness = states('sensor.basement_studio_lights_brightness_diff') | float(0) %}
{% if is_state('light.basement_studio_lights','on') %} {% if is_state('light.basement_studio_lights','on') %}
{% if is_state('switch.adaptive_lighting_basement_studio','on') and is_state('switch.adaptive_lighting_sleep_mode_basement_studio','off') %} {% if is_state('switch.adaptive_lighting_basement_studio','on') and is_state('switch.adaptive_lighting_sleep_mode_basement_studio','off') %}
{% if is_state('switch.adaptive_lighting_adapt_brightness_basement_studio','on') and is_state('switch.adaptive_lighting_adapt_color_basement_studio','on') %} {% if is_state('switch.adaptive_lighting_adapt_brightness_basement_studio','on') and is_state('switch.adaptive_lighting_adapt_color_basement_studio','on') %}
{% if colortemp > 100 or colortemp < -100 %} {{ (colortemp > 100 or colortemp < -100) or (brightness > 5 or brightness < -5) }}
true
{% elif brightness > 5 or brightness < -5 %}
true
{% else %}
false
{% endif %}
{% elif is_state('switch.adaptive_lighting_adapt_brightness_basement_studio','on') and is_state('switch.adaptive_lighting_adapt_color_basement_studio','off') %} {% elif is_state('switch.adaptive_lighting_adapt_brightness_basement_studio','on') and is_state('switch.adaptive_lighting_adapt_color_basement_studio','off') %}
{% if brightness > 5 or brightness < -5 %} {{ brightness > 5 or brightness < -5 }}
true
{% else %}
false
{% endif %}
{% elif is_state('switch.adaptive_lighting_adapt_color_basement_studio','on') and is_state('switch.adaptive_lighting_adapt_brightness_basement_studio','off') %} {% elif is_state('switch.adaptive_lighting_adapt_color_basement_studio','on') and is_state('switch.adaptive_lighting_adapt_brightness_basement_studio','off') %}
{% if colortemp > 100 or colortemp < -100 %} {{ colortemp > 100 or colortemp < -100 }}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
{% else %}
false
{% endif %} {% endif %}
{% else %}
false
{% endif %} {% endif %}
device_class: problem device_class: problem
delay_on: "00:00:10" delay_on: "00:00:10"