npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

teleinfo-js

v0.0.8

Published

Teleinformation module to read frames from ErDF / Enedis main circuit breaker

Downloads

14

Readme

Teleinfo-js

Node module to read teleinformation frames from ErDF / Enedis main circuit breaker (in France).

Wrapped on serialport module to read from a serial / USB port. Tested on RaspberryPi.

Based on Laurent HUET work.

Prerequisites

  • A RaspberryPi or equivalent computer to plug adapter and run the module.
  • An adapter (see tested hardware below) to plug between main circuit breaker TIC interface and your computer.
  • This adapter should be able to connect to serialport module: sending serial data or emulate it from USB port.
  • A classical white ErDF circuit breaker, or a Linky.
  • For Linky, TIC must be set to Historique mode.

Tested hardware

  • RaspberryPi 2 with Raspbian.
  • GCE Electronics USB.
  • Tested on Linky (TIC History mode), use I1 and I2 outputs (no polarity).

Start with a simple example to try it.

mkdir teleinfo-test && cd teleinfo-test
npm install teleinfo-js

ls /dev/tty*
# this will scan serial ports. Plug/unplug your adapter to look after a change.
# Then for example 'ttyUSB0', type:
cd node_modules/teleinfo-js && npm run start -- /dev/ttyUSB0

You should receive more than 1 frame per minute. If so, you can start to write your own implementation.

First step to begin

const teleinfo = require('teleinfo')
// use your own port here:
const emitter = teleinfo('/dev/ttyUSB0')

emitter.on('rawFrame', function (data) {
  console.log('rawFrame', data)
  // You will receive ALL raw data.
})

emitter.on('error', function (error) {
  console.error(error)
  // In case of error from serialport module.
})

For better events and parsed data

emitter.on('connected', function (data) {
  console.log('connected', data)
  // When connection succeed and first data is received.
})
emitter.on('failure', function (data) {
  console.log('failure', data)
  // When connection cannot be established.
})
emitter.on('frame', function (data) {
  console.log('frame', data)
  // You will receive all parsed frames.
})
emitter.on('change', function (data) {
  console.log('change', data.changes)
  // You will receive only changes.
})

emitter.on('diff', function (data) {
  console.log('diff', data.diff)
  // You will receive a full structured diff object for convenience.
})

For less events

You can add inhibitors to your teleinfo instance. These will avoid too many change/diff events to be triggered. For example, to trigger events when PAPP value delta is above 30W, or HCHP/HCHC index delta are above 5Wh:

const emitter = teleinfo('/dev/ttyUSB0', { 'PAPP': 30, 'HCHP': 5, 'HCHC': 5 })

By default, inhibitors = { 'PAPP': 20 }.


Adaptations and improvements (c) 2020 GXApplications. Based on Laurent HUET work. | License