Copyright © 2018 Erik Baauw. All rights reserved.
This homebridge plugin exposes a smart meter to Apple's HomeKit, using the end-consumer (P1) interface of the Dutch Smart Meter Requirements (DSMR). It provides insight from HomeKit into your actual and historic energy consumption.
The smart meter sends a push notification ("telegram" in DSMR speak), every second, updating the electricity consumption almost in real time. Gas consumption is updated once every five minutes. The homebridge-p1 plugin maintains the historic consumption. It exposes two HomeKit accessories, one for electricity and one for gas, aptly named Electricity and Gas. Both accessories expose Total Consumption
and (Current) Consumption
, just like an Elgato Eve Energy, enabling Elgato's Eve app to display the consumption history. Eve computes the Total Cost
and Projected Cost
.
You need a smart meter that complies to DSMR (currently DSMR 5.0 and DSMR 2.2+ are tested). The companies maintaining the electricity and natural gas networks in the Netherlands, united in Netbeer Nederland are replacing existing electricity and gas meters with smart meters. In my home, they installed a Landys +Gyr E350 (ZCF1100).
You need a cable to connect the smart meter's P1 port to a USB port. I got mine here, but you could also make one yourself, as described here. The cable is quite short (~1m) but you can extend it using a regular USB extension cable (female-A to A).
You need a server to run homebridge. This can be anything running Node.js: from a Raspberry Pi, a NAS system, or an always-on PC running Linux, macOS, or Windows. See the homebridge Wiki for details. I run homebridge-p1 on a Raspberry Pi 3 model B.
I recommend using wired Ethernet to connect the server running homebridge and the AppleTV.
To interact with HomeKit, you need Siri or a HomeKit app on an iPhone, Apple Watch, iPad, iPod Touch, or Apple TV (4th generation or later). I recommend to use the latest released versions of iOS, watchOS, and tvOS.
Please note that Siri and even Apple's Home app still provide only limited HomeKit support. Particularly, it does not support custom HomeKit services and characteristics. To use homebridge-p1, you need some other HomeKit app, like Elgato's Eve app (free) or Matthias Hochgatterer's Home app (paid).
For HomeKit automation, you need to setup an Apple TV (4th generation or later) or iPad as Home Hub.
The homebridge-p1 plugin obviously needs homebridge, which, in turn needs Node.js. I've followed these steps to set it up:
- Install the latest v10 LTS version of Node.js. On a Raspberry Pi, use the 10.x Debian package. On other platforms, download the 10.x.x LTS installer. Both installations include the
npm
package manager; - On macOS, make sure
/usr/local/bin
is in your$PATH
, asnode
,npm
, and, later,homebridge
install there. On a Raspberry Pi, these install to/usr/bin
; - You might want to update
npm
throughsudo npm -g install npm@latest
; - Install homebridge through
sudo npm -g install homebridge --unsafe-perm
. Follow the instructions on GitHub to create aconfig.json
in~/.homebridge
, as described; - Install the homebridge-p1 plugin through
sudo npm -g install homebridge-p1 --unsafe-perm
; - Edit
~/.homebridge/config.json
and add theP1
platform provided by homebridge-p1:"platforms": [ { "platform": "P1" } ]
Homebridge-p1 should detect the USB serial cable automatically. In case it doesn't or when you have multiple USB serial devices, you can specify the serialport in config.json:
"platforms": [
{
"platform": "P1",
"serialport": "/dev/ttyUSB0"
}
]
If homebridge-p1 doesn't receive any data and you have a meter with an older DSMR version, you might need to specify:
"platforms": [
{
"platform": "P1",
"serialport": "/dev/ttyUSB0",
"dsmr22": true
}
]
Exposing the smart meter to HomeKit is a bit of a hack, lacking proper HomeKit support for smart meters. Also, Eve lacks proper support for gas consumption. The following limitations apply:
- The Electricity consumption is the combined consumption under Normal and Low tariff. If you have a dual-tariff contract, the cost computed by Eve will be inaccurate;
- The Gas consumption is actually in m³, but Eve displays kWh. If homebridge-p1 would expose different characteristics for gas consumption, Eve would display the correct units, but not the history. To see the correct cost for Gas, you need to change the Energy Cost under Settings in Eve to match you Gas rate;
- Eve doesn't take into account fixed (subscription) costs, so the cost displayed is only the variable cost.