Apple just bought Dark Sky

I switched over to NWS (USA resident) … I needed to write some templates to make similar variables to dark_sky for use in tileboard … 30 mins work and I’ve moved on

2 Likes

please share…

include below … this is primarily to mimic that sensors that dark_sky was making available that i use for tileboard … the wind_bearing code is to convert wind direction in degrees to direction(n,s,e,w) and it’s repeated because i couldn’t figure out how to import macros with jinga

# variables for nws(kcrq) for use in tileboard
  - platform: template
    sensors:
      nws_summary_0d:
        value_template: "{{ states.weather.kcrq.attributes.attribution }}"
        attribute_templates:
          temperature: "{{ states.weather.kcrq.attributes.temperature }}"
          humidity: "{{ states.weather.kcrq.attributes.humidity }}"
          pressure: "{{ states.weather.kcrq.attributes.pressure }}"
          wind_speed: "{{ states.weather.kcrq.attributes.wind_speed }}"
          visibility: "{{ states.weather.kcrq.attributes.visibility }}"
          wind_bearing: >
            {% set b = states.weather.kcrq.attributes.wind_bearing|float %}
            {% if b > 348.0 and b <= 11.0 %}
              N
            {% elif b > 11.0 and b <= 33.0 %}
              NNE
            {% elif b > 33.0 and b <= 56.0 %}
              NE
            {% elif b > 56.0 and b <= 78.0 %}
              ENE
            {% elif b > 78.0 and b <= 101.0 %}
              E
            {% elif b > 101.0 and b <= 123.0 %}
              ESE
            {% elif b > 123.0 and b <= 146.0 %}
              SE
            {% elif b > 146.0 and b <= 168.0 %}
              SSE
            {% elif b > 168.0 and b <= 191.0 %}
              S
            {% elif b > 191.0 and b <= 213.0 %}
              SSW
            {% elif b > 213.0 and b <= 236.0 %}
              SW
            {% elif b > 236.0 and b <= 258.0 %}
              WSW
            {% elif b > 258.0 and b <= 281.0 %}
              W
            {% elif b > 281.0 and b <= 303.0 %}
              WNW
            {% elif b > 303.0 and b <= 326.0 %}
              NW
            {% elif b > 326.0 and b <= 348.0 %}
              NNW
            {% else %}
              ?
            {% endif %}
      nws_summary_1d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[0].detailed_description }}"
        attribute_templates:
          short_summary: "{{ states.weather.kcrq.attributes.forecast[0].detailed_description.split(',')[1].split('.')[0].title() }}"
          wind_summary: "{{ states.weather.kcrq.attributes.forecast[0].detailed_description.split('.')[1] }}"
          wind_speed: "{{ states.weather.kcrq.attributes.forecast[0].wind_speed }}"
          wind_bearing: >
            {% set b = states.weather.kcrq.attributes.forecast[0].wind_bearing|float %}
            {% if b > 348.0 and b <= 11.0 %}
              N
            {% elif b > 11.0 and b <= 33.0 %}
              NNE
            {% elif b > 33.0 and b <= 56.0 %}
              NE
            {% elif b > 56.0 and b <= 78.0 %}
              ENE
            {% elif b > 78.0 and b <= 101.0 %}
              E
            {% elif b > 101.0 and b <= 123.0 %}
              ESE
            {% elif b > 123.0 and b <= 146.0 %}
              SE
            {% elif b > 146.0 and b <= 168.0 %}
              SSE
            {% elif b > 168.0 and b <= 191.0 %}
              S
            {% elif b > 191.0 and b <= 213.0 %}
              SSW
            {% elif b > 213.0 and b <= 236.0 %}
              SW
            {% elif b > 236.0 and b <= 258.0 %}
              WSW
            {% elif b > 258.0 and b <= 281.0 %}
              W
            {% elif b > 281.0 and b <= 303.0 %}
              WNW
            {% elif b > 303.0 and b <= 326.0 %}
              NW
            {% elif b > 326.0 and b <= 348.0 %}
              NNW
            {% else %}
              ?
            {% endif %}
      nws_icon_1d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[0].condition }}"
      nws_summary_2d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[1].detailed_description }}"
        attribute_templates:
          short_summary: "{{ states.weather.kcrq.attributes.forecast[1].detailed_description.split(',')[1].split('.')[0].title() }}"
          wind_summary: "{{ states.weather.kcrq.attributes.forecast[1].detailed_description.split('.')[1] }}"
          wind_speed: "{{ states.weather.kcrq.attributes.forecast[1].wind_speed }}"
          wind_bearing: >
            {% set b = states.weather.kcrq.attributes.forecast[1].wind_bearing|float %}
            {% if b > 348.0 and b <= 11.0 %}
              N
            {% elif b > 11.0 and b <= 33.0 %}
              NNE
            {% elif b > 33.0 and b <= 56.0 %}
              NE
            {% elif b > 56.0 and b <= 78.0 %}
              ENE
            {% elif b > 78.0 and b <= 101.0 %}
              E
            {% elif b > 101.0 and b <= 123.0 %}
              ESE
            {% elif b > 123.0 and b <= 146.0 %}
              SE
            {% elif b > 146.0 and b <= 168.0 %}
              SSE
            {% elif b > 168.0 and b <= 191.0 %}
              S
            {% elif b > 191.0 and b <= 213.0 %}
              SSW
            {% elif b > 213.0 and b <= 236.0 %}
              SW
            {% elif b > 236.0 and b <= 258.0 %}
              WSW
            {% elif b > 258.0 and b <= 281.0 %}
              W
            {% elif b > 281.0 and b <= 303.0 %}
              WNW
            {% elif b > 303.0 and b <= 326.0 %}
              NW
            {% elif b > 326.0 and b <= 348.0 %}
              NNW
            {% else %}
              ?
            {% endif %}
      nws_icon_2d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[1].condition }}"
      nws_summary_3d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[2].detailed_description }}"
        attribute_templates:
          short_summary: "{{ states.weather.kcrq.attributes.forecast[2].detailed_description.split(',')[1].split('.')[0].title() }}"
          wind_summary: "{{ states.weather.kcrq.attributes.forecast[2].detailed_description.split('.')[1] }}"
          wind_speed: "{{ states.weather.kcrq.attributes.forecast[2].wind_speed }}"
          wind_bearing: >
            {% set b = states.weather.kcrq.attributes.forecast[2].wind_bearing|float %}
            {% if b > 348.0 and b <= 11.0 %}
              N
            {% elif b > 11.0 and b <= 33.0 %}
              NNE
            {% elif b > 33.0 and b <= 56.0 %}
              NE
            {% elif b > 56.0 and b <= 78.0 %}
              ENE
            {% elif b > 78.0 and b <= 101.0 %}
              E
            {% elif b > 101.0 and b <= 123.0 %}
              ESE
            {% elif b > 123.0 and b <= 146.0 %}
              SE
            {% elif b > 146.0 and b <= 168.0 %}
              SSE
            {% elif b > 168.0 and b <= 191.0 %}
              S
            {% elif b > 191.0 and b <= 213.0 %}
              SSW
            {% elif b > 213.0 and b <= 236.0 %}
              SW
            {% elif b > 236.0 and b <= 258.0 %}
              WSW
            {% elif b > 258.0 and b <= 281.0 %}
              W
            {% elif b > 281.0 and b <= 303.0 %}
              WNW
            {% elif b > 303.0 and b <= 326.0 %}
              NW
            {% elif b > 326.0 and b <= 348.0 %}
              NNW
            {% else %}
              ?
            {% endif %}
      nws_icon_3d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[2].condition }}"
      nws_summary_4d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[3].detailed_description }}"
        attribute_templates:
          short_summary: "{{ states.weather.kcrq.attributes.forecast[3].detailed_description.split(',')[1].split('.')[0].title() }}"
          wind_summary: "{{ states.weather.kcrq.attributes.forecast[3].detailed_description.split('.')[1] }}"
          wind_speed: "{{ states.weather.kcrq.attributes.forecast[3].wind_speed }}"
          wind_bearing: >
            {% set b = states.weather.kcrq.attributes.forecast[3].wind_bearing|float %}
            {% if b > 348.0 and b <= 11.0 %}
              N
            {% elif b > 11.0 and b <= 33.0 %}
              NNE
            {% elif b > 33.0 and b <= 56.0 %}
              NE
            {% elif b > 56.0 and b <= 78.0 %}
              ENE
            {% elif b > 78.0 and b <= 101.0 %}
              E
            {% elif b > 101.0 and b <= 123.0 %}
              ESE
            {% elif b > 123.0 and b <= 146.0 %}
              SE
            {% elif b > 146.0 and b <= 168.0 %}
              SSE
            {% elif b > 168.0 and b <= 191.0 %}
              S
            {% elif b > 191.0 and b <= 213.0 %}
              SSW
            {% elif b > 213.0 and b <= 236.0 %}
              SW
            {% elif b > 236.0 and b <= 258.0 %}
              WSW
            {% elif b > 258.0 and b <= 281.0 %}
              W
            {% elif b > 281.0 and b <= 303.0 %}
              WNW
            {% elif b > 303.0 and b <= 326.0 %}
              NW
            {% elif b > 326.0 and b <= 348.0 %}
              NNW
            {% else %}
              ?
            {% endif %}
      nws_icon_4d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[3].condition }}"
      nws_summary_5d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[4].detailed_description }}"
        attribute_templates:
          short_summary: "{{ states.weather.kcrq.attributes.forecast[4].detailed_description.split(',')[1].split('.')[0].title() }}"
          wind_summary: "{{ states.weather.kcrq.attributes.forecast[4].detailed_description.split('.')[1] }}"
          wind_speed: "{{ states.weather.kcrq.attributes.forecast[4].wind_speed }}"
          wind_bearing: >
            {% set b = states.weather.kcrq.attributes.forecast[4].wind_bearing|float %}
            {% if b > 348.0 and b <= 11.0 %}
              N
            {% elif b > 11.0 and b <= 33.0 %}
              NNE
            {% elif b > 33.0 and b <= 56.0 %}
              NE
            {% elif b > 56.0 and b <= 78.0 %}
              ENE
            {% elif b > 78.0 and b <= 101.0 %}
              E
            {% elif b > 101.0 and b <= 123.0 %}
              ESE
            {% elif b > 123.0 and b <= 146.0 %}
              SE
            {% elif b > 146.0 and b <= 168.0 %}
              SSE
            {% elif b > 168.0 and b <= 191.0 %}
              S
            {% elif b > 191.0 and b <= 213.0 %}
              SSW
            {% elif b > 213.0 and b <= 236.0 %}
              SW
            {% elif b > 236.0 and b <= 258.0 %}
              WSW
            {% elif b > 258.0 and b <= 281.0 %}
              W
            {% elif b > 281.0 and b <= 303.0 %}
              WNW
            {% elif b > 303.0 and b <= 326.0 %}
              NW
            {% elif b > 326.0 and b <= 348.0 %}
              NNW
            {% else %}
              ?
            {% endif %}
      nws_icon_5d:
        value_template: "{{ states.weather.kcrq.attributes.forecast[4].condition }}"
3 Likes

This isn’t a pure drop-in replacement. You have both day and night forecasts, so it depends on how your display works whether this is acceptable. The suffixes also won’t make much sense. For example nws_summary_1d will either be todays forecast or tonights forecast. nws_summary_2d will either be tonights forecast or tomorrows day forecast.

Yes it’s a drop in as is openweathermap … the additionAl sensors are to mimic dark_sky for use in tileboard for wall mounted displays

Openweathermap just released a new API “One Call API” This can be a good alternative to dark sky. https://openweathermap.org/api/one-call-api

This api provide the following data:

  • Current weather
  • Hourly forecast for 48 hours
  • Daily forecast for 7 days
  • Historical weather data for 5 previous days

There is also a feature request to integrate this API into HA: https://community.home-assistant.io/t/convert-openweathermap-integration-to-use-one-call-api/

1 Like

Great. Should be nice if they had a human readable daily text for TTS usage.

Someone just created this custom component and added it HACS. It is working as a perfect drop-in replacement for my so far. It even includes the Low Temp I am using in a sensor which NWS and OpenWeatherMap did not.

1 Like

Do you get what you need from the free weatherbit offering, including after the 1st month is up?

Has anyone tried the official Openweathermap Integration in Home Assistant?
Is it accurate enough to be a replacement for Dark Sky?
The yr.no weather integrations is pretty good, but it is only average with accuracy for Australia and the Australian BOM integration, although it works, does not bring in correct data that Home Assistant can use properly for forecasts and current condtions.

I signed up for the free plan. I don’t have a card on file. I could be wrong, but I believe the free plan resets every month without cost.

FYI, the developer limits queries to 4 per hour which gives you enough room to track 5 locations.

Annotation 2020-05-17 095856

I have tried OpenWeatherMap, National Weather Service (US only), and Weatherbit. OpenWeatherMap seemed good, but it was missing the daily low temperature forecast.

I realize the National Weather Service won’t cover you @brendan but I want US readers to know it was very comparable to OpenWeatherMap. While it appears to have been fixed it was frequently offline when I tried it.

You are correct with OpenWeatherMap missing the low temperatures.
NWS seems like a good option for US from what I read and it seems to send data in the right format, unlike our local BOM service.

Weatherbit seems like it could be quite usable and the custom component is available in HACS.
I’ll test this one, but it could be a contender to officially replace Darksky.
The thing I miss about from Darksky. It use to say Clear, Night or Cloudy, Night. Weathermap and Weatherbit and also yr.no all just say “Sunny” or “Cloudy”.
It messes with my Animated Background.

Hi Brendan,
I am the Author of the Weatherbit Integration, and unfortunately Weatherbit does not provide specific Icons for Day and Night. But let me look in to this. Maybe changing the Icon (If relevant) by tracking the local time (Sunset/Sunrise).

1 Like

@briis
I use an addon called Lovelace Animated Background ( https://github.com/Villhellm/lovelace-animated-background ) . It uses the weather.xxxxx and takes the current weather condition direct from what is reported.
If you can help with that, it would be appreciated (like adding night if it was after sunset, so sunny changes to clear night or whatever) It sounds like it could be a bit of hard work to get that to happen though.

I looked in to my code, and it should be possible to return if it’s night at the location you get data for. Then I just need to report the right icon based on day/night. I am away a few days, but look in to it by the end of the week.

@briis If it can report Clear, Night or Cloudy, Night etc that will work as HA will add the correct icons automatically in the weather card I believe
Thanks for checking into that.

That is also how my code works. I map icon numbers from weatherbit to the HA definitions. I just need to report a different state if it’s night.

Yes! Sign up for the “Free” Weather API tier! The Free plan is free for non-commercial use. Some features of the “Free” plan are only available on a trial basis for 30 days after enrollment. After the trial period, these features will be disabled.

I am wondering what features are disabled after the first month.