ha-warmup/warmup

Setting preset to boost doesn't work

foxy82 opened this issue · 7 comments

Error when selecting boost as a preset from the front end:

2020-01-05 18:06:52 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140299356821008] Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service connection.context(msg), File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call await asyncio.shield(self._execute_service(handler, service_call)) File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 205, in handle_service self._platforms.values(), func, call, service_name, required_features File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 336, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 358, in _handle_service_platform_call await getattr(entity, func)(**data) File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 421, in async_set_preset_mode await self.hass.async_add_executor_job(self.set_preset_mode, preset_mode) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/warmup/climate.py", line 218, in set_preset_mode raise InvalidStateError homeassistant.exceptions.InvalidStateError

What should we do to boost? Set to max temp for an hour?

Set to a few degrees higher for an hour?

Something else?

artmg commented

It appears that the override temperature is the desired floor temperature, rather than the air temperature so I think your first idea works well:

override_temperature = max_temp
override_duration_mins = 60

It depends if your heating is targeting a floor or air temp I believe.

artmg commented

so if heating_target= floor then as above. If =air then +4 for an hour. We could have this as a default value for boost_air_increase in the config so users can override, and maybe boost_minutes defaulting to 60

artmg commented

Oh, and perhaps a little additional logic. If run_mode = override then duration = duration + boost_minutes, else as above. That way additional presses of boost increase the duration incrementally.

rct commented

On a related note, when the thermostat is set to override (boost) outside of Home Assistant, it does not show the mode change correctly in Home Assistant. For me the mode changes to auto during override and back to heat when the override is complete. This might be related to #19 - override is mispelled.

Also here's the trackback with hopefully better formatting

2022-02-15 08:06:02 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2593853272]
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 486, in async_set_preset_mode
    await self.hass.async_add_executor_job(self.set_preset_mode, preset_mode)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/warmup/climate.py", line 218, in set_preset_mode
    raise InvalidStateError
homeassistant.exceptions.InvalidStateError
artmg commented

Thanks @rct - I'm inclined to agree with your reasoning for the 'setting outside of HA' issue. However this specific traceback indicates perhaps a different problem.

So set_preset_mode throws an InvalidStateError in line 218 of climate.py. So the set_preset_mode function, and in fact the return of proerty preset_mode, both have logic for only Home and Away modes, so disregard the fact that
when setting the available presets it does include Boost mode as an option.

I am not sure how we would like into the API to see what is delivered/returned for boost mode, but I think that's the extra case that needs coding here.