Skip to content

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

License

Notifications You must be signed in to change notification settings

liamcottle/sungrow-eyem4-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • connect
  • disconnect
  • getAbout
  • getProduct
  • getDeviceTypes
  • getDeviceInfo(deviceId)
  • authenticate
  • getState
  • getRuntime
  • getStatistics
  • getFaults
  • getSystemInformation
  • getDeviceList(deviceType)
  • getDeviceRealtimeData(deviceId)
  • 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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published