ewelink-api icon indicating copy to clipboard operation
ewelink-api copied to clipboard

Get Voltage and current on POWR2 device

Open nowsmart opened this issue 1 year ago • 2 comments

There is no method to get device wattage, Voltage and current.

nowsmart avatar Jul 02 '23 23:07 nowsmart

const connection = new ewelink({
    email: '',
    password: '',
    region: '',
});

const device = await connection.getDevice(deviceId);
if (device.online) {
    console.log(`Power: ${device.params.power}W, Voltage: ${device.params.voltage}V, Current: ${device.params.current}A`)
}

You also need to "activate" the measurement by either

  • open the Ewelink app and open the device page or
  • send {uiActive: 60} message to Websocket connection once in a while - example here https://github.com/baugp/ewelink-api/commit/411e4031e9b17126b85a878a0bf48e72dad03de5
  • just use my fork, it comes with this method refreshDevice
npm uninstall ewelink-api
npm install https://github.com/baugp/ewelink-api
const status = await connection.refreshDevice(deviceId, 60);

baugp avatar Sep 13 '23 01:09 baugp

Hi @baugp

Installing your fork npm install https://github.com/baugp/ewelink-api would enable me to retrieve Power, Voltage & Current from POW ELITE? Or it requires other modifications as well?

Thank you.

tech9492 avatar Oct 28 '23 22:10 tech9492