Skip to content

Latest commit

 

History

History
271 lines (213 loc) · 12.7 KB

README.md

File metadata and controls

271 lines (213 loc) · 12.7 KB

homebridge-weather-plus

npm npm GitHub last commit Weather

This is a weather plugin for homebridge that features current observations, daily forecasts and history graphs for multiple locations and services. You can download it via npm.

If you like this plugin, I would be very grateful for your support:

Buy Me A Coffee

Feel free to leave any feedback here.

Features

  • Get current observations and forecasts for up to 10 days
  • Choose from 4 different weather services
  • Add multiple locations/services
  • See the weather history in the Eve App
  • See translations and icons in the Eve App
  • Use all values in HomeKit rules with the Eve App

Observations and Forecasts

The following 19 observation and forecast values can be displayed and used in HomeKit rules.

  • Air Pressure
  • Cloud Cover
  • Condition
  • Condition Category (Sun = 0, Clouds = 1, Rain = 2, Snow = 3)
  • Dew Point
  • Humidity
  • Ozone
  • Rain Last Hour
  • Rain All Day
  • Rain Chance
  • Solar Radiation
  • Temperature
  • Temperature Min
  • Temperature Max
  • UV-Index
  • Visibility
  • Wind Direction
  • Wind Speed
  • Wind Speed Maximum
  • Observation Time
  • Observation Station
  • Forecast day

Choose your Weather Service

This plugin supports multiple weather services. Each has it's own advantages. The following table shows a comparison to help you choosing one.

Dark Sky (recommended) OpenWeatherMap Weather Underground 1
Current observation values 15 7 12
Forecast values 16 9 0
Forecast days 7 5 0
Location geo-coordinates city name, city id, geo-coordinates station id
Personal weather stations ✔️ ✔️
Free ✔️ ✔️ ✔️ (only if you own a station)
Register here here here

1 You can use the weather underground service only if you can provide weather data from your own station in exchange.

You can add more services easily by forking the project and submitting a pull request for a new api file.

Installation

  1. Install homebridge using: npm install -g homebridge
  2. Install this plugin using: npm install -g homebridge-weather-plus Note: The installation might take 5 minutes.
  3. Gather an API key for a weather service from the register link in the table above
  4. Update your configuration file. See the samples below.

Configuration

Below are example configurations for all weather apis.

Dark Sky

key
The API key that you get by registering for the Dark Sky service.

locationGeo
List with the latitude and longitude for your location (don't forget the square brackets). You can get your coordinates: here.

"platforms": [
	{
		"platform": "WeatherPlus",
		"service": "darksky",
		"key": "YOUR_API_KEY",
		"locationGeo": [52.5200066, 13.404954]
	}
]

OpenWeatherMap

key
The API key that you get by registering for the Dark Sky service.

location2
Numerical city id, can be found here.

locationCity2
City name and optional country code, can be found here.

locationGeo2
List with the latitude and longitude for your location (don't forget the square brackets). You can get your coordinates: here.

2 You need only one of these location options.

"platforms": [
	{
		"platform": "WeatherPlus",
		"service": "openweathermap",
		"key": "YOUR_API_KEY",
		"location": 2950159,
		"locationCity": "Berlin, DE",
		"locationGeo": [52.5200066, 13.404954]
	}
]

Weather Underground

Since March 2019 you need to register your own weather station with Weather Underground to get weather data in exchange. After you registered your weather device (here), you can use the API.

key
The API key that you get by registering for the Weather Underground service.

location
Your personal StationID.

"platforms": [
    {
        "platform": "WeatherPlus",
        "service": "weatherunderground",
        "key": "YOUR_API_KEY",
        "location": "YOUR_STATION_ID"
    }
]

Advanced Configuration

Below are explanations for a lot of advanced parameters to adjust the plugin to your needs. All parameters are optional.

forecast
List of forecast days with 1 for today, 2 for tomorrow etc. Default are none []. Maximum depends on the choosen weather service.

interval
Update interval in minutes. The default is 4 minutes because the rate for free API keys is limited.

units
Conversions used for reporting values. The default is "metric". The options are:
"si" or "metric"
"us" or "imperial"
"ca" to report wind speeds in km/h instead of m/s
"uk" to report visibility in miles and wind speeds in km/h instead of m/s

language
Translation for the current day and the weather report. Available languages can be found here. The default is en.

displayName
Name for the current condition accessory. The default is "Now". You can also set this to your city name.

displayNameForecast
Name for the forecast accessories. Adds a prefix to the forecast days.

compatibility
Compatibility for the Apple Home app, the Eve app or a mix of both. This is required due to limitations in the Apple Home app recognized weather conditions.
"mix" Temperature and humidity are displayed in the Apple Home app. All conditions are displayed in the Eve app.
"eve" Nothing is displayed in the Apple Home app. All conditions are displayed in the Eve app (temperature, humidity and pressure are combined into one row).

fakegatoParameters
Customization of the history storage system. By default the history is persisted on the filesystem. You can set your own option using this parameter. In order to change the location of the persisted file or to use GoogleDrive. Do not modify the parameter for the fakegato internal timer.

serial
Change the Serial Number of your weather accessory. If it's not provided the serial number will be set to the location if present, or to 999 if not. Note that for proper operation of fakegato when multiple fakegato-enabled weather accessories are present in your system, the serial number must be unique.

Example

"platforms": [
    {
        "platform": "WeatherPlus",
        "service": "darksky",
        "key": "XXXXXXXXXXXXXXX",
        "locationGeo": [52.5200066,13.404954],
        "forecast": [1,2],
        "interval": 5,
        "units": "metric",
        "language": "en",
        "displayName": "New York",
        "displayNameForecast": "New York Forecast",
        "compatibility": "mix",
        "serial": "1337"
    }
]

Multiple Stations Configuration

You can set up multiple stations for different locations and weather services by putting your configuration in a stations array. The following parameters are global and must be placed outside of the array: platform, interval, units.

Each stations must have a unique displayName. If you don't set one, the plugin will take care of that.

Example

"platforms": [
    {
        "platform": "WeatherPlus",
        "interval": 5,
        "units": "si",
        "stations": [
            {
                "displayName": "New York",
                "displayNameForecast": "New York forefacst",
                "service": "darksky",
                "key": "YOUR_API_KEY",
                "forecast": [1,2,3,4,5],
                "locationGeo": [52.5200066,13.404954]
            },
            {
                "displayName": "Los Angeles",
                "displayNameForecast": "Los Angeles forecast",
                "service": "darksky",
                "key": "YOUR_API_KEY",
                "forecast": [1,2],
                "locationGeo": [34.0536909,-118.2427666]
            }
        ]
    }
]

Example Use Cases

  • Switch on a blue light in the morning when the chance for rain is above 20% today (or white when the forecast condition is snow / yellow when it's sunny).
  • Start your automatic garden irrigation in the evening, depending on the amount of rain today and the forecast for tomorrow.

Hint: To trigger rules based on time and weather condition you will need a plugin like homebridge-delay-switch. Create a dummy switch that resets after some seconds. Set this switch to on with a timed rule. Then create a condition rule that triggers when the switch goes on depending on weather conditions of your choice.

Screenshots

Current Conditions in Elgato Eve app History graph in Elgato Eve app

(c) Screenshots are taken from the Elgato Eve app

Contributors

Many thanks go to

  • simont77 for his fakegato-history library, the eve weather emulation, the multiple stations feature and several other great improvements
  • GatoPharaoh for his interval option pull request
  • David Werth for integrating the OpenWeatherMap and Yahoo apis
  • Marshall T. Rose for adding support for imperial units and the displayName parameter
  • Bill Waggoner for his fix for the crashing wunderground api
  • Russell Sonnenschein for adding the new 2019 weatherunderground api

This plugin is a fork of homebridge-weather-station which is no longer being developed. That one was a fork of homebridge-wunderground.

Attribution