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

@woifes/node-yasdi

v1.2.0

Published

Node bindings to yasdi library

Downloads

5

Readme

@woifes/node-yasdi

Why?

This package binds the yasdi library to a nodeJS package which may be used for other projects. The yasdi library is a open source library provided by SMA, which enables the connection to SMA products. This package was only used for/used with:

  • Reading the data of inverters via RS485
  • A cheap USB-RS485 converter via a raspberry pi

On windows I only succeeded to compile the bindings but did not try it

Please check the source code before using this package

Installation

npm install @woifes/node-yasdi

Quick start

Using node-yasdi in your program

import { NodeYasdi } from "@woifes/node-yasdi";

const nodeYasdi = new NodeYasdi("myPlant", {
  expectedDeviceCount: 3,
  //serialPorts: ["path/to/serialDevice"] //on linux you can also use a link as a device like "/dev/serial/by-path/<usbDeviceLink>"
  //iniFileDir: "path/to/dir/where/iniFile/may/be/created
}, "path/to/iniFile.ini"); //either provide 'serial ports' and 'iniFileDir' in config, or the ini file directly
await once(nodeYasdi, "deviceSearchEnd"); //the yasdi library can not fetch data before this event

let inverter01 = nodeYasdi.getInverterBySerial(nodeYasdi.handles[0]);

let values = await inverter01.getData(5);

Using node-yasdi shell

pnpm run createIni 2> my.ini #follow instructions to create a yasdi compatible ini file

pnpm run shell <path/to/my.ini> #run the shell with a given ini file

Remarks regarding yasdi and its LGPL

Here are the instructions how one can build a custom version of the yasdi library into this package (according to LGPL v2.1 with statically linked libraries). (It is assumed that the nodeJS related development is known.)

The following list describes where you find the different parts involved in the build:

  • The yasdi source code lies in the bin folder
  • The bindings (glue code) also lies in the bin folder
    This file was created by investigating the cmakefile delivered with yasdi, some time with trial and error
  • The build is configured via the bindings.gyp file
  • Additionally there is an interface of the bindings for TypeScript defined in src

Changes made to yasdi

  • in bin/yasdi-1.8.1build9-src/os/os_linux.h: changed include from #include <termio.h> to #include <termios.h> so that it compiles on alpine linux

For running the build see the following section.

Running the build

Build yasdi library and bindings:

pnpm run build

TypeScript build:

pnpm run compile

Run tests:

pnpm test