Conditions and weather forecasts with AppHomeKit via homebridge-weather and Homebridge

4 minutes of reading
Guide purposes
  • Equip the profirst personal home automation Appthe HomeKit of conditions and weather forecasts through the Home pluginbridge "homebridge-weather"
  • Difficulty level: bass
Concepts dealt with:
  • Software installation and configuration
Software components used:
Physical devices used:
GUIDE more indicated for:


Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.


"homebridge-weather"Is a plugin Homebridge able to supply the profirst home automation Appthe HomeKits two types of environmental sensors - virtual - one of temperature is one of relative humidity.

That they are virtual comes from the fact the data source exposed to them is not a physical sensor (like this) positioned in the proenvironment but rather a website, in particular OpenWeatherMap, which collects temperatures and other information from stations around the world.

OpenWeatherMap LogoOpenWeatherMap is a site that brings together data from hundreds of thousands of weather stations around the world. These control units communicate with the site and record, for the area in which they are located, data of different nature such as appanointed temperature, relative humidity but also much more, such as rainfall, solar radiation and more. This data is then taken from the plugin which exposes them to Homebridge, then to our home automation Appthe HomeKits.

The service (free within the limits imposed, or a certain maximum number of data requests within a certain time) provides Home automationbridge also weather forecasts.

This guide illustrates how to configure this plugin at Homebridge.



Installation, like all Home pluginsbridge - it's very simple.

Run the following command - on unix-based systems (linux, Raspberry etc.) from the terminal, from systems windows su procommand mpt:

sudo npm install -g homebridge-weather

and wait for the end of proprocedure. In the case of systems Windows, omit the word "sudo".

Nb In case Homebridge is already running as a service (as described in our Home installation guidebridge), prosee to interrupt it before installing using the command:

sudo systemctl stop homebridge

Update Searchnamento

To update the package, simply run the following command:

sudo npm update -g -dev homebridge-weather

In the case of systems Windows, omit the word "sudo".

Registration at the site

Go to e register for free.
This done you will receive a thank you email containing the proman API KEY, which is a string of characters and numbers.

It will serve soon.


ACTIVATE the configuration

Like all add-ons for Homebridge, then installation is necessary prosee the configuration, which resides inside the file config.json of Homebridge same. For more specific information (on structure, location) of the configuration file, refer to to this brief guide.

The plugin configuration "homebridge-weather "foresees the addition to the configuration file of a new accessory named"Weather"

An example of minimal configuration is the following:

"accessories": [
       "accessory": "Weather",
       "apikey": "LA_TUA_API_KEY",
       "location": "Rome,it",
       "name": "OpenWeatherMap Temperature",
       "pollingInterval": 10,
       "enableHistory": true


accessory(string, mandatory) defines the name of the platform, which must be "Weather"
name(string, mandatory) defines the name of the accessory that will be displayed on HomeKit
apikey(string, mandatory) corresponds to the API key requested from OpenWeatherMap
location(string, optional) defines the city with respect to which the temperature and relative humidity data identified by name are to be recorded
locationById(integer, optional) defines the city with respect to which the temperature and relative humidity data identified by ID are to be recorded (eg 6539761 corresponds to Rome, Italy)
locationByCoordinates(coordinates, optional) defines the city with respect to which the temperature and relative humidity data identified by geographical coordinates are to be recorded (eg "lat = 48.70798341 & lon = 9.17019367")
pollinginterval(integer, optional) defines the number of minutes between an updatenamento and the other (it is recommended not to go under the 10)
enablehistory(boolean, optional) allows theapp "Elvate Eve”To show the history of humidity and temperature trends
How to specify a specific CITY

There are three ways:

for NAMEIt is sufficient to indicate the name of the city. Often it does not work, or because the city is not precisely registered with that name or because the name is translated into English. To implement this mode, in the configuration use the "location"
for IDIt is the simplest method: each control unit (there may be more for each city) is registered at OpenWeatherMap with a numerical identifier. Searching for proAt the site of the site's search engine, once you have found the unit of interest, simply click on it and look at the url address of the page reached.
In the case of Rome, the url is:

Well, the number that completes the string (6539761) is the city ID. To implement this mode, in the configuration use the "locationById"

for GEOGRAPHIC COORDINATESIt is sufficient to indicate (just find them) the geographical coordinates of the city. To implement this mode, in the configuration use the "locationByCoordinates"


The service is also able to provide forecasts (Free):

  • maximum and minimum temperature (in degrees);
  • cloudiness (percentage coverage);
  • solar position (in percentage - 0% is dawn, 50% midday, 100% sunset).

To implement two minimum and maximum temperature sensors, add accessories as follows:

"accessories": [
     "locationById": "il_tuo_ID_CITTA_o_altro"
     "name":"Minima Odierna",
     "name":"Massima Odierna",

To implement an expected cloud cover sensor, integrate an accessory as follows:

"accessories": [

To implement a planned solar position sensor, integrate an accessory as follows:

"accessories": [
     "pollingInterval": 10


After making the configuration at theapp"House" indication of Appthe iPhone / iPad /macOS appariranno two new icons, one relating to temperature and one related to percentage of relative humidity and / or di forecast sensors.

In the example below we have associated the sensors with a room called "Terrazzo", so as to identify them from the other sensors in the home automation system:

homebridge-weather - accessories

These two new elements can therefore be used for the most common automations configurable on Appthe HomeKits; data readings will come automatically updated every few minutes - as per configuration.

Logo Appthe HomeKitsATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Appthe Homekits, for any doubt, question, information on the specific merit of these components.

inDomus telegram channel