Dont add advanced configuration by default.

This commit is contained in:
Koenkk 2018-05-24 20:19:04 +02:00
parent fb27bd292f
commit 312ed033db
3 changed files with 4 additions and 21 deletions

View File

@ -18,8 +18,3 @@ mqtt:
serial:
# Location of CC2531 USB sniffer
port: /dev/ttyACM0
# Advanced configuration
advanced:
version: 1
pan_id: 0x1a62

View File

@ -2,23 +2,9 @@ const YAWN = require('yawn-yaml/cjs');
const fs = require('fs');
const data = require('./data');
const file = data.joinPath('configuration.yaml');
const logger = require('./logger');
let yawn = read();
// Migrate configuration.
if (!yawn.json.advanced) {
// 1: Add advanced section to configuration.yaml
logger.info('Migrating configuration.yaml to version 1...');
yawn.yaml += '\n\n' +
'# Advanced configuration\n' +
'advanced:\n' +
' version: 1\n' +
' pan_id: 0x1a62\n';
writeRead();
}
function writeRead() {
write();
yawn = read();

View File

@ -4,10 +4,12 @@ const settings = require('./util/settings');
const data = require('./util/data');
const debug = require('debug')('zigbee2mqtt:zigbee');
const advancedSettings = settings.get().advanced;
const shepherdSettings = {
net: {
panId: settings.get().advanced.pan_id,
channelList: [settings.get().advanced.hasOwnProperty('channel') ? settings.get().advanced.channel : 11],
panId: advancedSettings && advancedSettings.pan_id ? advancedSettings.pan_id : 0x1a62,
channelList: [advancedSettings && advancedSettings.channel ? advancedSettings.channel : 11],
},
dbPath: data.joinPath('database.db'),
};