This is a NodeJS library for interacting with the websocket server running on the Sungrow EyeM4 Dongle.
npm install @liamcottle/sungrow-eyem4-api
-
connect
-
disconnect
-
getAbout
-
getProduct
-
getDeviceTypes
-
getDeviceInfo(deviceId)
-
authenticate
-
getState
-
getRuntime
-
getStatistics
-
getFaults
-
getSystemInformation
-
getDeviceList(deviceType)
-
getDeviceRealtimeData(deviceId)
-
getDeviceDCData(deviceId)
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();
})();