getFirmwareVersion: use v2 API

This commit is contained in:
Martín M
2020-10-21 21:26:34 -03:00
parent 894aa6f5ca
commit 9e7bef86ff

View File

@@ -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 };