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)
Python API client library for phpIPAM installations

phpypam: Python API client library for phpIPAM installation As we started to develop phpipam-ansible-modules we used an existing python library for ph

codeaffen 3 Aug 03, 2022
Polars-fun - Example notebooks for how to use pola.rs

polars-fun Polars is an awesome Rust DataFrame library with Python language bindings. This repo makes it easy to run Polars code on your local machine

Matthew Powers 2 Jun 28, 2022
It connects to Telegram's API. It generates JSON files containing channel's data, including channel's information and posts.

It connects to Telegram's API. It generates JSON files containing channel's data, including channel's information and posts. You can search for a specific channel, or a set of channels provided in a

Esteban Ponce de Leon 75 Jan 02, 2023
Autofilterv5 With Same more Features

Autofilterv5 With Same more Features ✨ Imbd + Index +.....

Selfie SD 8 Oct 21, 2022
Administration Panel for Control FiveM Servers From Discord

FiveM Discord Administration Panel Version 1.0.0 If you would like to report an issue or request a feature. Join our Discord or create an issue. Contr

NIma 9 Jun 17, 2022
The Python client library for the Tuneup Technology App.

Tuneup Technology App Python Client Library The Python client library for the Tuneup Technology App. This library allows you to interact with the cust

Tuneup Technology 0 Jun 29, 2022
An API serving data on all creatures, monsters, materials, equipment, and treasure in The Legend of Zelda: Breath of the Wild

Hyrule Compendium API An API serving data on all creatures, monsters, materials, equipment, and treasure in The Legend of Zelda: Breath of the Wild. B

Aarav Borthakur 116 Dec 01, 2022
Jira-cache - Jira cache with python

Direct queries to Jira have two issues: they are sloooooow many queries are impo

John Scott 6 Oct 08, 2022
Ivan Telegram Userbot with python

Riviani Ramadhan Ivan-Ubot Pada Dasarnya Ivan-Ubot adalah userbot Telegram modular yang berjalan di Python3 dengan database sqlalchemy. Berbasis Paper

1 Oct 29, 2021
Create CDK projects with projen

The Projenator: I'll be back! Description This is a CDKv2 project that takes the grind out of setting up new cdk projects/implementations by using aut

Andrew 2 Dec 11, 2021
A complete Python application to automatize the process of uploading files to Amazon S3

Upload files or folders (even with subfolders) to Amazon S3 in a totally automatized way taking advantage of: Amazon S3 Multipart Upload: The uploaded

Pol Alzina 1 Nov 20, 2021
PepeSniper is an open-source Discord Nitro auto claimer/redeemer made in python.

PepeSniper is an open-source Discord Nitro auto claimer made in python. It sure as hell is not the fastest sniper out there but it gets the job done in a timely and stable manner. It also supports ho

Unknown User 1 Dec 22, 2021
The implementation of Learning Instance and Task-Aware Dynamic Kernels for Few Shot Learning

INSTA: Learning Instance and Task-Aware Dynamic Kernels for Few Shot Learning This repository provides the implementation and demo of Learning Instanc

11 Jan 02, 2023
A bot that updates about the most subscribed artist' channels on YouTube

A bot that updates about the most subscribed artist' channels on YouTube. A weekly top chart report is provided every Monday. It posts updates on Twitter

Marco Fantauzzo 5 Dec 14, 2022
discord voice bot to stream radio

Radio-Id Bot (Discord Voice Bot) Radio-id-bot (Radio Indonesia) is a simple Discord Music Bot built with discord.py to play a radio from some Indonesi

Adi Fahmi 20 Sep 20, 2022
Bot for automated buying boxes on Binance

V 1.0 Bot for automated buying boxes on Binance В settings.py выставляем свои COOKIE и свой CSRFTOKEN В settings.py для headers выставляем свои параме

Matvey 3 Jan 18, 2022
Grocy-create-product - A script supports the batch creation of new products in Grocy

grocy-create-product This script supports the batch creation of new products in

André Heuer 6 Jul 28, 2022
Request based Python module(s) to help with the Newegg raffle.

Newegg Shuffle Python module(s) to help you with the Newegg raffle How to use $ git clone https://github.com/Matthew17-21/Newegg-Shuffle $ cd Newegg-S

Matthew 45 Dec 01, 2022
Collaboration with Microsoft, AWS, Google, and ETHZürich Analytics Club (2022 Datathon Project)

DATATHON_ Collaboration with Microsoft, AWS, Google, and ETHZürich Analytics Club (2022 Datathon Project) Datathon Original Challenge SAV DataDays Rei

esthi 34 Nov 10, 2022
Lazy airdrop based on private temporary ids

LobsterDAO This uses a modified MerkleDistributor, which allows to issue a lazy airdrop using temporary IDs. In this example it uses Telegram chat_id

41 Sep 10, 2022