mirror of
https://github.com/skydiver/ewelink-api.git
synced 2025-12-25 06:49:16 +01:00
getFirmwareVersion: use v2 API
This commit is contained in:
@@ -11,11 +11,11 @@ module.exports = {
|
||||
*/
|
||||
async getFirmwareVersion(deviceId) {
|
||||
const device = await this.getDevice(deviceId);
|
||||
const error = _get(device, 'error', false);
|
||||
|
||||
const fwVersion = _get(device, 'params.fwVersion', false);
|
||||
|
||||
if (error || !fwVersion) {
|
||||
return { error, msg: errors[error] };
|
||||
if (!fwVersion) {
|
||||
throw new Error(`${errors.noFirmware}`);
|
||||
}
|
||||
|
||||
return { status: 'ok', fwVersion };
|
||||
|
||||
Reference in New Issue
Block a user