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