Giter VIP home page Giter VIP logo

homebridge-p1's Introduction

homebridge-p1

npm npm JavaScript Style Guide

Homebridge plugin for DSMR end-consumer (P1) interface

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.

Prerequisites

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.

Installation

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, as node, npm, and, later, homebridge install there. On a Raspberry Pi, these install to /usr/bin;
  • You might want to update npm through sudo npm -g install npm@latest;
  • Install homebridge through sudo npm -g install homebridge --unsafe-perm. Follow the instructions on GitHub to create a config.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 the P1 platform provided by homebridge-p1:
    "platforms": [
      {
        "platform": "P1"
      }
    ]

Configuration

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
  }
]

Caveats

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.

homebridge-p1's People

Contributors

ebaauw avatar rooi avatar

Watchers

TeunVR avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.