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)
Home Assistant for Opendata CWB. Get the weather forecast of the city in Taiwan.

Home assistant support for Opendata CWB. The readme in Traditional Chinese. This integration is based on OpenWeatherMap (@csparpa, pyowm) to develop.

null 11 Sep 30, 2022
Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially maintained by the Tuya Developer Team.

Tuya Home Assistant Integration Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially mainta

Tuya 704 Jan 3, 2023
Home Assistant Hilo Integration via HACS

BETA This is a beta release. There will be some bugs, issues, etc. Please bear with us and open issues in the repo. Hilo Hilo integration for Home Ass

null 66 Dec 23, 2022
Weather Tracker, made with Python using Open Weather API

Weather Tracker Weather Tracker, made with Python using Open Weather API

Sahil Kumar 1 Feb 7, 2022
Visual Weather api. Returns beautiful pictures with the current weather.

VWapi Visual Weather api. Returns beautiful pictures with the current weather. Installation: sudo apt update -y && sudo apt upgrade -y sudo apt instal

Hotaru 33 Nov 13, 2022
Design and build a wrapper for the Open Weather API current weather data service

Design and build a wrapper for the Open Weather API current weather data service that returns a city's temperature, with caching, also allowing for the temperature of the latest queried cities that are still validly cached to be retrieved.

Duan Rafael Ribeiro 1 Jun 27, 2022
Insane Weather Bot is here! Give suggestions, fork, and do much more to help us enhance the abilities of Insane Weather Bot.

Insane_Weather_Bot Insane Weather Bot is here! Give suggestions, fork, and do much more to help us enhance the abilities of Insane Weather Bot. Weathe

null 1 Jan 2, 2022
Techie Sneh 19 Dec 3, 2021
Generate direct m3u playlist for all the channels subscribed in the Tata Sky portal

Tata Sky IPTV Script generator A script to generate the m3u playlist containing direct streamable file (.mpd or MPEG-DASH or DASH) based on the channe

Gaurav Thakkar 250 Jan 1, 2023
Chronocalc - Calculates the dates and times when the sun or moon is in a given position in the sky

Chronocalc I wrote this script after I was busy updating my article on chronoloc

null 16 Dec 13, 2022
A Chip-8 emulator written using Python's default libraries

Chippure A Chip-8 emulator written using Python's default libraries. Instructions: Simply launch the .py file and type the name of the Chip8 ROM you w

null 5 Sep 27, 2022
Change between dark/light mode depending on the ambient light intensity

svart Change between dark/light mode depending on the ambient light intensity Installation Install using pip $ python3 -m pip install --user svart Ins

Siddharth Dushantha 169 Nov 26, 2022
A quick and dirty script to scan the network, find default credentials on services and post a message to a Slack channel with the results.

A quick and dirty script to scan the network, find default credentials on services and post a message to a Slack channel with the results.

Security Weekly 11 Jun 3, 2022
A simple tool that allows you to change your default AWS CLI profile.

Select AWS Profile Select AWS Profile (slapr) is a simple tool that lets you select which AWS Profile you want to use and sets it as the default AWS p

Antoni Yanev 2 Nov 9, 2022
A tool to build scripts to toggle between minimal & default services in Windows based on user defined lists.

A tool to build scripts to toggle between minimal & default services in Windows based on user defined lists.

AMIT 29 Jan 1, 2023
Drop-in Replacement of pychallonge

pychal Pychal is a drop-in replacement of pychallonge with some extra features and support for new Python versions. Pychal provides python bindings fo

ZED 29 Nov 28, 2022
A replacement for Reddit /r/copypasta CummyBot2000 with extra measures to avoid it being banned.

CummyBot1984 A replacement for Reddit /r/copypasta's CummyBot2000 with extra measures to respect Reddit's API rules. Features Copies and replies to ev

null 2 Feb 21, 2022
Live Weather Updates using Flask and OpenWeather

AuraX Live Weather Updates using Flask and OpenWeather Installation To setup this project on your local machine, first clone this repository and insta

Ayush Gupta 3 Nov 2, 2021
Weather App using openweathermap API

This is my hobby project used to learn how to use public api for project.In this i used the api of openweathermap to featch the weather details of various city across the globe by giving city name as input.

Subramanya K S 1 Nov 6, 2021