7 Day Weather Forecast


#371

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.


#372

I’ve also been reading the docs on packages https://www.home-assistant.io/docs/configuration/packages/ 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?


#373

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.


#374

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


#375

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.


#376

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


Howto create battery alert without creating a template for every device
#377

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.


#378

What did you enter for the entity_id’s?


#379

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

#380

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.


#381

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?


#382

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


#383

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

@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.


#384

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


#385

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


#386

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?


#387

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


#388

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?


#389

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


#390

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