7 Day Weather Forecast

38C and snowing, lmao

3 Likes

They are in Fahrenheit

FYI, this is making over 1,000 calls per day, and is causing it to timeout or return incorrect values with the free account.
image
image

1 Like

I just checked and I am still at about 700 calls per day. The forecast information is obtained in the same API call, so it should not increase the number of requests (see here).

I was averaging around 700 as well for the longest, not sure why it went up.
image

ERROR (Thread-19) [homeassistant.components.sensor.darksky] Unable to connect to Dark Sky. 403 Client Error: Forbidden for url: https://api.darksky.net/forecast/my_api-key/my_long,lat?units=us

Make sure you don’t have the dark sky sensor in two places in your .yaml files. I accidentally left my dark sky sensor in the sensor: section, and since the package for this forecast has the dark sky sensor embedded, it was doubling my api calls and I ran into the same issue.

1 Like

:+1:That’s definitely what it is, I had the dark sky sensors previously, will reconfigure and update.

How many calls, and how often are calls made with this package?

Every 2 minutes (720 a day) if you don’t specify a different update interval in the dark sky sensor.

Looks good now.

Restarted 10min ago.
image

image
Cheers.

I’m getting about double that the last week

What does this mean?

Testing configuration at /config
2018-01-30 22:01:07 ERROR (SyncWorker_0) [homeassistant.util.yaml] while parsing a block mapping
in “/config/packages/weather.yaml”, line 1, column 1
expected , but found ‘’
in “/config/packages/weather.yaml”, line 1, column 3
2018-01-30 22:01:07 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/packages/weather.yaml”, line 1, column 1
expected , but found ‘’
in “/config/packages/weather.yaml”, line 1, column 3

Are you absolutely sure you don’t have the dark sky sensor listed in two locations? I’ve never had a problem with it making more calls than it is supposed to.

Got the above errors to go away and now I’m getting this.

Failed config
automation:
- action: [source /config/packages/weather.yaml:295]
- data_template: [source /config/packages/weather.yaml:297]
entityid: {{trigger.entity_id}}
service: python_script.dark_sky_friendly_names
alias: Update friendly names
id: update_friendly_names
trigger: [source /config/packages/weather.yaml:283]
- platform: state
entity_id: [source /config/packages/weather.yaml:285]
- sensor.forecast_1
- sensor.forecast_2
- sensor.forecast_3
- sensor.forecast_4
- sensor.forecast_5
- sensor.forecast_6
- sensor.forecast_7
- platform: homeassistant
event: start

Successful config (partial)
automation:
- action: ?
- data_template: ?
entityid: <homeassistant.helpers.template.Template object at 0x737b2110>
service: python_script.dark_sky_friendly_names
alias: Update friendly names
hide_entity: False
id: update_friendly_names
trigger: ?
- platform: state
entity_id: ?
- sensor.forecast_1
- sensor.forecast_2
- sensor.forecast_3
- sensor.forecast_4
- sensor.forecast_5
- sensor.forecast_6
- sensor.forecast_7
- platform: homeassistant
event: start

Looks like you have not copied the files correctly.

Hi!
I have tried to get this to work but all i get is this result;

I have added icons in “config/www/dark_sky/DarkSky-icons” and added this “dark_sky_friendly_names” in Python script folder
Can someone please take a look and see where my misstake is?

Python_script:

###############################################################################
# Author:      Alok R. Saboo
# Description:  This script takes the dark_sky forecast sensors and updates
#               their friendly_name to include the date and day.
#               https://github.com/arsaboo/homeassistant-config/blob/master/packages/weather.yaml
###############################################################################
dark_sky_entities = ["sensor.forecast_1", "sensor.forecast_2", "sensor.forecast_3",
                     "sensor.forecast_4", "sensor.forecast_5", "sensor.forecast_6",
                     "sensor.forecast_7"]
days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]

triggeredEntity = data.get('entity_id')
# logger.warning("trigger is {}".format(triggeredEntity))
now = datetime.datetime.now()
today = now.weekday()

if triggeredEntity is None:
    for entity_id in dark_sky_entities:
        # copy it's state
        state = hass.states.get(entity_id)
        newState = state.state
        forecastdays = int(entity_id.split('_')[1])
        day = datetime.timedelta(days = forecastdays)
        forecastdate = now + day
        newEntityPicture = state.attributes.get('entity_picture')
        if today + forecastdays > 6:
            newDay = days[today + forecastdays - 7]
        else:
            newDay = days[today + forecastdays]
        # Set states
        hass.states.set(entity_id, newState, {
            'friendly_name': "{} ({}/{})".format(newDay, forecastdate.month, forecastdate.day),
            'entity_picture': newEntityPicture,
        })
else:
    state = hass.states.get(triggeredEntity)
    newState = state.state
    forecastdays = int(triggeredEntity.split('_')[1])
    day = datetime.timedelta(days = forecastdays)
    forecastdate = now + day
    newEntityPicture = state.attributes.get('entity_picture')
    if today + forecastdays > 6:
        newDay = days[today + forecastdays - 7]
    else:
        newDay = days[today + forecastdays]
    # Set states
    hass.states.set(triggeredEntity, newState, {
        'friendly_name': "{} ({}/{})".format(newDay, forecastdate.month, forecastdate.day),
        'entity_picture': newEntityPicture,
    })

And this is the code that i have in “Packages”

https://hastebin.com/oremedivar.cs

You mean it didn’t show correct temperature or ?

I cant see icons in frontend like this;

image

Re-read the original post in its entirety. The code I embedded in the post is for the mdi icons. If you want the custom icons, you need to use the weather.yaml file in the github link.

download the darksky icon and put the png files in www/dark_sky folder.

https://www.dr-lex.be/software/download/DarkSky-icons.zip