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

voltcraft-vsm-102-telnet

v1.0.1

Published

Read Voltcraft VSM-102 electricity meter(s) via rs485-to-telnet converter.

Downloads

1

Readme

Read Voltcraft VSM-102 electricity meter(s) via rs485-to-telnet converter.

This module will contionusly query one or more Voltcraft VSM-102 electricity meter(s) connected to an rs485-to-telnet converter. I use a Chiyu BF-430, but any similar device should work as long as there is no login required to access the bus.

The electricity meter itself seems to be discontinued, but I have a few that I wanted to get readings from. So instead of hacking together a "good enough" solution, I decided to actually package the code as an npm module for simple reuse. Especially since every time I hack something together for these meters, I have to wade through the incomplete, and in parts inaccurate, documentation for the device. This way I don't ever have to do that again.

NOTE: This module will relentlessly hammer the bus trying to get readings. It is therefor a very bad choice if your bus includes other devices!

Example

const meter = require('voltcraft-vsm-102-telnet');

meter.run({ host: 'hostname.example.com', port: 50000}, result => {
  console.log(result);
});

Installation

npm install voltcraft-vsm-102-telnet

VERY IMPORTANT!

Buggy readings: Purchased power (kWh).

The Voltcraft VMS-102 contains a pretty serious bug related to meter readings of purcased power (kWh). The documentation states "Meter readings in kWh with 6 pre-decimal and 2 post-decimal digits".

This is simply not true. In reality there are 5+2 digits, and the values does not roll over at 99999.99kWh. This gives readings of ?????.??*kWh, which are not valid.

Use option verbose: true to include these readings, knowing they are reported as parsed. This means a valua of NaN for invalid readings!

Buggy readings: Total infed power (kW).

In addition, the OBIS 1-0:1.7.255*255 (Li: total infed power) does not always equal the sum of infed power for L1+L2+L3. It is therefor not normally included in response either.

Use option verbose: true to include this value.

API

meter.run(options, callback);

Parameter options

An object with the following properties:

|name |required?| default | description| |------ |---------|--------- |------------------------------------------------------| |host |required | |IP address or hostname of the rs485-to-telnet converter. |port |required | |Telnet port of the rs485-to-telnet converter. |serials |optional |<none> |An array of device serial numbers to query. If there are more than one device is on the bus, this option is required. If only one device, this can be left out. (example: serials: [ '11400529', '11400530' ]) |verbose |optional |false |false: Only report results when checksum matches. true: Report all results and all values.Set this to true to always report values, even if checksum does not match. This is a good way to calculate the signal-to-noise ratio on your rs485 bus.NOTE: This also enables reporting of values not normally reported, as well as potentially buggy values. See VERY IMPORTANT! for more details!

Paramater callback

Callback function that will receive result.

The callback function receives the following objects:

Option verbose: false (default)

{
  ts: 1636906149995,      /* Timestamp. ms resolution */
  power: { 
    unit: 'kW',           /* Always 'kW' */
    L1: 3.0136,           /* OBIS 1-0:21.7.255*255 */
    L2: 4.0275,           /* OBIS 1-0:41.7.255*255 */
    L3: 2.6157,           /* OBIS 1-0:61.7.255*255 */
  },
  serial: '11400529'      /* OBIS 0-0:96.1.255*255 */
}

Option verbose: true

Only fields sent when verbose: true is commented. The rest of the fealds are the same as above.

{
  ts: 1636906115251,
  checksum: { 
    bcc: 120,             /* BCC sent from device */
    lrc: 120,             /* LRC calculated over data sent from device */
    match: true           /* Do they match? */
  },
  power: { 
    unit: 'kW', 
    L1: 0.9239, 
    L2: 1.7303, 
    L3: 0.6819, 
    total: 3.3361         /* OBIS 1-0:1.7.255*255  */
  },
  energy: { 
    unit: 'kWh',          /* Always 'kWh' */
    total: NaN,           /* OBIS 1-0:1.8.0*255 */
    L1: 33399.95,         /* OBIS 1-0:2.1.7*255 */
    L2: 58744.73,         /* OBIS 1-0:4.1.7*255 */
    L3: 71589.76          /* OBIS 1-0:6.1.7*255 */
  },

  /* First line of device response. Presumably model+firmware? */
  model: 'EFR-M4-DRV004101222',

  /* OBIS 1-0:96.5.5*255 */
  state: {
    outage: {
      L1: false,          /* bit[5]: true if L1 outage. */ 
      L2: false,          /* bit[4]: true if L2 outage. */ 
      L3: false,          /* bit[3]: true if L3 outage. */ 
    }
    idle: false,          /* bit[6]: true if idle, false if 'above start-up' */
    error: false          /* bit[0]: true on error. */ 
  }
  serial: '11400529'
}

License

MIT © Thomas Hellström [email protected]