fix: check entity availability

This commit is contained in:
Chris
2022-11-28 23:56:38 +01:00
parent 62ccc1820e
commit 05463fa11b

View File

@@ -1757,6 +1757,10 @@ action:
message: "{{ time }}" message: "{{ time }}"
##### NSPanel boot init - Humidity ##### ##### NSPanel boot init - Humidity #####
- if:
- condition: template
value_template: '{{ humidity is match "sensor." and states(humidity).state != "unavailable" }}'
then:
- delay: - delay:
milliseconds: "{{ delay_value }}" milliseconds: "{{ delay_value }}"
- service: "{{ command_text_printf }}" - service: "{{ command_text_printf }}"
@@ -1784,9 +1788,10 @@ action:
##### NSPanel boot init - Outdoor Temp ##### ##### NSPanel boot init - Outdoor Temp #####
- variables: - variables:
outdoor_temp: >- outdoor_temp: >-
{%- if outdoortemp is match "sensor." -%} {{ states(outdoortemp) |round(0) }} {%- if outdoortemp is match "sensor." and states(hotwatertemp).state != "unavailable" -%} {{ states(outdoortemp) |round(0) }}
{%- elif weather == "Default" -%} {{state_attr(ha_weather,"temperature") | round(0)}} {%- elif weather == "Default" and state_attr(ha_weather, "temperature") != None -%} {{state_attr(ha_weather,"temperature") | round(0)}}
{%- elif weather == "AccuWeather" -%} {{state_attr(accuweather_value,"temperature") | round(0)}} {%- elif weather == "AccuWeather" and state_attr(accuweather_value, "temperature") != None -%} {{state_attr(accuweather_value,"temperature") | round(0)}}
{%- else -%} 0
{%- endif -%} {%- endif -%}
- delay: - delay:
milliseconds: "{{ delay_value }}" milliseconds: "{{ delay_value }}"
@@ -3094,6 +3099,10 @@ action:
message: "{{ time }}" message: "{{ time }}"
##### NSPanel Humidity ##### ##### NSPanel Humidity #####
- if:
- condition: template
value_template: '{{ humidity is match "sensor." and states(humidity).state != "unavailable" }}'
then:
- delay: - delay:
milliseconds: "{{ delay_value }}" milliseconds: "{{ delay_value }}"
- service: "{{ command_text_printf }}" - service: "{{ command_text_printf }}"
@@ -3104,7 +3113,7 @@ action:
##### NSPanel Hotwater ##### ##### NSPanel Hotwater #####
- if: - if:
- condition: template - condition: template
value_template: '{{ hotwatertemp is match "sensor." }}' value_template: '{{ hotwatertemp is match "sensor." and states(hotwatertemp).state != "unavailable" }}'
then: then:
- delay: - delay:
milliseconds: "{{ delay_value }}" milliseconds: "{{ delay_value }}"
@@ -3121,9 +3130,10 @@ action:
##### NSPanel Outdoor Temp ##### ##### NSPanel Outdoor Temp #####
- variables: - variables:
outdoor_temp: >- outdoor_temp: >-
{%- if outdoortemp is match "sensor." -%} {{ states(outdoortemp) |round(0) }} {%- if outdoortemp is match "sensor." and states(hotwatertemp).state != "unavailable" -%} {{ states(outdoortemp) |round(0) }}
{%- elif weather == "Default" -%} {{state_attr(ha_weather,"temperature") | round(0)}} {%- elif weather == "Default" and state_attr(ha_weather, "temperature") != None -%} {{state_attr(ha_weather,"temperature") | round(0)}}
{%- elif weather == "AccuWeather" -%} {{state_attr(accuweather_value,"temperature") | round(0)}} {%- elif weather == "AccuWeather" and state_attr(accuweather_value, "temperature") != None -%} {{state_attr(accuweather_value,"temperature") | round(0)}}
{%- else -%} 0
{%- endif -%} {%- endif -%}
- delay: - delay:
milliseconds: "{{ delay_value }}" milliseconds: "{{ delay_value }}"
@@ -4461,9 +4471,10 @@ action:
- variables: - variables:
hvac_mode: "{{ states(climate) }}" hvac_mode: "{{ states(climate) }}"
outdoor_temp: >- outdoor_temp: >-
{%- if outdoortemp is match "sensor." -%} {{ states(outdoortemp) |round(0) }} {%- if outdoortemp is match "sensor." and states(hotwatertemp).state != "unavailable" -%} {{ states(outdoortemp) |round(0) }}
{%- elif weather == "Default" -%} {{state_attr(ha_weather,"temperature") | round(0)}} {%- elif weather == "Default" and state_attr(ha_weather, "temperature") != None -%} {{state_attr(ha_weather,"temperature") | round(0)}}
{%- elif weather == "AccuWeather" -%} {{state_attr(accuweather_value,"temperature") | round(0)}} {%- elif weather == "AccuWeather" and state_attr(accuweather_value, "temperature") != None -%} {{state_attr(accuweather_value,"temperature") | round(0)}}
{%- else -%} 0
{%- endif -%} {%- endif -%}
heating_state: >- heating_state: >-
{%- if hvac_mode == "off" -%} {{ off_mui }} {%- if hvac_mode == "off" -%} {{ off_mui }}