"Config.json": understand the Home configuration filebridge

3 minutes of reading
Guide purposes
  • Understanding the configuration file of Homebridge
  • Difficulty level: bass
Concepts dealt with:
  • software configuration
Software components used:
Prerequisites
GUIDE more indicated for:

Apple-200x200

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere progettata ed effettuata 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.

Abstract

Homebridge based entirely on propria configuration - or, ultimately, the accessories made available to HomeKit (hence on theapp"House" indication of Apple iOS) - on a single written text file in json notation from the name "config.json", regardless of the type of installation performed (on Raspberry, Windows, Docker etc.).

This file is basically composed of three blocks (all three at the same time necessary, each sequentially to the other):

  • the block that defines the settings of the Home instancebridge (First name, MAC Address, port TCP/IP, PIN HomeKit);
  • the block that defines any "platforms" and related "accessories";
  • the nozzle that defines any "accessories" that do not require "platforms".

ATTENTION. In the vast majority of cases if Homebridge no longer works after changing to config.json it is because within it one or more errors of semantics or syntax were committed. Mostly, often they are missing commas (or in excess) or incorrect parentheses (open and not closed staples and brackets, or vice versa). ALWAYS refer to jsonlint.com for the validation of proprio config.json.

Nb. Click here to download a single file already provalid as an initial trace.


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.

Instance settings Homebridge

Instance settings Homebridge they are usually at the head of the file config.json.
An example:

"bridge": {
  "name": "Homebridge",
  "username": "CC:22:3D:E3:CE:30",
  "port": 51826,
  "pin": "031-45-154"
}

Field Name is dedicated to the description that the bridge will get inside HomeKit, then into theapp"House" indication of Appthe iOS:

As appare Homebridge on "Home"
As appare Homebridge on "Home"

Field Username instead identifies the MAC Address by the BRIDGE virtual rappresent from Homebridge; The Port, the one on which it will communicate via a home network. Finally, the PIN, necessary to add the BRIDGE to HomeKit at theapp"House" indication of Appthe iOS.

Block "platforms"

Platform means usually a set of sensors / actuators / devices of the same family.
The (second) block of json code at the configuration file it is usually similar to the following example:

"platforms": [
  {
    "platform" : "PhilipsHue",
    "name" : "Hue"
  }
]

Usually, inside this block there is one or more accessories for each defined platform.

Nb. any addition of elements within the configuration obviously provides that its plugin (in this case the one dedicated to "PhilipsHue") is properly installed on the system.

Nb. these blocks must be assembled in a single json file. Click here to download a single file already pronto.

"Accessories" block

Accessories are individual elements defined at configuration level:

"accessories": [
  {
    "accessory": "WeMo",
    "name": "Coffee Maker"
  }
]

Each accessory defines itself and nothing else.

Nb. any addition of elements within the configuration obviously provides that its plugin (in this case the one dedicated to "WeMo") is properly installed on the system.

Nb. these blocks must be assembled in a single json file. Click here to download a single file already pronto.

Where to find the configuration file

It depends on this question there is no single answer.
First of all, to download a "basic" configuration file (empty but working for the first start of Homebridge), click here.

In case you have installed Homebridge su Raspberry following in toto our guide, the configuration file will be in two different locations:

/var/homebridge/

for configuration of the service with automatic start at boot, while at

/home/pi/.homebridge/

for the instance to be launched manually to carry out tests and experiments.

Su Windowsinstead, you can find the configuration file at:

%userprofile%\.homebridge

Finally, su Apple Mac OS X the config.json file is usually placed near the path:

/Users/YourUsername/.homebridge

Obviously any customization during installation (on any environment) may cause a change in the above routes.

Useful Tips

First, it is advisable to decide in advance the information to be included in the initial block for defining the Home settingsbridge: changes in later stages will cause the malfunctionnameof the BRIDGE at theapp"House", forcing to repeat the insertion operation of the BRIDGE in 'appand consequently obliging the user to reconfigure any previously defined customizations and / or automations.

Always remember that any changes made to the configuration file are valid starting from the next execution of Homebridge.

We also recommend to always make backups of the configuration file as it "evolves" over time. Finally, before making any changes, it is always good to "validate" the file using the site interface jsonlint.com.


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.

Please comment below