Zwavejs2mqtt + CT80 Thermostat

Having an issue where the mode of the thermostat is always ‘Off’ (operation dropdown). It seems to pull that value from the operating state maybe? I haven’t found good docs on the thermostat json and how that value flows through so any help would be great. Screen and mqtt json included.

{
  "type": "climate",
  "object_id": "climate",
  "discovery_payload": {
    "min_temp": 5,
    "max_temp": 40,
    "temp_step": 0.5,
    "modes": [
      "off",
      "heat",
      "cool",
      "auto",
      "dry",
      "fan_only"
    ],
    "mode_state_template": "{{ {\"0\": \"off\", \"1\": \"heat\", \"2\": \"cool\", \"3\": \"auto\"}[value_json.value] | default('off') }}",
    "current_temperature_topic": "zwave/Living_Room/Thermostat/49/1/Air_temperature",
    "current_temperature_template": "{{ value_json.value }}",
    "temperature_state_topic": "zwave/Living_Room/Thermostat/67/1/setpoint/2",
    "temperature_state_template": "{{ value_json.value }}",
    "temperature_command_topic": "zwave/Living_Room/Thermostat/67/1/setpoint/2/set",
    "mode_state_topic": "zwave/Living_Room/Thermostat/64/1/mode",
    "mode_command_topic": "zwave/Living_Room/Thermostat/64/1/mode/set",
    "action_topic": "zwave/Living_Room/Thermostat/66/0/state",
    "action_template": "{{ {0: \"idle\", 1: \"heating\", 2: \"cooling\", 3: \"fan\", 4: \"idle\", 5: \"idle\", 6: \"fan\", 7: \"heating\", 8: \"heating\", 9: \"cooling\", 10: \"heating\", 11: \"heating\"}[value_json.value] | default('idle') }}",
    "temperature_unit": "F",
    "precision": 0.1,
    "device": {
      "identifiers": [
        "zwavejs2mqtt_0xf5baed9b_node7"
      ],
      "manufacturer": "Radio Thermostat Company of America (RTC)",
      "model": "Z-Wave Thermostat (CT80)",
      "name": "Living Room-Thermostat",
      "sw_version": "9.0"
    },
    "name": "Living Room-Thermostat_climate",
    "unique_id": "zwavejs2mqtt_0xf5baed9b_Node7_climate"
  },
  "values": [
    "49-1-Air temperature",
    "64-1-mode",
    "67-1-setpoint-1",
    "67-1-setpoint-2",
    "67-1-setpoint-11",
    "67-1-setpoint-12",
    "66-0-state"
  ],
  "mode_map": {
    "off": 0,
    "heat": 1,
    "cool": 2,
    "auto": 3
  },
  "setpoint_topic": {
    "1": "67-1-setpoint-1",
    "2": "67-1-setpoint-2",
    "11": "67-1-setpoint-11",
    "12": "67-1-setpoint-12"
  },
  "default_setpoint": "67-1-setpoint-1",
  "action_map": {
    "0": "idle",
    "1": "heating",
    "2": "cooling",
    "3": "fan",
    "4": "idle",
    "5": "idle",
    "6": "fan",
    "7": "heating",
    "8": "heating",
    "9": "cooling",
    "10": "heating",
    "11": "heating"
  },
  "discoveryTopic": "climate/Living_Room-Thermostat/climate/config",
  "persistent": false,
  "ignoreDiscovery": false,
  "id": "climate_climate"
}

You’re probably going to have to write your own mqtt template to fix this

If you go to your mqtt integration, then click the device, the click “mqtt info” there should be a payload under mqtt discovery info. That should be in yaml and give you a starting point to write your own template.

If you have that discovery yaml payload you can post it here and maybe someone can figure out what to change to help write a custom one.

Also, do you get any log warnings or errors around a template issue for this device? If so post those too.

That’s where I’m confused. I’d assume that modes are what’s listed in the Operation dropdown (true). In the zwave device config I can check those values in mode_state_topic (set to cool 64-1-mode) so I can’t figure out where the disconnect is.

I’ve used MQTT discovery with zigbee2mqtt but not with zwvaejs2mqtt. I’m actually using the zwavejs integration to bring all my zwave devices into Home Assistant. Even though the name is “zwavejs2mqtt”, you can disable the mqtt and just use it with the zwavejs home assistant integration over websockets. I tried mqtt in the beginning but was having issues with discovery and it seemed slower, so I’ve found the zwavejs integration to zwavejsmqtt is better and faster to bring the devices over. If you want to switch to the zwavejs integration instead of mqtt, that might fix this, and instructions are here ZwaveJS2Mqtt

If you need mqtt though, you have two options - the first I mentioned above is to just completely write your own template in YAML to take the raw MQTT data from the thermostat and make a device in Home Assistant.

The other option is to modify the JSON output on the zwavejs2mqtt side, which appears to be what you’re trying to do. I haven’t done that myself, but there is a good deal of documentation on it in the zwavejs2mqtt github pages. There also is a thermostat example there in that documentation that might help. There is the statement though saying “Thermostats are the most complex components to create” Not sure if you’ve seen that documentation yet but it is available at this link:

https://zwave-js.github.io/zwavejs2mqtt/#/guide/homeassistant-mqtt?id=home-assistant-using-mqtt-discovery

I kind of have the same issue I think. Here is what I said on this other forum item.

So, in my opinion, there is an issue with the operating state not being monitored or refreshed correctly in the thermostat module, no matter if it’s zwave or Wifi? But I can do it manually?

Appreciate the setup. Using the zwavejs integration with zwavejs2mqtt does work properly. Much easier than trying to fuss with the json.

1 Like