core: Zen-01 thermostat added through deCONZ is missing "cool" mode capabilty

The problem

I have three Zen Zen-01 thermostats that worked fine with Home Assistant when added via ZHA. I recently switched to deCONZ and while the thermostats pair fine, they are missing the “cool” mode capability. I can control them fine from Home Assistant, switching between heat, auto, and off, but no cool mode is available. Using the hvac_mode service works for heat/auto/off but errors out when I try to send cool mode.

When I VNC into deCONZ I can click around and see the capability is recognized by the software. It is just not coming through when the devices are added to Home Assistant. I’m guessing it it something lost by the integration?

Environment

  • Home Assistant Core release with the issue: 0.115
  • Last working Home Assistant Core release (if known): Never (this was an issue when I switched to ZHA like six months ago)
  • Operating environment (OS/Container/Supervised/Core): OS
  • Integration causing this issue: deCONZ
  • Link to integration documentation on our website: link

Problem-relevant configuration.yaml


Traceback/Error logs

This is the traceback when I call the cool hvac_mode service:

Logger: homeassistant.components.websocket_api.http.connection.548296829776
Source: components/deconz/climate.py:117
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 9:32:29 PM (1 occurrences)
Last logged: 9:32:29 PM

local variable 'data' referenced before assignment
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 137, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1315, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1350, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 459, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 655, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 490, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/deconz/climate.py", line 117, in async_set_hvac_mode
    await self._device.async_set_config(data)
UnboundLocalError: local variable 'data' referenced before assignment

Additional information

Full disclaimer, I have no idea what I’m doing, but could it be because this component does not include cool mode?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 38 (18 by maintainers)

Most upvoted comments

Just got back from a work trip and am able to play around. I’m on 1.0.0b1 now; the thermostats report all their modes now and I can easily toggle back and forth between cool and heat mode. I can also change the cool set point and turn the fan on and off! Thank you so much for making this happen!

It does not work outside of haas. I already posted in the deconz issue I opened. I’m thinking this is something on their end, as I get this same error when I make a call directly to the API.

Ok this is very new to me. Playing around with it now. Here’s the JSON response when I ask the API for the current state:

{"config":{"battery":25,"coolsetpoint":2400,"fanmode":null,"heatsetpoint":2222,"mode":"cool","offset":0,"on":true,"reachable":true},"ep":1,"etag":"c1bb00a74eb2d7d65f11fcacff6bdad4","lastseen":"2020-11-27T22:08Z","manufacturername":"Zen Within","modelid":"Zen-01","name":"Zen-01","state":{"lastupdated":"2020-11-27T22:05:57.045","on":false,"temperature":2410},"type":"ZHAThermostat","uniqueid":"00:24:46:00:00:11:6f:56-01-0201"}

I’ll try to get something working in node-red and then pull the logs

Looks like coolsetpoint and fanmode are new!

'2': {'config': {'battery': 25,
'coolsetpoint': None,
'fanmode': None,
'heatsetpoint': 2222,
'mode': 'heat',
'offset': 0,
'on': True,
'reachable': True},
'ep': 1,
'etag': '074549903686a77a12ef0f06c499b1ef',
'lastseen': '2020-11-27T13:45Z',
'manufacturername': 'Zen Within',
'modelid': 'Zen-01',
'name': 'Zen-01',
'state': {'lastupdated': '2020-11-27T13:42:40.863',
'on': False,
'temperature': 2320},
'type': 'ZHAThermostat',
'uniqueid': '00:24:46:00:00:11:6f:56-01-0201'},

For sure. I’ll pull the beta image tonight and have a look.

@andynbaker get back to me once you’ve verified it work and we’ll get this sorted out

Ok, as I said I have no idea what I’m doing, but for giggles I hacked in what I assume are the missing bits to climate.py, adding HVAC_MODE_COOL where it seemed like it should go:

from homeassistant.components.climate.const import ( HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, HVAC_MODE_COOL, SUPPORT_TARGET_TEMPERATURE, )

SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_COOL, HVAC_MODE_OFF]

async def async_set_hvac_mode(self, hvac_mode): """Set new target hvac mode.""" if hvac_mode == HVAC_MODE_AUTO: data = {"mode": "auto"} elif hvac_mode == HVAC_MODE_HEAT: data = {"mode": "heat"} elif hvac_mode == HVAC_MODE_COOL: data = {"mode":"cool"} elif hvac_mode == HVAC_MODE_OFF: data = {"mode": "off"}

And wouldn’t you know it, it worked! I can now send hvac_mode = cool service calls and the thermostat changes just fine. I’ll play with it some more, but hopefully this gets you headed in the right direction. I’m not sure how anyone else didn’t have this problem, unless zigbee thermostats are really not used all that much?

The issue is that different thermostats have different feature sets. That’s why I need the device description so I can add additional support based on which device