message: [fix] Node naming and location override
diff: @@ -19,6 +19,7 @@ debug.color = 4
  // eslint-disable-next-line no-unused-vars
  const nop = () => { }
  const ZWAVE_LOG_FILE = utils.joinPath(storeDir, 'OZW_Log.txt')
  +const readFile = (path) => new Promise((resolve, reject) => fs.readFile(path, 'utf8', (err, data) => err ? reject(err) : resolve(data)))
  // https://github.com/OpenZWave/open-zwave/wiki/Adding-Devices#configuration-variable-types
  const VAR_TYPES = {
  @@ -84,7 +85,7 @@ function ZwaveClient (config, socket) {
  inherits(ZwaveClient, EventEmitter)
  -function init (cfg, socket) {
  +async function init (cfg, socket) {
  this.cfg = cfg
  this.socket = socket
  @@ -148,7 +149,7 @@ function init (cfg, socket) {
  })
  }
  -function driverReady (homeid) {
  +async function driverReady (homeid) {
  this.driverReadyStatus = true
  this.ozwConfig.homeid = homeid
  var homeHex = '0x' + homeid.toString(16)
  @@ -156,13 +157,13 @@ function driverReady (homeid) {
  this.error = false
  - var zwcfg_path = utils.joinPath(storeDir, 'zwcfg_' + homeHex + '.xml')
  -
  this.zwcfg_nodes = jsonStore.get(store.nodes)
  +
  // pre-load nodes properties by reading zwcfg xml file
  if (this.zwcfg_nodes.length === 0) {
  - fs.readFile(zwcfg_path, 'utf8', function (err, zwcfg) {
  - if (!err) {
  + try {
  + var zwcfg = await readFile(utils.joinPath(storeDir, 'zwcfg_' + homeHex + '.xml'))
  +
  var matches
  // Fails if name or location contains " char
  var regex = /Node id="([\d]+)" name="([^"]*)" location="([^"]*)"/g
  @@ -185,10 +186,11 @@ function driverReady (homeid) {
  // update in memory file
  if (this.zwcfg_nodes.length > 0) {
  - jsonStore.put(store.nodes, this.zwcfg_nodes).catch(debug)
  + await jsonStore.put(store.nodes, this.zwcfg_nodes)
  }
  + } catch (error) {
  + debug('Error while reading zwcfg file', error.message)
  }
  - }.bind(this))
  }
  this.emitEvent('DRIVER_READY', this.ozwConfig)
  @@ -254,7 +256,10 @@ function nodeAvailable (nodeid, nodeinfo) {
  var ozwnode = this.nodes[nodeid]
  if (ozwnode) {
  for (var attrname in nodeinfo) {
  - if (nodeinfo.hasOwnProperty(attrname)) {
  + // Use custom node naming and location
  + if (attrname === 'name' || attrname === 'loc') {
  + ozwnode[attrname] = this.zwcfg_nodes[nodeid] ? this.zwcfg_nodes[nodeid][attrname] : ''
  + } else {
  ozwnode[attrname] = nodeinfo[attrname]
  }
  }
  