zacs / ha-dualmodegeneric

Generic thermostat capable of heating and cooling
68 stars 26 forks source link

Switching from heat_cool to fan or dry results in fault - Failed to call service climate/set_hvac_mode. '>=' not supported between instances of 'NoneType' and 'float' #60

Closed dhi20 closed 4 months ago

dhi20 commented 7 months ago

Hi, When changing from heat_cool to dry or fan the following error results. It seems to be a result of the target temperature being null when in heat_cool mode.

I am able to get into fan and dry mode if I first move from heat_cool to either cool or heat modes.

`2023-12-08 13:44:27.223 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: '>=' not supported between instances of 'NoneType' and 'float'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/dualmode_generic/climate.py", line 630, in async_set_hvac_mode
await self._async_control_heating(force=True)
File "/config/custom_components/dualmode_generic/climate.py", line 833, in _async_control_heating
too_cold = self._is_too_cold_activate()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dualmode_generic/climate.py", line 900, in _is_too_cold_activate
return self._target_temp >= self._cur_temp + self._cold_tolerance
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>=' not supported between instances of 'NoneType' and 'float'
2023-12-08 13:44:27.235 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281472285381312] Error handling message: Unknown error (unknown_error) Daniel from 192.168.88.232 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 782, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/dualmode_generic/climate.py", line 630, in async_set_hvac_mode
await self._async_control_heating(force=True)
File "/config/custom_components/dualmode_generic/climate.py", line 833, in _async_control_heating
too_cold = self._is_too_cold_activate()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dualmode_generic/climate.py", line 900, in _is_too_cold_activate
return self._target_temp >= self._cur_temp + self._cold_tolerance
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>=' not supported between instances of 'NoneType' and `'float'``
TriskelionTech commented 6 months ago

I've got the same issue. This happens both when the mode change is triggered manually (by the lovelace card) as well as when the change is by a schedule or automation.

This is an extremely frustrating change as it pretty much broke several key automations for my home system.

Excentyl commented 4 months ago

@dhi20 @TriskelionTech I have written an update which I hope will fix this issue. Could you please check and let me know if the newest version fixes the issue for you?

david-kalbermatten commented 4 months ago

Seems to work as intended. Confirmed it myself while testing for #65