message: feat: Allow users to load custom hass devices configurations in store directory
diff: @@ -13,6 +13,24 @@ const version = reqlib('package.json').version
  debug.color = 2
  +try {
  + const storeDir = reqlib('config/app.js').storeDir
  + const customDevices = reqlib(storeDir + '/customDevices')
  + let i = 0
  + for (const d in customDevices) {
  + hassDevices[d] = customDevices[d]
  + i++
  + }
  +
  + debug('Loaded', i, 'custom hass devices configurations')
  +} catch (error) {
  + if (error.message.indexOf('Cannot find module') >= 0) {
  + debug('No custom hass devices file found')
  + } else {
  + debug('Error while loading store/customDevices', error.message)
  + }
  +}
  +
  const NODE_PREFIX = 'nodeID_'
  // const GW_TYPES = ['valueID', 'named', 'manual']
  // const PY_TYPES = ['time_value', 'zwave_value', 'just_value']
  @@ -588,16 +606,15 @@ Gateway.prototype.discoverDevice = function (node, hassDevice) {
  var mode = node.values[payload.mode_state_topic]
  var currTemp = node.values[payload.current_temperature_topic]
  - var setId;
  + var setId
  if (mode !== undefined) {
  setId = hassDevice.setpoint_topic && hassDevice.setpoint_topic[mode.value] ? hassDevice.setpoint_topic[mode.value] : hassDevice.default_setpoint
  // only setup modes if a state topic was defined
  payload.mode_state_template = `{% set values = ${JSON.stringify(map.map)} %} {{ ${map.check} }}`
  payload.mode_state_topic = this.mqtt.getTopic(this.valueTopic(node, mode))
  payload.mode_command_topic = payload.mode_state_topic + '/set'
  - }
  - else {
  - setId = hassDevice.default_setpoint;
  + } else {
  + setId = hassDevice.default_setpoint
  }
  var setpoint = node.values[setId]
  var map = getMappedValues(mode, hassDevice.mode_map, this.config.integerList)
  