Closed genestealer closed 3 years ago
Ah Ha, I see it's the irrigation_weather_outlook icon which is showing and not the weather_just_icon!
So the weather_just_icon sensor is not used, so I added the icon_template to the irrigation_weather_outlook sensor :)
Could you perhaps update prerequisites with the missing "irrigation_weather_outlook" sensor and remove the unused weather_just_icon?
I would be interested to see your value_template for irrigation_weather_outlook, as it looks great
I have thrown this together
- platform: template
sensors:
irrigation_weather_outlook:
friendly_name: "Irrigation weather outlook"
# value_template: "{{ states('sensor.dark_sky_summary_1d') }}"
value_template: "{{states('sensor.dark_sky_summary_1d') }} High of {{ states('sensor.dark_sky_daytime_high_temperature_1d') }}°C Low of {{ states('sensor.dark_sky_overnight_low_temperature_1d') }}°C"
icon_template: >-
{% if is_state("sensor.sensor.dark_sky_icon_1d","clear-day") %} mdi:weather-sunny
{% elif is_state("sensor.dark_sky_icon_1d","clear-night") %} mdi:weather-night
{% elif is_state("sensor.dark_sky_icon_1d","rain") %} mdi:weather-rainy
{% elif is_state("sensor.dark_sky_icon_1d","snow") %} mdi:weather-snowy
{% elif is_state("sensor.dark_sky_icon_1d","fog") %} mdi:weather-fog
{% elif is_state("sensor.dark_sky_icon_1d","sleet") %} mdi:weather-partly-snowy-rainy
{% elif is_state("sensor.dark_sky_icon_1d","wind") %} mdi:weather-windy
{% elif is_state("sensor.dark_sky_icon_1d","cloudy") %} mdi:weather-cloudy
{% elif is_state("sensor.dark_sky_icon_1d","partly-cloudy-day") %} mdi:weather-partly-cloudy
{% elif is_state("sensor.dark_sky_icon_1d","partly-cloudy-night") %} mdi:weather-night-partly-cloudy
{% elif is_state("sensor.dark_sky_icon_1d","hail") %} mdi:weather-hail
{% elif is_state("sensor.dark_sky_icon_1d","lightning") %} mdi:weather-lightning
{% elif is_state("sensor.dark_sky_icon_1d","thunderstorm") %} mdi:weather-lightning-rainy
{% endif %}
# #=====================
I've suggested this fix: https://github.com/kloggy/HA-Irrigation-Version2/pull/45
I don't seem to be able to make the irrigation_weather_outlook text go over to lines, can I please ask how did you manage it?
Here is mine...
#== Weather Outlook Sensor
- platform: template
sensors:
irrigation_weather_outlook:
value_template: >
{% set current = state_attr('sensor.weather_api_current', 'current') %}
{% set current_conditons = current.condition.text %}
{% set max_high_temp = states('sensor.weather_api_forecast_max_temp_today') %}
{% set will_rain_today = states('sensor.weather_api_forecast_will_it_rain_today') %}
{% set will_rain_tomorrow = states('sensor.weather_api_forecast_will_it_rain_tomorrow') %}
{% set total_rain_today = states('sensor.weather_api_forecast_total_rain_today') %}
{% set total_rain_tomorrow = states('sensor.weather_api_forecast_total_rain_tomorrow') %}
{% set chance_of_rain_today = states('sensor.weather_api_forecast_chance_of_rain_today') %}
{% set chance_of_rain_tomorrow = states('sensor.weather_api_forecast_chance_of_rain_tomorow') %}
{% set rain_today = total_rain_today ~ 'mm / ' ~ chance_of_rain_today ~ '%' %}
{% set rain_tomorrow = total_rain_tomorrow ~ 'mm / ' ~ chance_of_rain_tomorrow ~ '%' %}
{% set outlook = 'Outlook: ' ~ current_conditons ~ ', High Temp ' ~ max_high_temp ~ '°C<br>' %}
{% if will_rain_today == '1' and will_rain_tomorrow == '1' %}
{% set outlook = outlook ~ 'Rain Today (' ~ rain_today ~ ') & Tomorrow (' ~ rain_tomorrow ~ ')' %}
{% elif will_rain_today == '1' %}
{% set outlook = outlook ~ 'Rain Today (' ~ rain_today ~ '), none tomorrow' %}
{% elif will_rain_tomorrow == '1' %}
{% set outlook = outlook ~ 'Rain Tomorrow (' ~ rain_tomorrow ~ ')' %}
{% else %}
{% set outlook = outlook ~ 'No rain forecast today or tomorrow.' %}
{% endif %}
{{ outlook }}
entity_picture_template: >
{% set current = state_attr('sensor.weather_api_current', 'current') %}
{% set is_day = current.is_day %}
{% set icon = current.condition.icon %}
{% set icon = icon.split('/')[-1] %}
{% set icon = icon.split('.')[0] %}
{% set is_day = current.is_day %}
{% if is_day %}
{{ '/local/icons/weather_icons/weather_api_day/' ~ icon ~ '.png' }}
{% else %}
{{ '/local/icons/weather_icons/weather_api_night/' ~ icon ~ '.png' }}
{% endif %}
I think you are looking for the <br>
on this line :-)
{% set outlook = 'Outlook: ' ~ current_conditons ~ ', High Temp ' ~ max_high_temp ~ '°C<br>' %}
The weather_just_icon sensor is used elsewhere in my config, as you've discovered, it isn't part of this package anymore.
My mistake, sorry.
I've updated the pre-requisites docs to remove it and show my weather outlook sensor (only because then I will recognise it if I have to revisit, there is nothing wrong with yours :-) )
Could you please upload your the icons in the "/local/icons/weather_icons/" referenced in the updated "prerequisites.yaml" file if that's ok?
They are available on the WeatherAPI website - https://www.weatherapi.com/docs/ (Navigate to 'Weather Icons and Codes' under 'Resources' on the left menu. Or simply scroll to near the bottom of the page)
Sorry Im trying to get the weather_just_icon as shown in the readme screenshot.
I have created the weather_just_icon sensor as stated in prerequisites and even after setting the value manually it is now showing on the page. Rather is showing an "eye". I searched through your code, and cannot where weather_just_icon is used, has be perhaps been removed/replaced?