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

Created on 4 Oct 2020  路  20Comments  路  Source: home-assistant/core

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?

deconz

All 20 comments

deconz documentation
deconz source
(message by IssueLinks)

Hey there @kane610, mind taking a look at this issue as its been labeled with an integration (deconz) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

Can you enable debug logging per integration documentation to share the device description of the thermostat?

Not sure this is what you're after, but does this work?

'2': {'config': {'battery': 41, 'heatsetpoint': 2200, 'mode': 'heat', 'offset': 0, 'on': True, 'reachable': True}, 'ep': 1, 'etag': 'cc6f59149b447ed6989aa905724b15b1', 'lastseen': '2020-10-04T13:00Z', 'manufacturername': 'Zen Within', 'modelid': 'Zen-01', 'name': 'Zen-01', 'state': {'lastupdated': '2020-10-04T12:52:49.732', 'on': False, 'temperature': 2140}, 'type': 'ZHAThermostat', 'uniqueid': '00:24:46:00:00:11:6f:56-01-0201'},

2020-10-04 08:00:56 DEBUG (MainThread) [pydeconz.deconzdevice] Zen-01 created as {'config': {'battery': 41, 'heatsetpoint': 2200, 'mode': 'heat', 'offset': 0, 'on': True, 'reachable': True}, 'ep': 1, 'etag': 'cc6f59149b447ed6989aa905724b15b1', 'lastseen': '2020-10-04T13:00Z', 'manufacturername': 'Zen Within', 'modelid': 'Zen-01', 'name': 'Zen-01', 'state': {'lastupdated': '2020-10-04T12:52:49.732', 'on': False, 'temperature': 2140}, 'type': 'ZHAThermostat', 'uniqueid': '00:24:46:00:00:11:6f:56-01-0201'}

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?

Not sure this is what you're after, but does this work?

'2': {'config': {'battery': 41, 'heatsetpoint': 2200, 'mode': 'heat', 'offset': 0, 'on': True, 'reachable': True}, 'ep': 1, 'etag': 'cc6f59149b447ed6989aa905724b15b1', 'lastseen': '2020-10-04T13:00Z', 'manufacturername': 'Zen Within', 'modelid': 'Zen-01', 'name': 'Zen-01', 'state': {'lastupdated': '2020-10-04T12:52:49.732', 'on': False, 'temperature': 2140}, 'type': 'ZHAThermostat', 'uniqueid': '00:24:46:00:00:11:6f:56-01-0201'},

2020-10-04 08:00:56 DEBUG (MainThread) [pydeconz.deconzdevice] Zen-01 created as {'config': {'battery': 41, 'heatsetpoint': 2200, 'mode': 'heat', 'offset': 0, 'on': True, 'reachable': True}, 'ep': 1, 'etag': 'cc6f59149b447ed6989aa905724b15b1', 'lastseen': '2020-10-04T13:00Z', 'manufacturername': 'Zen Within', 'modelid': 'Zen-01', 'name': 'Zen-01', 'state': {'lastupdated': '2020-10-04T12:52:49.732', 'on': False, 'temperature': 2140}, 'type': 'ZHAThermostat', 'uniqueid': '00:24:46:00:00:11:6f:56-01-0201'}

Exactly thanks

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

Awesome! Glad I could help. Thanks for jumping on it so quickly.

I will not get this into 0.116 unfortunately, but it will most certainly be a part of 0.117. Too much to do and too many changes to the integration after the beta was cut.

No problem. My hack is working just fine right now, so i'm good to go. I appreciate the help.

Did you use the climate service to send the cool value initially when you got the error? It wasn't a button in the interface right?

Yep. Before i made any changes, there was no "cool" option in my thermostat cards. The errors i posted appeared after making a service call to change to cool mode.

I have noticed that my set points aren't actually going through right now, even after the change. It will switch modes just fine, but when I use the climate.set_temperature service, the service fails to change the temperature on the thermostat. What's strange is that it doesn't throw an error, and the thermostat card actually shows the new value for the setpoint. But if i'm looking at the thermostat, i see it flash but the set point never changes.

I'm guessing it has to do with this bit:
@property def target_temperature(self): """Return the target temperature.""" return self._device.heatsetpoint

Just confirmed I can change the heating setpoint but cannot change the cooling setpoint.

Googling led me to the the deconz-rest-plugin github page. From the looks of it, the deCONZ rest plug-in doesn't even support setting the cooling set point? At the top, there's a list of functions:

option | read/write | attribute | description -------------------|------------|-----------|--------------------- state.on | read only | 0x0029 | running state on/off state.temperature | read only | 0x0000 | measured temperature config.heatsetpoint| read write | 0x0012 | heating setpoint config.mode | read write | 0x001C | System mode config.scheduleron | read write | 0x0025 | scheduler on/off config.offset | read write | 0x0010 | temperature offset config.scheduler | read write | (command) | scheduled setpoints

But setting the cooling setpoint is attribute 0x0011, and not listed. Is this something I will need to take up with Dresden?

Yeah create an issue on their github

Looks like a fix has been merged in the rest api and is on the way!

https://github.com/dresden-elektronik/deconz-rest-plugin/pull/3665

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

@andynbaker looks like more thermostat features have been added with 2.6.0 beta, could you try it out and share new device descriptions from rest api?

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

Awesome! Im trying to fix all deconz issues in hass before next beta.

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'},
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kdschlosser picture kdschlosser  路  374Comments

ariel-madril picture ariel-madril  路  451Comments

gieljnssns picture gieljnssns  路  277Comments

abouelric picture abouelric  路  165Comments

balloob picture balloob  路  371Comments