Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

[bug] with custom device thermostat, "Cannot read property 'value_id' of undefined" #841

Open
1 of 3 tasks
pdbogen opened this issue Nov 29, 2020 · 7 comments
Open
1 of 3 tasks
Assignees
Labels
bug Something isn't working

Comments

@pdbogen
Copy link
Contributor

pdbogen commented Nov 29, 2020

Version

Build/Run method

  • Docker
  • PKG
  • Manually built (git clone - npm install - npm run build )

Zwave2Mqtt version: 4.0.6
Openzwave Version: 1.6.0

Describe the bug

This worked alright in 4.0.5, but in 4.0.6 my custom device config for my thermostat is not correctly producing HA thermostat devices.

I see this in the logs:

2020-11-29T01:10:26.402Z z2m:Gateway Error while discovering device climate_thermostat of node 34: Cannot read property 'value_id' of undefined

Here's my customDevices.json:

{
  "21076-33136-512": [
    {
      "type": "climate",
      "object_id": "thermostat",
      "values": [
        "49-1-1",
        "64-1-0",
        "67-1-1",
        "67-1-2"
      ],
      "mode_map": {
        "auto": "Auto",
        "cool": "Cool",
        "off": "Off",
        "heat": "Heat"
      },
      "setpoint_topic": {
        "Cool": "67-1-2",
        "Heat": "67-1-1"
      },
      "discovery_payload": {
        "min_temp": 50,
        "max_temp": 99,
        "modes": [
          "auto",
          "cool",
          "off",
          "heat"
        ],
        "mode_state_topic": "64-1-0",
        "mode_command_topic": true,
        "current_temperature_topic": "49-1-1",
        "current_temperature_template": "{{ value_json.value }}",
        "temperature_state_template": "{{ value_json.value }}",
        "temperature_command_topic": true
      }
    }
  ]
}
@pdbogen pdbogen added the bug Something isn't working label Nov 29, 2020
@robertsLando
Copy link
Member

@pdbogen Are you sure all your valueIds exists? Also here you are missing the Auto setpoint, when you set the auto mode I check for its valueId in setpoint_topic and that error could come from this:

"setpoint_topic": {
        "Cool": "67-1-2",
        "Heat": "67-1-1",
        "Auto": "67-1-X"
      },

@pdbogen
Copy link
Contributor Author

pdbogen commented Dec 1, 2020

oh, good call. I gather I also need one for Off?

@robertsLando
Copy link
Member

oh, good call. I gather I also need one for Off?

Nope that't the only one that doesn't need a setpoint

@doguitar
Copy link

doguitar commented Dec 11, 2020

Having the same issue with the same versions as the OP and didn't want to report a duplicate issue. Although this is the first I'm trying so I can't speak to if this would have worked in the past.

{
  "57-8-17": [
    {
      "type": "climate",
      "object_id": "thermostat",
      "values": ["27-67-1-1", "27-67-1-2", "27-64-1-0", "27-49-1-1"],
      "mode_map": {"off": "Off", "heat": "Heat", "cool": "Cool"},
      "setpoint_topic": {"Heat": "27-67-1-1", "Cool": "27-67-1-2"},
      "discovery_payload": {
        "min_temp": 50,
        "max_temp": 90,
        "modes": ["off", "heat", "cool"],
        "mode_state_topic": "27-64-1-0",
        "mode_command_topic": true,
        "current_temperature_topic": "27-49-1-1",
        "current_temperature_template": "{{ value_json.value }}",
        "temperature_state_template": "{{ value_json.value }}",
        "temperature_command_topic": true
      }
    }
  ]
}

On a side note, the error logging for this method is pretty unhelpful. There's a single try/catch wrapping the entire method.

@robertsLando
Copy link
Member

@doguitar In zwavejs2mqtt now climates are auto discovered: https://github.com/zwave-js/zwavejs2mqtt

@doguitar
Copy link

What's the purpose/objective of the fork? Besides devices support (which is pretty major), why should I switch?

@robertsLando
Copy link
Member

It's explained here: https://github.com/zwave-js/zwavejs2mqtt#why-zwavejs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants