No description
Find a file
dependabot[bot] 70e0d06c95
Bump homebridge from 1.5.1 to 1.6.0 (#42)
Bumps [homebridge](https://github.com/homebridge/homebridge) from 1.5.1
to 1.6.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/homebridge/homebridge/releases">homebridge's
releases</a>.</em></p>
<blockquote>
<h2>v1.6.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Updated <code>hap-nodejs</code> to <a
href="https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.11.0">v0.11.0</a>
adding support for <code>systemd-resolved</code> mDNS advertisers and
improved support for systems running avahi mDNS advertiser. The release
also contains general bug fixes and improvements.</li>
<li>Support resolved mDNS advertiser by <a
href="https://github.com/elyscape"><code>@​elyscape</code></a> in <a
href="https://github-redirect.dependabot.com/homebridge/homebridge/pull/3260">homebridge/homebridge#3260</a></li>
<li>Update to provide compatibility with hap-nodejs 0.11.0 by <a
href="https://github.com/Supereg"><code>@​Supereg</code></a> in <a
href="https://github-redirect.dependabot.com/homebridge/homebridge/pull/3263">homebridge/homebridge#3263</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/elyscape"><code>@​elyscape</code></a>
made their first contribution in <a
href="https://github-redirect.dependabot.com/homebridge/homebridge/pull/3260">homebridge/homebridge#3260</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/homebridge/homebridge/compare/v1.5.1...v1.6.0">https://github.com/homebridge/homebridge/compare/v1.5.1...v1.6.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d98b430f69"><code>d98b430</code></a>
1.6.0</li>
<li><a
href="87452ceb6f"><code>87452ce</code></a>
Switch to hap-nodejs v0.11.0 release channel</li>
<li><a
href="708c718d71"><code>708c718</code></a>
Update to provide compatibility with hap-nodejs 0.11.0 (<a
href="https://github-redirect.dependabot.com/homebridge/homebridge/issues/3263">#3263</a>)</li>
<li><a
href="3d281f4fd3"><code>3d281f4</code></a>
Workaround hap-nodejs beta issues</li>
<li><a
href="7b764798e4"><code>7b76479</code></a>
Bump hap-nodejs beta channel</li>
<li><a
href="4bcf8829bd"><code>4bcf882</code></a>
Support resolved mDNS advertiser (<a
href="https://github-redirect.dependabot.com/homebridge/homebridge/issues/3260">#3260</a>)</li>
<li><a
href="6c2f927b20"><code>6c2f927</code></a>
Upgrade to hap-nodejs 0.11.0 beta channel</li>
<li>See full diff in <a
href="https://github.com/homebridge/homebridge/compare/v1.5.1...v1.6.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=homebridge&package-manager=npm_and_yarn&previous-version=1.5.1&new-version=1.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lars Strojny <lars@strojny.net>
2022-12-01 01:38:39 +01:00
.github Configure dependabot for github actions 2022-11-24 20:40:44 +01:00
.homebridge Fix development environment 2022-11-09 00:41:02 +01:00
code-generation Winter cleanup (#41) 2022-11-24 22:12:40 +01:00
src Bump homebridge from 1.5.1 to 1.6.0 (#42) 2022-12-01 01:38:39 +01:00
tests Memoized renderering (#37) 2022-11-24 19:35:02 +01:00
.eslintrc.js Explicit type imports 2022-11-13 13:34:09 +01:00
.gitignore Ignore local release script 2022-11-10 13:54:12 +01:00
.npmignore Ignore release script 2022-11-16 23:26:32 +01:00
.release-it.json Run npm test in CI mode for releases 2022-11-10 13:43:23 +01:00
CHANGELOG.md Set up release-it as the release management tool (#18) 2022-11-10 13:40:34 +01:00
config.schema.json Add configuration option for the metric server interface (#25) 2022-11-17 13:15:07 +01:00
flake.lock Initial version 2022-11-07 15:23:48 +01:00
flake.nix Remove jq 2022-11-21 03:06:10 +01:00
jest.config.js Exclude dist folder from tests search paths 2022-11-24 19:23:40 +01:00
LICENSE Initial commit 2022-11-06 13:04:30 +01:00
nodemon.json Fix development environment 2022-11-09 00:41:02 +01:00
package-lock.json Bump homebridge from 1.5.1 to 1.6.0 (#42) 2022-12-01 01:38:39 +01:00
package.json Bump @fastify/basic-auth from 4.0.0 to 5.0.0 (#46) 2022-12-01 00:48:38 +01:00
prettier.config.js Initial version 2022-11-07 15:23:48 +01:00
README.md Add quality gate status 2022-11-23 15:05:20 +01:00
sonar-project.properties Exclude a few files from coverage reporting 2022-11-24 23:18:03 +01:00
tsconfig.json Cache expensive CI steps (#21) 2022-11-14 02:43:27 +01:00

Homebridge logo Plus sign Prometheus logo

Homebridge Prometheus Exporter

CI Quality Gate Status npm version Libraries.io dependency status for GitHub repo npm

What if we could store homebridge metrics in Prometheus

homebridge-prometheus-exporter is a plugin for homebridge that provides a metrics endpoint for Prometheus to scrape. Once the metrics are in Prometheus, they can be consumed and presented in various ways. One can use Prometheus Alerting Rules to trigger actions on certain thresholds or Grafana to build informative graphs or alerts.

A Grafana timeseries showing wattage and voltage of two home appliances on a timeseries chart

Installing

Install the plugin

Run this command to install the plugin as a global nodejs module:

npm install -g homebridge-prometheus-exporter

Configure homebridge

Edit the homebridge config.json to load the plugin:

{
    // …
    "platforms": [
    {
      "platform": "PrometheusExporter",
      "pin": "123-12-123",
    },
    // …
  ]
}

Customize homebridge startup

For homebridge-prometheus-exporter to work, homebridge has to run in "insecure mode". This means that any user who has access to your network can control your homebridge devices. This is usually not a big problem but it is still something you should consciously decide. homebridge-config-ui-x requires running in insecure mode if you want to control your devices from homebridge-config-ui-x.

To enable "insecure mode", edit the startup script for homebridge and add --insecure or -I. Assuming you run systemd, the proper way to override the config would be to use systemds drop-in mechanism.

Create /etc/systemd/system/homebridge.service.d folder:

mkdir /etc/systemd/system/homebridge.service.d

Write this drop-in configuration file to /etc/systemd/system/homebridge.service.d/insecure.conf:

[Service]
ExecStart=
ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge --insecure

The first and empty ExecStart tells systemd to forget about the ExecStart from the original service definition and the second ExecStart declares the new file. Run systemctl daemon-reload to refresh systemds unit database and then run systemd-delta --type=extended to check if the drop-in worked as expected.

You should see something like this in the output:

…
[EXTENDED]   /lib/systemd/system/homebridge.service → /etc/systemd/system/homebridge.service.d/insecure.conf
…

If you are not using systemd, first of all, you absolutely should but second of all you will likely have some sort of env file, e.g. /etc/defaults/homebridge to customize the homebridge start command. Restart homebridge using systemctl restart homebridge.

Test that the metrics endpoint is available by accesing http://homebridge-host:36123/metrics. You should see a response similar to this:

# TYPE homebridge_air_purifier_active gauge
homebridge_air_purifier_active{name="…",…} 0 1667914208196
# TYPE homebridge_air_purifier_current_air_purifier_state gauge
homebridge_air_purifier_current_air_purifier_state{name="…",…} 0 1667914208196

Configuring Prometheus

With homebridge-prometheus-exporter up and running, it is now time to configure Prometheus to scrape the config endpoint. Go to your prometheus host and edit /etc/prometheus/prometheus.yml and add the following scrape config:


scrape_configs:
  - job_name: homebridge-exporter
    static_configs:
    - targets:
      - homebridge-host:36123

Once Prometheus is restarted, metrics with the homebridge_ prefix should start to be ingested.

Customize homebridge-prometheus-exporter

homebridge-prometheus-exporter offers a few advanced settings to customize its behavior.

{
  // ...
  "platforms": [
    {
      "platform": "PrometheusExporter",


      // Pin
      //
      // Homebridge PIN for service authentication
      "pin": "<string>",


      // Debug
      "debug": "<boolean>",


      // Metrics prefix
      "prefix": "<string>",


      // Metrics server port
      //
      // TCP port where the Prometheus metrics server listens
      "port": "<integer>",


      // Metrics server interface
      //
      // Interface where the Prometheus metrics server listens. Can be an IP, a
      // hostname, "0.0.0.0" for all IPv4 interfaces, "::1" for all IPv6 interfaces.
      // Default is "::" which means "any interface"
      "interface": "<string>",


      // Service refresh interval
      //
      // Discover new services every <interval> seconds
      "refresh_interval": "<integer>",


      // Request timeout
      //
      // Request timeout when interacting with homebridge instances
      "request_timeout": "<integer>",


      // Service discovery timeout
      //
      // Discovery timeout after which the current discovery is considered failed
      "discovery_timeout": "<integer>",


      // TLS cert file
      //
      // Path to TLS certificate file (in PEM format)
      "tls_cert_file": "<string>",


      // TLS key file
      //
      // Path to TLS key file
      "tls_key_file": "<string>",


      // Basic auth username/password pairs
      //
      // Usernames and passwords for basic auth. Object key is the username, object
      // value is the password. Password must be encoded with bcrypt. Example:
      // {"joanna": "$2a$12$5/mmmRB28wg9yzaXhee5Iupq3UrFr/qMgAe9LvAxGoY5jLcfVGTUq"}
      "basic_auth": "<object>"
    }
  ]
}