Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange error restoring "none" preset #3

Open
bengtner opened this issue Apr 21, 2022 · 3 comments
Open

Strange error restoring "none" preset #3

bengtner opened this issue Apr 21, 2022 · 3 comments

Comments

@bengtner
Copy link

I have defined a few climate controllers based on the simple thermostat. It's great to be able to define different setpoints for different modes, even if I just use two modes right now ('none' and 'eco' mode). Everything worked fine a couple of days, but all of a sudden it is not possible to change from 'eco' to 'none'. The actual change of mode is done by a script but a manual change of mode also triggers the fault.

I believe the error occurs in the thermostate function when comparing the sensor value with the setpoint. It looks like the setpoint has got an illegal value, and this triggers the fault? I have 7 climate controllers and it seems like the fault appears in any of them.

I have no clue how to fix this error condition. Restart of HA does not help.

version

1.0.2

Configuration

climate:
  - platform: simple_thermostat
    name: Uterum
    heater: switch.uterum
    target_sensor: sensor.uterum
    min_temp: 0
    max_temp: 25
    ac_mode: false
    cold_tolerance: 0.3
    hot_tolerance: 0
    min_cycle_duration:
      minutes: 10
    keep_alive:
      minutes: 10
    initial_hvac_mode: "heat"
    precision: 1

Log:

2022-04-21 21:58:14 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547996839168] '>=' not supported between instances of 'NoneType' and 'float'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1634, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1671, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 677, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 955, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 714, in _handle_entity_call
await result
File "/config/custom_components/simple_thermostat/climate.py", line 553, in async_set_preset_mode
await self._async_control_heating(force=True)
File "/config/custom_components/simple_thermostat/climate.py", line 487, in _async_control_heating
too_cold = self._target_temp >= self._cur_temp + self._cold_tolerance
TypeError: '>=' not supported between instances of 'NoneType' and 'float'

@bengtner
Copy link
Author

I think I have pinpointed what triggers this problem. It happens if you remove target_temp in the configuration. I removed that line in an attempt to preseve the temp setting at restart. In the documenation of the generic thermostat this can be read:

target_temp float (optional)
Set initial target temperature. Failure to set this variable will result in target temperature being set to null on startup. As of version 0.59, it will retain the target temperature set before restart if available.

I suspect It works fine to omit this variable as long as you have preset "none" set when HA restarts. But if you have any other mode active, this will trigger the fault. It was not 100% correct I had not changed anything. But obviously I did not try to restart HA in any other mode than 'none' when I made the change. That's why I thought everything was OK.

If you specify target_temp, that value kicks in at restart if I have specified a different setting for 'eco' mode. I want to keep the setpoint in any mode. Othervise you need to adjust all setpoints after a restart.

@bengtner
Copy link
Author

Now I've learned my problem is related to I tried to use "none" as a preset. That's not a good idea, since this triggers this problem I have described. If I just use the predefined presets, everything works as expected. I you set a temperature with preset 'none', you must have temperature defined in the device definition. And that value is used after a restart of HA. Make sense once you understand the behaviour. I think this should be mentioned in the documentation.

@dadge
Copy link
Owner

dadge commented Oct 4, 2022

Hello,

Sorry this code is not maintained anymore, please consider to switch to the new one : https://github.com/dadge/awesome_thermostat

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants