Fixes for Home Assistant's self-inflicted weather entity issues...
This commit is contained in:
@ -26,14 +26,15 @@ weather:
|
|||||||
] %}
|
] %}
|
||||||
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
|
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
|
||||||
{{ states(result) | float }}
|
{{ states(result) | float }}
|
||||||
forecast_template: >
|
forecast_daily_template: >
|
||||||
{% set forecasts = [
|
{% set forecasts = [
|
||||||
states.weather.kdfi_daynight.attributes,
|
states.weather.kdfi_daynight.attributes,
|
||||||
states.weather.iron_nerd_studios.attributes,
|
states.sensor.pirateweather_daily_weather_forecast.attributes,
|
||||||
states.weather.openweathermap.attributes,
|
states.weather.openweathermap.attributes,
|
||||||
states.weather.weatherapi_stratton_ave.attributes
|
states.weather.weatherapi_stratton_ave.attributes
|
||||||
] %}
|
] %}
|
||||||
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
|
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
|
||||||
|
forecast_hourly_template: "{{ state_attr('sensor.pirateweather_hourly_weather_forecast','forecast') }}"
|
||||||
pressure_template: >
|
pressure_template: >
|
||||||
{% set pressures = [
|
{% set pressures = [
|
||||||
states.sensor.kdfi_barometric_pressure
|
states.sensor.kdfi_barometric_pressure
|
||||||
@ -103,13 +104,13 @@ weather:
|
|||||||
] %}
|
] %}
|
||||||
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
|
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
|
||||||
{{ states(result) | float }}
|
{{ states(result) | float }}
|
||||||
forecast_template: >
|
# forecast_template: >
|
||||||
{% set forecasts = [
|
# {% set forecasts = [
|
||||||
states.weather.tomorrow_io_stratton_ave_hourly.attributes,
|
# states.weather.tomorrow_io_stratton_ave_hourly.attributes,
|
||||||
states.weather.kdfi_hourly.attributes,
|
# states.weather.kdfi_hourly.attributes,
|
||||||
states.weather.iron_nerd_studios_hourly
|
# states.weather.iron_nerd_studios_hourly.attributes
|
||||||
] %}
|
# ] %}
|
||||||
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
|
# {{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
|
||||||
pressure_template: >
|
pressure_template: >
|
||||||
{% set pressures = [
|
{% set pressures = [
|
||||||
states.sensor.kdfi_barometric_pressure
|
states.sensor.kdfi_barometric_pressure
|
||||||
@ -222,6 +223,56 @@ sensor:
|
|||||||
# days: 7
|
# days: 7
|
||||||
|
|
||||||
template:
|
template:
|
||||||
|
- trigger:
|
||||||
|
- platform: time_pattern
|
||||||
|
minutes: /5
|
||||||
|
- platform: homeassistant
|
||||||
|
event: start
|
||||||
|
action:
|
||||||
|
- service: weather.get_forecasts
|
||||||
|
data:
|
||||||
|
type: daily
|
||||||
|
target:
|
||||||
|
entity_id: weather.iron_nerd_studios
|
||||||
|
response_variable: daily
|
||||||
|
- variables:
|
||||||
|
today: "{{ daily['weather.iron_nerd_studios'].forecast[0] }}"
|
||||||
|
sensor:
|
||||||
|
- name: Pirateweather Daily Weather Forecast
|
||||||
|
unique_id: 1542a900-5269-4daa-b893-72c7e7d892ab
|
||||||
|
state: "{{ now().isoformat() }}"
|
||||||
|
attributes:
|
||||||
|
forecast: "{{ daily['weather.iron_nerd_studios'].forecast }}"
|
||||||
|
- name: Pirateweather High
|
||||||
|
unique_id: 0b28d11d-4bb3-4f61-8d0e-43e50ccef60d
|
||||||
|
state: "{{ today.temperature }}"
|
||||||
|
unit_of_measurement: °F
|
||||||
|
- name: Pirateweather Low
|
||||||
|
unique_id: ed62ca6a-ec1d-484c-84a6-ea70b5f38c75
|
||||||
|
state: "{{ today.templow }}"
|
||||||
|
unit_of_measurement: °F
|
||||||
|
- name: Pirateweather Rain Chance Today
|
||||||
|
unique_id: 4c138bd5-57ee-4136-9449-6f172ddb08fb
|
||||||
|
state: "{{ today.precipitation_probability }}"
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
- trigger:
|
||||||
|
- platform: time_pattern
|
||||||
|
minutes: /5
|
||||||
|
- platform: homeassistant
|
||||||
|
event: start
|
||||||
|
action:
|
||||||
|
- service: weather.get_forecasts
|
||||||
|
data:
|
||||||
|
type: hourly
|
||||||
|
target:
|
||||||
|
entity_id: weather.iron_nerd_studios
|
||||||
|
response_variable: hourly
|
||||||
|
sensor:
|
||||||
|
- name: Pirateweather Hourly Weather Forecast
|
||||||
|
unique_id: edc7d867-78fa-4a6b-9b01-fa9d268a8fc0
|
||||||
|
state: "{{ now().isoformat() }}"
|
||||||
|
attributes:
|
||||||
|
forecast: "{{ hourly['weather.iron_nerd_studios'].forecast }}"
|
||||||
- binary_sensor:
|
- binary_sensor:
|
||||||
- name: Heat Threshold
|
- name: Heat Threshold
|
||||||
unique_id: 849a08bb-d4e6-40e9-ae42-50f7fb71b727
|
unique_id: 849a08bb-d4e6-40e9-ae42-50f7fb71b727
|
||||||
@ -365,30 +416,30 @@ template:
|
|||||||
unique_id: c0faea33-2ac3-40f1-8558-584c3f5d6b16
|
unique_id: c0faea33-2ac3-40f1-8558-584c3f5d6b16
|
||||||
icon: mdi:weather-sunny
|
icon: mdi:weather-sunny
|
||||||
state: >-
|
state: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.condition }}
|
{{ forecast.condition }}
|
||||||
attributes:
|
attributes:
|
||||||
high_temp: >-
|
high_temp: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.temperature }}
|
{{ forecast.temperature }}
|
||||||
overnight_low: >-
|
overnight_low: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.templow }}
|
{{ forecast.templow }}
|
||||||
wind_bearing: >-
|
wind_bearing: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.wind_bearing }}
|
{{ forecast.wind_bearing }}
|
||||||
wind_speed: >-
|
wind_speed: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.wind_speed }}
|
{{ forecast.wind_speed }}
|
||||||
precipitation: >-
|
precipitation: >-
|
||||||
{% if state_attr('weather.iron_nerd_weather_station','precipitation') %}
|
{% if state_attr('weather.iron_nerd_weather_station','precipitation') %}
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set forecast = state_attr('weather.iron_nerd_studios','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ forecast.precipitation }}
|
{{ forecast.precipitation }}
|
||||||
friendly: >-
|
friendly: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.condition | replace("partlycloudy","partly cloudy") }}
|
{{ forecast.condition | replace("partlycloudy","partly cloudy") }}
|
||||||
- name: Current Forecast Detail
|
- name: Current Forecast Detail
|
||||||
unique_id: e5ae9864-70b5-402c-9d2f-c4d6a10085df
|
unique_id: e5ae9864-70b5-402c-9d2f-c4d6a10085df
|
||||||
@ -503,23 +554,23 @@ template:
|
|||||||
unique_id: a8ae26b0-ed26-4568-bb2b-f7c72707b009
|
unique_id: a8ae26b0-ed26-4568-bb2b-f7c72707b009
|
||||||
icon: mdi:weather-sunny
|
icon: mdi:weather-sunny
|
||||||
state: >-
|
state: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[1] %}
|
||||||
{{ forecast.condition }}
|
{{ forecast.condition }}
|
||||||
attributes:
|
attributes:
|
||||||
high_temp: >-
|
high_temp: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[1] %}
|
||||||
{{ forecast.temperature }}
|
{{ forecast.temperature }}
|
||||||
overnight_low: >-
|
overnight_low: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[1] %}
|
||||||
{{ forecast.templow }}
|
{{ forecast.templow }}
|
||||||
wind_bearing: >-
|
wind_bearing: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[1] %}
|
||||||
{{ forecast.wind_bearing }}
|
{{ forecast.wind_bearing }}
|
||||||
wind_speed: >-
|
wind_speed: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[1] %}
|
||||||
{{ forecast.wind_speed }}
|
{{ forecast.wind_speed }}
|
||||||
precipitation: >-
|
precipitation: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[1] %}
|
||||||
{{ forecast.precipitation }}
|
{{ forecast.precipitation }}
|
||||||
- name: Tomorrow Forecast Detail
|
- name: Tomorrow Forecast Detail
|
||||||
unique_id: 21374ed0-80d1-49ba-817d-3e93eb3865e4
|
unique_id: 21374ed0-80d1-49ba-817d-3e93eb3865e4
|
||||||
@ -824,21 +875,21 @@ template:
|
|||||||
unit_of_measurement: '°F'
|
unit_of_measurement: '°F'
|
||||||
device_class: temperature
|
device_class: temperature
|
||||||
state: >-
|
state: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.temperature }}
|
{{ forecast.temperature }}
|
||||||
- name: "Tomorrow's High Temp"
|
- name: "Tomorrow's High Temp"
|
||||||
unique_id: b9dfc26a-d557-46b4-a6eb-a215c7bbe494
|
unique_id: b9dfc26a-d557-46b4-a6eb-a215c7bbe494
|
||||||
unit_of_measurement: '°F'
|
unit_of_measurement: '°F'
|
||||||
device_class: temperature
|
device_class: temperature
|
||||||
state: >-
|
state: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[2] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[2] %}
|
||||||
{{ forecast.temperature }}
|
{{ forecast.temperature }}
|
||||||
- name: "Tonight's Low Temp"
|
- name: "Tonight's Low Temp"
|
||||||
unique_id: 8ddc55b6-4728-4897-a32f-90be970f744b
|
unique_id: 8ddc55b6-4728-4897-a32f-90be970f744b
|
||||||
unit_of_measurement: '°F'
|
unit_of_measurement: '°F'
|
||||||
device_class: temperature
|
device_class: temperature
|
||||||
state: >-
|
state: >-
|
||||||
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
|
{% set forecast = state_attr('sensor.pirateweather_daily_weather_forecast','forecast')[0] %}
|
||||||
{{ forecast.templow }}
|
{{ forecast.templow }}
|
||||||
- name: "Clothing Forecast"
|
- name: "Clothing Forecast"
|
||||||
unique_id: 8ed2684b-d0ad-402c-bc3c-340cb9b2437a
|
unique_id: 8ed2684b-d0ad-402c-bc3c-340cb9b2437a
|
||||||
@ -1099,8 +1150,8 @@ template:
|
|||||||
unit_of_measurement: '°F'
|
unit_of_measurement: '°F'
|
||||||
state: >
|
state: >
|
||||||
{% set ns = namespace(temps=[]) %}
|
{% set ns = namespace(temps=[]) %}
|
||||||
{% set x = state_attr('weather.iron_nerd_weather_station_hourly','forecast') | count %}
|
{% set x = state_attr('sensor.pirateweather_hourly_weather_forecast','forecast') | count %}
|
||||||
{% set pd = state_attr('weather.iron_nerd_weather_station_hourly','forecast') %}
|
{% set pd = state_attr('sensor.pirateweather_hourly_weather_forecast','forecast') %}
|
||||||
{% for i in range(0,x) %}
|
{% for i in range(0,x) %}
|
||||||
{% set hr = as_timestamp(as_local(as_datetime(pd[i].datetime))) | timestamp_custom('%H') | int %}
|
{% set hr = as_timestamp(as_local(as_datetime(pd[i].datetime))) | timestamp_custom('%H') | int %}
|
||||||
{% if hr in range(21,24) or hr in range(0,8) %}
|
{% if hr in range(21,24) or hr in range(0,8) %}
|
||||||
@ -1112,11 +1163,6 @@ template:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ ns.temps | min | int }}
|
{{ ns.temps | min | int }}
|
||||||
icon: mdi:thermometer
|
icon: mdi:thermometer
|
||||||
- name: 'Rain - 24 Hours'
|
|
||||||
unique_id: 26d2b945-f676-4c3c-8a4f-4b3b909d62dd
|
|
||||||
unit_of_measurement: 'in'
|
|
||||||
state: "{{ state_attr('sensor.rain_factor','day_0_rain') | float }}"
|
|
||||||
icon: mdi:weather-rainy
|
|
||||||
- name: 'Today Corrected High Temp'
|
- name: 'Today Corrected High Temp'
|
||||||
unique_id: c0c40ec1-605e-4739-a935-ac0a2937fab2
|
unique_id: c0c40ec1-605e-4739-a935-ac0a2937fab2
|
||||||
unit_of_measurement: °F
|
unit_of_measurement: °F
|
||||||
|
Reference in New Issue
Block a user