diff --git a/lib/session.js b/lib/session.js index 51d72c0..1484968 100644 --- a/lib/session.js +++ b/lib/session.js @@ -989,9 +989,11 @@ function rpcRequest(sessionContext, _declarations, callback) { for (const c of toClear) { if (c[1] > sessionContext.timestamp) c[1] = sessionContext.timestamp; - for (const [k, v] of Object.entries(c[2])) { - if (v > sessionContext.timestamp) - c[2][k] = sessionContext.timestamp; + if (c[2]) { + for (const [k, v] of Object.entries(c[2])) { + if (v > sessionContext.timestamp) + c[2][k] = sessionContext.timestamp; + } } } @@ -1696,7 +1698,7 @@ function generateSetRpcRequest(sessionContext) { } // Factory reset - if (syncState.reboot) { + if (syncState.factoryReset) { const p = sessionContext.deviceData.paths.get(["FactoryReset"]); const attrs = p ? sessionContext.deviceData.attributes.get(p) : null; if ( @@ -1873,7 +1875,8 @@ function processDeclarations( } } - allDeclareAttributeValues.get(path) || declareAttributeValues; + declareAttributeValues = + allDeclareAttributeValues.get(path) || declareAttributeValues; } }