message: hass support action_topic in thermostats
diff: @@ -724,11 +724,11 @@ Gateway.prototype.rediscoverAll = function () {
  }
  Gateway.prototype.discoverDevice = function (node, hassDevice) {
  - var hassID = hassDevice ? hassDevice.type + '_' + hassDevice.object_id : null
  + let hassID = hassDevice ? hassDevice.type + '_' + hassDevice.object_id : null
  try {
  if (hassID && !node.hassDevices[hassID]) { // discover the device
  - var payload
  + let payload
  // copy the configuration without edit the original object
  hassDevice = JSON.parse(JSON.stringify(hassDevice))
  @@ -736,8 +736,8 @@ Gateway.prototype.discoverDevice = function (node, hassDevice) {
  if (hassDevice.type === 'climate') {
  payload = hassDevice.discovery_payload
  - var mode = node.values[payload.mode_state_topic]
  - var setId
  + let mode = node.values[payload.mode_state_topic]
  + let setId
  if (mode !== undefined) {
  setId = hassDevice.setpoint_topic && hassDevice.setpoint_topic[mode.value] ? hassDevice.setpoint_topic[mode.value] : hassDevice.default_setpoint
  @@ -750,13 +750,14 @@ Gateway.prototype.discoverDevice = function (node, hassDevice) {
  setId = hassDevice.default_setpoint
  }
  - var setpoint = node.values[setId]
  -
  + let setpoint = node.values[setId]
  payload.temperature_state_topic = this.mqtt.getTopic(this.valueTopic(node, setpoint))
  payload.temperature_command_topic = payload.temperature_state_topic + '/set'
  - var fan = node.values[payload.fan_mode_state_topic]
  + let action = node.values[payload.action_topic]
  + if (action) payload.action_topic = this.mqtt.getTopic(this.valueTopic(node, action))
  + let fan = node.values[payload.fan_mode_state_topic]
  if (fan !== undefined) {
  payload.fan_mode_state_topic = this.mqtt.getTopic(this.valueTopic(node, fan))
  payload.fan_mode_command_topic = payload.fan_mode_state_topic + '/set'
  @@ -767,17 +768,14 @@ Gateway.prototype.discoverDevice = function (node, hassDevice) {
  }
  }
  - var currTemp = node.values[payload.current_temperature_topic]
  -
  - if (currTemp !== undefined) {
  - payload.current_temperature_topic = this.mqtt.getTopic(this.valueTopic(node, currTemp))
  - }
  + let currTemp = node.values[payload.current_temperature_topic]
  + if (currTemp !== undefined) payload.current_temperature_topic = this.mqtt.getTopic(this.valueTopic(node, currTemp))
  } else {
  payload = hassDevice.discovery_payload
  - var topics = {}
  + let topics = {}
  - // popolate topics object with valueId: valueTopic
  + // populate topics object with valueId: valueTopic
  for (let i = 0; i < hassDevice.values.length; i++) {
  const v = hassDevice.values[i] // the value id
  topics[v] = node.values[v] ? this.mqtt.getTopic(this.valueTopic(node, node.values[v])) : null
  