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 API wrapper for the Twitter API!

PyTweet PyTweet is an api wrapper made for twitter using twitter's api version 2! Installation Windows py3 -m pip install PyTweet Linux python -m pip

TheFarGG 1 Nov 19, 2022
Automatically deploy freqtrade to a remote Docker host and auto update strategies.

Freqtrade Automatically deploy freqtrade to a remote Docker host and auto update strategies. I've been using it to automatically deploy to vultr, but

p-zombie 109 Jan 07, 2023
A Python API For Questionnaire

Инструкция по разворачиванию приложения Окружение проекта: python 3.8 Django 2.2.10 djangorestframework Склонируйте репозиторий с помощью git: git clo

2 Feb 14, 2022
Low-level, feature rich and easy to use discord python wrapper

PWRCord Low-level, feature rich and easy to use discord python wrapper Important Note: At this point, this library API is considered unstable and can

MIguel Lopes 1 Dec 26, 2021
Este programa tem como objetivo o cadastro dos usuários. Assim, caso a autenticação seja feita, permitir que o usuário entre em determinado sistema ou programa.

LoginPy Este programa tem como objetivo o cadastro dos usuários. Assim, caso a autenticação seja feita, permitir que o usuário entre em determinado si

Jonas Carvalho 4 Dec 23, 2021
Un bot leggero basato su py-cord facile da hostare sul cloud

GalbiBot Un bot leggero basato su py-cord facile da hostare sul cloud Guida installazione su una macchina Per far funzionare il bot devi aver installa

Galbaninoh 2 Oct 21, 2022
This will create new discord accounts and add them to your server

Discord-Botter This tool will create new discord accounts add them to your server, this tool needs a captcha api like capmonster.cloud or anti-captcha

Shahzain 27 Nov 30, 2022
Telegram bot for searching videos in your PDisk account by @AbirHasan2005

PDisk-Videos-Search A Telegram bot for searching videos in your PDisk account by @AbirHasan2005. Configs API_ID - Get from @TeleORG_Bot API_HASH - Get

Abir Hasan 39 Oct 21, 2022
A Telegram bot to download youtube playlists and upload them to telegram. (may be slow becoz youtube limitations)

YTPlaylistDL 📛 A Telegram bot to download youtube playlists and upload them to telegram. (may be slow becoz youtube limitations) 🎯 Follow me and sta

Anjana Madu 43 Dec 28, 2022
Python client for numerbay.ai - the Numerai community marketplace

NumerBay Python API Programmatic interaction with numerbay.ai - the Numerai community marketplace. If you encounter a problem or have suggestions, fee

Numerai Council of Elders 5 Nov 30, 2022
Automatically download any NFT collection from OpenSea.

OpenSea NFT Stealer The sole purpose of this script is to download any NFT collection from OpenSea. How does it work? Basically, the OpenSea website a

Dan 111 Dec 29, 2022
Simple VK API wrapper for Python

VK Admier: documentation VK Admier is simple VK API wrapper for community bot development. Authorization You should create bot object from Client clas

Egor Light 2 Nov 10, 2022
A Discord Self bot written in python

WitheredBot A Discord Self bot written in python Requirement Python = 3.9 How to Configure git clone https://github.com/a-a-a-aa/WitheredBot.git cd W

......... 0 Jan 05, 2023
A simple telegram bot that resolves video urls using yt-dlp

URL to Video Telegram Bot A simple telegram bot that resolves video urls using yt-dlp Copyright (C) 2021 Vítor Vasconcellos This program is free softw

Vítor 1 Nov 18, 2021
A Telegram bot that can stream Telegram files to users over HTTP

AK-FILE-TO-LINK-BOT A Telegram bot that can stream Telegram files to users over HTTP. Setup Install dependencies (see requirements.txt), configure env

3 Dec 29, 2021
A compatability shim between Discord.py and Hikari.

Usage as a partial shim: import discord import hikari import hikari_shim dpy_bot = discord.Client(intents=discord.Intents.all(), enable_debug_events=

EXPLOSION 3 Dec 25, 2021
Whatsapp-bot - Whatsapp chatbot build with python and twilio

Whatsapp-bot This is a Whatsapp Chatbot that responds with quotes, reply owners

arinzejustinng 1 Jan 14, 2022
An API that uses NLP and AI to let you predict possible diseases and symptoms based on a prompt of what you're feeling.

Disease detection API for MediSearch An API that uses NLP and AI to let you predict possible diseases and symptoms based on a prompt of what you're fe

Sebastian Ponce 1 Jan 15, 2022
A Discord/Xenforo bot!

telathbot A Discord/Xenforo bot! Pre-requisites pyenv (via installer) poetry Docker (with Go version of docker compose enabled) Local development Crea

Telath 4 Mar 09, 2022
Open Source API and interchange format for editorial timeline information.

OpenTimelineIO is currently in Public Beta. That means that it may be missing some essential features and there are large changes planned. During this phase we actively encourage you to provide feedb

Pixar Animation Studios 1.2k Jan 01, 2023