diff --git a/main.js b/main.js index c033d9c..311e224 100644 --- a/main.js +++ b/main.js @@ -345,6 +345,7 @@ function checkObjects(options, regType, regName, regFullName, tasks, newObjects) regs[i].fullId = id; + objects[id] = { _id: regs[i].id, type: 'state', @@ -363,28 +364,26 @@ function checkObjects(options, regType, regName, regFullName, tasks, newObjects) deviceId: regs[i].deviceId } }; - if (regType === 'inputRegs' || regType === 'holdingRegs') { - objects[id].common.unit = regs[i].unit || ''; - objects[id].native.type = regs[i].type; - objects[id].native.len = regs[i].len; - objects[id].native.offset = regs[i].offset; - objects[id].native.factor = regs[i].factor; - if (regType === 'holdingRegs') { - objects[id].native.poll = regs[i].poll; - } - } + objects[id].common.unit = regs[i].unit || ''; + objects[id].native.type = regs[i].type; + objects[id].native.len = regs[i].len; + objects[id].native.offset = regs[i].offset; + objects[id].native.factor = regs[i].factor; + objects[id].native.poll = regs[i].poll; tasks.push({ id: regs[i].id, name: 'add', obj: objects[id] }); + tasks.push({ id: id, name: 'syncEnums', obj: regs[i].room }); + newObjects.push(id); }