7 Day Weather Forecast

From google searches it seems the required key not provided is a vague error that isn’t related to the darksky api key.
I’ve seen entries for switches, sensors, automations, MQTT, and more.

I’ve also been reading the docs on packages Packages - Home Assistant and it references ‘keys representing the filenames’.

So outside of packages:

!include_dir_named packages

in the configuration.yaml does there need to be any other entry or am I misunderstanding the keys thing?

Hello I’m trying to install and copy the two directories from github to my hassio config, add two line in my configuration.yaml and when check if configuration is valid I obtain yhis :extra keys not allowed @ data[‘python_script’]. I have 0.80.2 version.

that would be an indentation error. Check that you have 2 spaces where required

Verify you’ve read through the post and are using the latest code. You shouldn’t need to use the python script to update the friendly names, you can do this with friendly name templating.

As of version 0.81:

Template sensors will no longer auto update if we can’t find relevant entities in the template. You’ll want to review your template sensors and consider adding relevant entity_id entries or use the new homeassistant.update_entity service.

Adding entity_id to every template sensor seemed clunky, so this automation is what I added in my weather.yaml package:

automation:
  - alias: Update Sensors
    initial_state: on
    trigger:
      platform: time
      hours: '/3'
      minutes: 01
      seconds: 00
    action:
        service: homeassistant.update_entity
        data:
          entity_id: 
            - sensor.weekday
            - sensor.forecast_today
            - sensor.forecast_1
            - sensor.forecast_2
            - sensor.forecast_3
            - sensor.forecast_4
            - sensor.forecast_5
            - sensor.forecast_6
            - sensor.forecast_7

This will update all weather sensors every 3 hours. Seems to be working fine. Please note that you must be on v0.81.1 or later. v0.81.0 did not allow the use of a list for the service data for homeassistant.update_entity

Won’t that still give an error in the log when HA starts up?

I added the entity id’s to all my templates… there were only 7 to add and copy/paste made it pretty simple.

What did you enter for the entity_id’s?

Here is an example of the first forcast for me.

      forecast_1:
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (1 * 86400 ) -%}
          {{ date | timestamp_custom("Tomorrow (%m/%d)") | replace("(0", "(") | replace("/0", "/") }}
        value_template: >
          {{states.sensor.dark_sky_daytime_high_temperature_1.state|round(0)}}/{{states.sensor.dark_sky_overnight_low_temperature_1.state|round(0)}}/{{states.sensor.dark_sky_precip_probability_1.state|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_1.state ~ '.png'}}
        entity_id: sensor.dark_sky_daytime_high_temperature_1, sensor.dark_sky_overnight_low_temperature_1, sensor.dark_sky_precip_probability_1

Oh, I understand now. You use the entity_id the value_template is based on. I was confused as to what should be used. That clears it up, thank you.

1 Like

I just updated to the latest package and receive this error for every forcast

2018-12-19 20:13:17 WARNING (MainThread) [homeassistant.components.sensor.template] Template sensor forecast_1 has no entity ids configured to track nor were we able to extract the entities to track from the friendly_name template(s). This entity will only be able to be updated manually.

is that intentional? I can add the entity id’s and have no issue with doing so, just figure that since its not there, they might be a reason?

yes it was a breaking change a few versions ago. you need to add the entity_id to the sensor

Totally familiar with the breaking change. I updated today because of the day 0 addition. The git was just updated 25 days ago

https://github.com/arsaboo/homeassistant-config/blob/master/packages/weather.yaml

@arsaboo is such a key person I’d assume the entity ids would be included which is why i asked if it was intentional

I’ll probably add the ids unless I hear otherwise.

adding the entity id’s is not the only way to solve the problem. You can also use an automation.

1 Like

Thanks everyone for all your help here to get me up and running on this. I have a question, is there a way to convert the forecast card to an image file so I can sms/email etc it outside of HA?

My wife would love that if I could have it delivered to her phone.

Mike

I don’t know of a way to do what you’re asking, not to say that it can’t be done. How about just creating a view in hass with only the data you want her to see, navigate to that via Chrome on her device, and use “Add to Home” to create an icon that leads directly to that page?

Thanks, will do it that way for now. Sill looking into it, thinking there may be a generic cam approach here.

Love this code, but I have to restart my HASS in order for the days to work. Otherwise it will not change, but state the day it worked. (i.e. if I start my HASS today, it will say Today, Tomorrow, Thursday, Friday, etc. Tomorrow (Wednesday) it will say the same days (and info will be correct, but the named day is incorrect). I get this in the logs.

Tue Mar 19 2019 16:57:57 GMT-0500 (CDT)

Template sensor forecast_2 has no entity ids configured to track nor were we able to extract the entities to track from the friendly_name template(s). This entity will only be able to be updated manually.

Thoughts?

You need to add that entity I’d to the sensor

To here? This is part of my weather.yaml file in my package. Thanks

sensors: 
  forecast_0:
    friendly_name: Today
    value_template: >
      {{states.sensor.dark_sky_daily_high_temperature_0.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_0.state|round(0)}}°
    icon_template: >-
      {% if is_state("sensor.dark_sky_icon", "clear-day") %}
        mdi:weather-sunny
      {% elif is_state("sensor.dark_sky_icon", "clear-night") %}
        mdi:weather-night
      {% elif is_state("sensor.dark_sky_icon", "cloudy") %}
        mdi:weather-cloudy
      {% elif is_state("sensor.dark_sky_icon", "rain") %}
        mdi:weather-pouring
      {% elif is_state("sensor.dark_sky_icon", "sleet") %}
        mdi:weather-snowy-rain
      {% elif is_state("sensor.dark_sky_icon", "snow") %}
        mdi:weather-snowy
      {% elif is_state("sensor.dark_sky_icon", "wind") %}
        mdi:weather-windy
      {% elif is_state("sensor.dark_sky_icon", "fog") %}
        mdi:weather-fog
      {% elif is_state("sensor.dark_sky_icon", "partly-cloudy-day") %}
        mdi:weather-partlycloudy
      {% elif is_state("sensor.dark_sky_icon", "partly-cloudy-night") %}
        mdi:weather-partlycloudy
      {% else %}
        error
      {% endif %}
  forecast_1:
    friendly_name: Tomorrow
    value_template: >
      {{states.sensor.dark_sky_daily_high_temperature_1.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_1.state|round(0)}}°
    icon_template: >-
      {% if is_state("sensor.dark_sky_icon_1", "clear-day") %}
        mdi:weather-sunny
      {% elif is_state("sensor.dark_sky_icon_1", "clear-night") %}
        mdi:weather-night
      {% elif is_state("sensor.dark_sky_icon_1", "cloudy") %}
        mdi:weather-cloudy
      {% elif is_state("sensor.dark_sky_icon_1", "rain") %}
        mdi:weather-pouring
      {% elif is_state("sensor.dark_sky_icon_1", "sleet") %}
        mdi:weather-snowy-rain
      {% elif is_state("sensor.dark_sky_icon_1", "snow") %}
        mdi:weather-snowy
      {% elif is_state("sensor.dark_sky_icon_1", "wind") %}
        mdi:weather-windy
      {% elif is_state("sensor.dark_sky_icon_1", "fog") %}
        mdi:weather-fog
      {% elif is_state("sensor.dark_sky_icon_1", "partly-cloudy-day") %}
        mdi:weather-partlycloudy
      {% elif is_state("sensor.dark_sky_icon_1", "partly-cloudy-night") %}
        mdi:weather-partlycloudy
      {% else %}
        error
      {% endif %}
  forecast_2:
    friendly_name_template: >
      {%- set date = as_timestamp(now()) + (2 * 86400 ) -%}
      {{ date | timestamp_custom("%A") }}
    value_template: >
      {{states.sensor.dark_sky_daily_high_temperature_2.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_2.state|round(0)}}°
    icon_template: >-
      {% if is_state("sensor.dark_sky_icon_2", "clear-day") %}
        mdi:weather-sunny
      {% elif is_state("sensor.dark_sky_icon_2", "clear-night") %}
        mdi:weather-night
      {% elif is_state("sensor.dark_sky_icon_2", "cloudy") %}
        mdi:weather-cloudy
      {% elif is_state("sensor.dark_sky_icon_2", "rain") %}
        mdi:weather-pouring
      {% elif is_state("sensor.dark_sky_icon_2", "sleet") %}
        mdi:weather-snowy-rain
      {% elif is_state("sensor.dark_sky_icon_2", "snow") %}
        mdi:weather-snowy
      {% elif is_state("sensor.dark_sky_icon_2", "wind") %}
        mdi:weather-windy
      {% elif is_state("sensor.dark_sky_icon_2", "fog") %}
        mdi:weather-fog
      {% elif is_state("sensor.dark_sky_icon_2", "partly-cloudy-day") %}
        mdi:weather-partlycloudy
      {% elif is_state("sensor.dark_sky_icon_2", "partly-cloudy-night") %}
        mdi:weather-partlycloudy
      {% else %}
        error
      {% endif %}

So do I add this to forecast_2?

entity_id: sensor.dark_sky_daytime_high_temperature_2, sensor.dark_sky_overnight_low_temperature_2