Replacement for the default Dark Sky Home Assistant integration using Pirate Weather

Overview

Pirate Weather Integrations

This integration is designed to replace the default Dark Sky integration in Home Assistant with a slightly modified, but fully compatible version that relies on the Pirate Weather API instead!

To get a feel for the data returned by this API, check out https://weather.pirateweather.net!

I'm really hoping to keep free access going for this API, but it does take money to run the AWS back-end. If you'd like to support this project, I have a sponsorship link setup on my profile!

Notices

This integration will take priority over the built-in Dark Sky integration. While it is deigned to be a drop in replacement, it is possible that small differences will occur. The underlying API should return similar results, but specific weather variables may be missing, and additional testing is needed to find and correct these edge cases. Please document any issues, and I can either update this integration or the weather API.

The two most notable missing pieces at the moment are the language options and text summaries. Both of those are possible with the way I have things designed, but I need to write the code that generates the text, and then feed that into the Dark Sky translation module. For now, the text will display whatever the icon is showing, and it will always be in English.

Why?

Since the Dark Sky API will be shutting down this year, I set out to write an alternative API that would return results with the identical syntax, allowing it to be used as a drop in replacement. This culminated in the Pirate Weather API, which is a series of AWS lambda functions that read, process, and serve NOAA weather forecasts in same style and syntax as the Dark Sky API did.

This integration allows for any Home Assistant setup that uses Dark Sky to continue operating after it shuts down. While other weather integrations are available, this preserves anything that relies on unique aspects of Dark Sky (such as the minute-by-minute forecast) and let’s existing dashboards keep working. Plus, if you're interested in knowing exactly how your weather forecasts are generated, this is the "show me the numbers" approach, since the data returned is directly from NOAA, and every processing step I do is documented. If you're the sort of person who wants a dense 34-page PowerPoint about why it rained when the forecast said it wouldn't, then this might be for you.

What It Does

This integration adds creates custom sensor.py and weather.py files to change their data source from Dark Sky to Pirate Weather. Specifically, these functions are built around the forecast.io python package, and so instead of calling forecastio.load_forecast, they call forecastio.manual, which allows for a different API URL to be used.

The only other change is to call the API every 15 minutes instead of every 3. I only just graduated, so trying to keep my AWS bill reasonable here. If you need a more frequent update interval, or would like to support this project, I've set up a donation link!

Buy Me A Coffee

Documentation

Since this integration returns the same type of data as the default Dark Sky integration, the parameter documentation is the same as described at https://www.home-assistant.io/integrations/weather.darksky for the weather card and here: https://www.home-assistant.io/integrations/darksky/ for the sensor.

Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_component directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called darksky.
  4. Download all the files from the custom_components/darksky/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. Register for a Pirate Weather API Key here: https://pirateweather.net/
  8. Log into the Pirate Weather API interface (https://pirateweather.net/apis), select PirateForecast Beta, and click Subscribe!

Either add or edit to your configuration.yaml file with this block, using the new API key:

weather:
  - platform: darksky
    api_key: <APIKEY>
Comments
  • Testers needed for config flow integration update

    Testers needed for config flow integration update

    Hi everyone,

    Since I launched this a year ago, I've been blown away by the enthusiasm and support I've received for this project! It's been amazing to hear all the different use cases, and the API has improved considerably over the past 12 months.

    One important update is to modernize this integration away from just relying on the Home Assistant Dark Sky integration to one that can be setup from the GUI, uses coordinated updates, and supports modern Home Assistant API calls. In short, this is that update.

    For anyone interested, I'm looking for some people to try out the new version and get some feedback on what works, what doesn't and where the rough edges are. From my testing, everything seems stable, but since this is a major change I want to test it out as much as possible before a wider release.

    As a starting point, this version should behave exactly the same way the production one currently does. If you have an entry in your configuration.yaml. then a new weather entity and/or sensors will be created, and should be identical. Anything else is a bug. Moreover, this integration should now be able to be set up from the GUI integrations page, producing the same integrations that currently exist.

    To install and test this version, you'll need to manually patch the "dev-config-flow" branch into your custom_components directory using SSH and restart Home Assistant Core:

    cd "/config/custom_components/"
    mv "/config/custom_components/pirateweather/manifest.json" "/config/custom_components/pirateweather/manifest.json.old"
    mv "/config/custom_components/pirateweather" "/config/custom_components/pirateweather.old"
    git clone --branch dev-config-flow https://github.com/alexander0042/pirate-weather-ha.git
    mv "/config/custom_components/pirate-weather-ha/custom_components/pirateweather" "/config/custom_components/pirateweather"
    

    The two outstanding known issues are cleaning up the text options for the monitored conditions, and updating the installation instructions in the README, but I'm sure more will crop up as people start using this version.

    Thanks again for the help, and let me know it goes!

    help wanted 
    opened by alexander0042 61
  • After removing pirateweather references from config.yaml, 0d sensors not present

    After removing pirateweather references from config.yaml, 0d sensors not present

    hey @alexander0042 ... I was looking at my logs and they said to remove the pirateweather references from my config.yaml as they were no longer needed - I did, but now I no longer have access to those 0d sensors. Did I miss something, or did the logs mislead me?

    This error originated from a custom integration.
    
    Logger: custom_components.pirateweather.weather
    Source: custom_components/pirateweather/weather.py:137
    Integration: Pirate Weather (documentation, issues)
    First occurred: 10:26:59 AM (1 occurrences)
    Last logged: 10:26:59 AM
    
    Configuration of Pirate Weather (weather entity) in YAML is deprecated Your existing configuration has been imported into the UI automatically and can be safely removed from your configuration.yaml file
    

    Originally posted by @chicknlil in https://github.com/alexander0042/pirate-weather-ha/issues/58#issuecomment-1328074700

    opened by chicknlil 34
  • sunset_time & sunset_time sensors missing

    sunset_time & sunset_time sensors missing

    Hi!

    I have added the following to my config monitored_conditions:

    - sunset_time
    - sunrise_time
    

    However, these sensors do not appear. Is there something special about them?

    documentation 
    opened by JCHH2 29
  • FEATURE REQUEST: History

    FEATURE REQUEST: History

    Based on past issues I know you were looking for other ways to build this out so I thought I would drop this here and if nothing comes of it no big deal.

    1. I dont know if im missing this but there isnt an attribute for precipitation. This would be useful.
    2. Would be nice to have history based on the last 24 hours/week in a sensor/weather card/ anything i can pull from. My use case is i currently poll an outside/alternative weather api hourly to find the last 24 hours worth of precipitation gauge against if i should run my sprinklers. I have my own automation then adding that up so over the course of the past week if that number is too high it wont run them either. This might be a hyper specific use case but ive seen a lot of people in the community looking for/using similar data points and i would love to keep this local to your integration rather than using a few different apis which all pull from different sources. less points of failure.

    Thanks!

    documentation 
    opened by Scags104 19
  • Using 2 locations with PirateWeather... worked in DarkSky...

    Using 2 locations with PirateWeather... worked in DarkSky...

    I have the following config, I have installed PirateWeather via HACS and renamed the folder to darksky. It appears that my local home location is indeed being used, but my secondary location is not populated. This config worked in darksky, can I not look at 2 locations?

    #### PirateWeather acting as DarkSky ####
      - platform: darksky
        api_key: xxxxxxx
    # Additional optional values:
        mode: "daily"
        name: Homer
        scan_interval:
    # At least one of these must be specified:
          days: 0
          hours: 0
          minutes: 5
          seconds: 0
          milliseconds: 0
        
    #### PirateWeather acting as DarkSky ####
      - platform: darksky
        api_key: xxxxxxxxxxx
        name: Greenup
        latitude: 39.2478159
        longitude: -88.1633719
        mode: daily
        scan_interval:
      # At least one of these must be specified:
          days: 0
          hours: 0
          minutes: 15
          seconds: 0
          milliseconds: 0 
    

    image

    Adding my sensor config...

    - platform: darksky
      api_key: !secret pirateweather-api
      forecast:
          - 0
          - 1
          - 2
          - 3
          - 4
          - 5
      monitored_conditions:
        - summary
        - icon
        - temperature
        - summary
        - precip_probability
        - apparent_temperature
        - wind_speed
        - wind_gust
        - wind_bearing
        - humidity
        - temperature_high
        - temperature_low
        - nearest_storm_distance
        - nearest_storm_bearing
        - minutely_summary
        - hourly_summary
        - daily_summary
      scan_interval:
        # At least one of these must be specified:
        days: 0
        hours: 0
        minutes: 15
        seconds: 00
        milliseconds: 0
    
    opened by mattlward 13
  • Reported wind speed is higher than actual

    Reported wind speed is higher than actual

    Residing in Central Ohio, USA here. The wind speed is being reported in the low 40mph range, but is actually much much lower (I fly drones which is I'm noticing).

    bug 
    opened by tvtechdir 12
  • hPa decimals

    hPa decimals

    Thanks for your work; love it!

    But how do I round the decimals for hPa using Pirateweather? When using yr.no or Swedish SMHI as provider, there are "normal" decimals...

    Screenshot 2021-09-17 at 14 45 20
    opened by TheLordVader 10
  • Precipitation is null

    Precipitation is null

    Many thanks for maintaining this integration. I am trying to compare different forecasters using the custom:apexchart-card. One of the plots is several different weather providers forecast for precipitation. I don't know what darksky did/does, but all of the other ones return the number zero for no precipitation, but pirateweather returns 'null'. Could this be changed to zero, also? Is this maybe something that needs to be addressed at pirateweather.net? Or, is it there to keep correspondence with darksky?

    opened by jds11111 9
  • Icons

    Icons

    The last two nights at my location it got foggy overnight but when I checked the website it showed a visibility value of 0.1km but it did not show the fog icon.

    As far as I am aware a visibility under 1km is considered fog though it might need to be over 75% humidity like Mist needs to be otherwise it would be considered Haze/Smoke/etc.

    If you need an example here is Thunder Bay, Ontario where it has a visibility of 0.1km. The two blank icons on the weather page are the fog icons (that also needs to be fixed) and checking the api it seems that it shows when the visibility is exactly 0. image

    bug 
    opened by cloneofghosts 9
  • Sensor name doesn't act as expected and renaming creates orphans

    Sensor name doesn't act as expected and renaming creates orphans

    I am using the precip_probability monitored condition and my app is up-to-date.

    The name of the sensor that gets created ends up as a concatenated string of 'Name' and sensor type (I think) instead of using just the 'Name'.

    I set the sensor name to Zebra in my sensors.yaml file:

    - platform: pirateweather
      name: Zebra
      api_key: 6mwfdaJRNy39nrnNIUXwXhUV7FxSmbZ8HSW9m253
      scan_interval: "00:05:00"
      monitored_conditions:
        - precip_probability
    

    You can see in this screenshot, the newest sensor with 'Zebra' in the name contains more than just Zebra. Further, renaming the sensor in the config leads to some duplicate orphan sensors: List of random sensors

    Not sure what other info will be useful or what troubleshooting I can do. Thanks!

    opened by joaldes 8
  • Unable to connect to PirateWeather - CertificateError

    Unable to connect to PirateWeather - CertificateError

    When HA starts, I'm getting the following error: 2022-05-27 19:27:28 ERROR (SyncWorker_3) [custom_components.pirateweather.weather] Unable to connect to PirateWeather. HTTPSConnectionPool(host='api.pirateweather.net', port=443): Max retries exceeded with url: /forecast/om3xxPNoEt94XXXXXXXXXXCM78xtHiJ2s5iZsYa/XX.XXX50780789178,-XXX.XXX9254007341?units=us (Caused by SSLError(CertificateError("hostname 'api.pirateweather.net' doesn't match either of 'susi.comcast.net', '*.aws-np.susi.comcast.net', '*.aws-np.susi.xfinity.com', '*.aws.susi.comcast.net', '*.aws.susi.xfinity.com', '*.susi.comcast.net', '*.susi.xfinity.com', 'register-dev.xfinity.com', 'register-ng.xfinity.com', 'register-qa.xfinity.com', 'register-st.be.xfinity.com', 'register-st.xfinity.com', 'register-wg-st.bi.xfinity.com', 'register-wg-st.xfinity.com', 'register-wg.bi.xfinity.com', 'register-wg.xfinity.com', 'register.be.xfinity.com', 'register.xfinity.com'")))

    Yet when I visit the URL directly I get valid JSON: https://api.pirateweather.net/forecast/om3xXXXXXXXXXXXXXXXXXn3fCM78xtHiJ2s5iZsYa/XX.XX450780789178,-XXX.XXX29254007341?units=us

    (sensitive info redacted)

    Running: e95083f HA: 2022.5.5 In Docker; official container

    I'm not understanding why it's trying to compare api.pirateweather.net with a .xfinity.* cert.

    opened by xstrex 8
  • sensor.pirateweather_temperature is using native unit of measurement

    sensor.pirateweather_temperature is using native unit of measurement

    After Update to HA 2023.1 I get following warning în logs

    Logger: homeassistant.components.sensor Source: components/sensor/init.py:980 Integration: Sensor (documentation, issues) First occurred: 00:00:45 (2 occurrences) Last logged: 00:00:45

    Entity sensor.pirateweather_temperature (<class 'custom_components.pirateweather.sensor.PirateWeatherSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('temperature') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author. Entity sensor.pirateweather_humidity (<class 'custom_components.pirateweather.sensor.PirateWeatherSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('humidity') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

    opened by smarthomefamilyverrips 0
  • Integration is using deprecated `DEVICE_CLASS_*` constants

    Integration is using deprecated `DEVICE_CLASS_*` constants

    This custom integration uses deprecated DEVICE_CLASS_* constants in its codebase.

    The DEVICE_CLASS_* constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.

    For example, for the device classes supported by the sensor platform, there is now a SensorDeviceClass enum. So if a sensor previously used the DEVICE_CLASS_ENERGY constant, it should now use SensorDeviceClass.ENERGY. Other platforms (like binary_sensor, and number) provide similar enumerations for their supported device classes.

    The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.

    If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!

    Kindest regards,

    ../Frenck

    opened by frenck 0
  • no weather entities created

    no weather entities created

    I installed via HACS and set API key. only activated weather - but here is no entitie created nor a lovelace card. only the default weather forecast from hass shows up.

    any suggestion how to debug?

    opened by trackhacs 3
  • No module named '_bz2'

    No module named '_bz2'

    Version | core-2022.12.8
    
    Installation Type | Home Assistant Core
    Development | false
    Supervisor | false
    Docker | false
    User | homeassistant
    Virtual Environment | true
    Python Version | 3.10.5
    Operating System Family | Linux
    Operating System Version | 5.10.0-20-amd64
    CPU Architecture | x86_64
    

    After installing version 1.0 , I get the following error:

    Logger: homeassistant.config_entries
    Source: config_entries.py:834
    First occurred: 16:35:07 (1 occurrences)
    Last logged: 16:35:07
    
    Error occurred loading configuration flow for integration pirateweather: No module named '_bz2'
    
    opened by conrad66 1
  • Forecast is way off for whole country or so or seems

    Forecast is way off for whole country or so or seems

    Hey,

    The Api had been quite imprecise lately. Its been telling me sunny last couple of days, when it's been nothing but cloudy. I tried changing locations but it keeps saying sunny, while other forecasters are more precise.

    I live in the Netherlands.

    opened by JBakers 7
Releases(v1.0.1)
  • v1.0.1(Dec 29, 2022)

  • v1.0.0(Dec 21, 2022)

    This is a major rewrite of this integration to allow it to be added via the UI, optimize API calls via an update coordinator, and generally bring it into compliance with modern Home Assistant standards. Existing configuration.yaml setups should be seamlessly integrated, and can be safely removed after the initial start.

    A major thank you to everyone who has helped this project by sponsoring it, debugging this update, providing feedback, and using it! This integration and API have come a long way in the last year, and wouldn't have been possible without the support I've received from the community.

    Source code(tar.gz)
    Source code(zip)
A Python app which retrieves the rank and players' equipped skins during a match

VALORANT rank yoinker About The Project Usage Contributing Contact Acknowledgements Disclaimer About The Project Their Queue Current Skin Current Rank

Isaac Kenyon 270 Jan 04, 2023
The Best Telegram UserBot Made With Pyrogram [Python]

Asterix UserBot A Powerful Telegram userbot based on Pyrogram. How To Deploy Asterix Heroku Railway Qovery Termux Tutorial Railway Deploy Comming Soon

TeamAsterix 9 Oct 17, 2022
ChairBot is designed to be reliable, easy to use, and lightweight for every user, and easliy to code add-ons for ChairBot.

ChairBot is designed to be reliable, easy to use, and lightweight for every user, and easliy to code add-ons for ChairBot. Ready to see whats possible with ChairBot?

1 Nov 08, 2021
It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.

Reco PC Server Reco PC Server is a cross platform PC Controller Discord Bot which is a modified and improved version of Chimera for Reco-Discord PC Re

Arvinth Krishna 12 Aug 31, 2022
discord token grabber scam - eductional purposes only!

Discord-QR-Scam תופס אסימון תמונה של Discord על אודות סקריפט Python שיוצר אוטומטית קוד QR הונאה של Nitro ותופס את אסימון הדיסקורד בעת סריקה. כלי זה מד

Amit Pinchasi 0 May 22, 2022
PTV is a useful widget for trading view for doing paper trading when bar reply is enabled

PTV is a useful widget for trading view for doing paper trading when bar reply is enabled.(this feature did not implement in trading view)

Ali Moradi 39 Dec 26, 2022
Instagram GiftShop Scam Killer

Instagram GiftShop Scam Killer A basic tool for Windows which kills acess to any giftshop scam from Instagram. Protect your Instagram account from the

1 Mar 31, 2022
A CLI tool to transfer, sync, and backup playlists on music streaming services

unitunes A command-line interface tool to manage playlists across music streaming services. Introduction unitunes manages playlists across streaming s

Victor Tao 50 Jan 07, 2023
WhatSender is a python package that allows you to send Whatsapp messages at a given time.

WhatSender is a python package that allows you to send Whatsapp messages at a given time.

IdoBarel 0 Apr 21, 2022
An unofficial Python wrapper for the 'Binance exchange REST API'

Welcome to binex_f v0.1.0 many interfaces are heavily used by myself in product environment, the websocket is reliable (re)connected. Latest version:

DeepLn 2 Jan 05, 2022
Discord Bot for server hosts, devs, and admins. Analyzes timings reports & uploads text files to hastebin. Developed by https://birdflop.com.

"Botflop" Click here to invite Botflop to your server. Current abilities Analyze timings reports Paste a timings report to review an in-depth descript

Purpur 76 Dec 31, 2022
Posts word definitions on Twitter daily

Word Of The Day bot Post daily word definitions on social media. Twitter account: https://twitter.com/WordOfTheDay_B Introduction The goal of this pro

Lucas Rijllart 1 Jan 08, 2022
See GitHub API on terminal

gitbees About gitbees uses the GitHub API to show user data and ``repos` Using Make sure you have a python interpreter and then python gitbees.py Lice

Marcello Belanda 1 Nov 29, 2021
Total time of all YouTube videos in a playlist.

Youtube Playlist Total Times Total time of all YouTube videos in a playlist. How to Use Download chromedriver depending on your os and chrome version

Mohammad Dori 3 Jul 15, 2022
This Code is Property of Rehyann Saini. Feel Free to use this Project.

Email-Spammer Rehyann Saini in Collabration With Fe13 Productions This is an easy to use Dev Friendly Email spammer... #Important Things to know..! St

Rehyann Saini 1 Jan 14, 2022
troposphere - Python library to create AWS CloudFormation descriptions

troposphere - Python library to create AWS CloudFormation descriptions

4.8k Jan 06, 2023
Automatic login to Microsoft Teams conferences

Automatic login to Microsoft Teams conferences

Xhos 1 Jan 24, 2022
Advanced telegram link in a message attach bot

Attach-Bot-V2 An advanced telegram attach bot Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com

Fayas Noushad 8 Oct 21, 2022
Python client for the LightOn Muse API

lightonmuse Python bindings to production-ready intelligence primitives powered by state-of-the-art language models. Create. Process. Understand. Lear

LightOn 12 Apr 10, 2022
Sniper for Anigame and Izzi discord bots!

Anigame Sniper Gen-3 Features Inbuilt Spammer Responds to your messages in discord (on/off) Snipes only where you want it to Set latency so that the b

22 Nov 13, 2022