@liamcottle/sungrow-eyem4-api

0.0.6 • Public • Published

Sungrow-EyeM4-API

npm GitHub License

This is a NodeJS library for interacting with the websocket server running on the Sungrow EyeM4 Dongle.

Installing

npm install @liamcottle/sungrow-eyem4-api

Features

  • [x] connect
  • [x] disconnect
  • [x] getAbout
  • [x] getProduct
  • [x] getDeviceTypes
  • [x] getDeviceInfo(deviceId)
  • [x] authenticate
  • [x] getState
  • [x] getRuntime
  • [x] getStatistics
  • [x] getFaults
  • [x] getSystemInformation
  • [x] getDeviceList(deviceType)
  • [x] getDeviceRealtimeData(deviceId)
  • [x] getDeviceDCData(deviceId)

Example

const Client = require("@liamcottle/sungrow-eyem4-api");

(async () => {

    // create new client
    const client = new Client("192.168.1.175");

    // wait until connected
    client.on("connected", async () => {

        // authenticate
        await client.authenticate();

        // log state
        const state = await client.getState();
        console.log(state);

        // log runtime
        const runtime = await client.getRuntime();
        console.log(runtime);

        // log statistics
        const statistics = await client.getStatistics();
        console.log(statistics);

        // log faults
        const faults = await client.getFaults();
        console.log(faults);

        // log system information
        const systemInformation = await client.getSystemInformation();
        console.log(systemInformation);

        // log realtime data for each device
        const deviceList = await client.getDeviceList();
        console.log(deviceList);
        for(const device of deviceList.list){
            const realtimeDataResponse = await client.getDeviceRealtimeData(device.dev_id);
            console.log(realtimeDataResponse);
        }

        // we are done here
        client.disconnect();

    });

    // connect
    client.connect();

})();

References

Readme

Keywords

none

Package Sidebar

Install

npm i @liamcottle/sungrow-eyem4-api

Weekly Downloads

0

Version

0.0.6

License

MIT

Unpacked Size

10.7 kB

Total Files

9

Last publish

Collaborators

  • liamcottle