Update main.js

This commit is contained in:
Administrator 2018-11-08 09:55:44 +08:00
parent 44c0384f8e
commit 688bb999cc

31
main.js
View File

@ -472,55 +472,28 @@ function parseConfig(callback) {
adapter.config.yz.sort(sortByAddress);
adapter.config.disInputs.sort(sortByAddress);
adapter.config.coils.sort(sortByAddress);
adapter.config.inputRegs.sort(sortByAddress);
adapter.config.holdingRegs.sort(sortByAddress);
let tasks = [];
adapter.log.warn('options.devices=' + options.devices);
for (let _deviceId in options.devices) {
adapter.log.warn('_deviceId=' + _deviceId);
if (!options.devices.hasOwnProperty(_deviceId)) continue;
let device = options.devices[_deviceId];
let deviceId = parseInt(_deviceId, 10);
device.disInputs.config = adapter.config.yz.filter(e => e.deviceId === deviceId);
// device.yz.config = adapter.config.yz.filter(e => e.deviceId === deviceId);
//device.disInputs.config = adapter.config.disInputs. filter(e => e.deviceId === deviceId);
//device.coils.config = adapter.config.coils. filter(e => e.poll && e.deviceId === deviceId);
//device.inputRegs.config = adapter.config.inputRegs. filter(e => e.deviceId === deviceId);
//device.holdingRegs.config = adapter.config.holdingRegs.filter(e => e.poll && e.deviceId === deviceId);
// Discrete inputs
iterateAddresses(true, deviceId, device.yz, 'discreteInputs', 'disInputs', localOptions);
// iterateAddresses(true, deviceId, device.yz, 'discreteInputs', 'disInputs', localOptions);
//iterateAddresses(true, deviceId, device.disInputs, 'discreteInputs', 'disInputs', localOptions);
//iterateAddresses(true, deviceId, device.coils, 'coils', 'coils', localOptions);
//iterateAddresses(false, deviceId, device.inputRegs, 'inputRegisters', 'inputRegs', localOptions);
//iterateAddresses(false, deviceId, device.holdingRegs, 'holdingRegisters', 'holdingRegs', localOptions);
// ------------- create states and objects ----------------------------
checkObjects(adapter.config, 'yz', 'yz', 'yz', tasks, newObjects);
//checkObjects(adapter.config, 'disInputs', 'discreteInputs', 'Discrete inputs', tasks, newObjects);
//checkObjects(adapter.config, 'coils', 'coils', 'Coils', tasks, newObjects);
//checkObjects(adapter.config, 'inputRegs', 'inputRegisters', 'Input registers', tasks, newObjects);
//checkObjects(adapter.config, 'holdingRegs', 'holdingRegisters', 'Holding registers', tasks, newObjects);
if (!options.config.multiDeviceId) {
break;
}
}
tasks.push({
id: 'info',