ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
353 stars 50 forks source link

Preset temperatures have a hardcoded maximum value of 30° #70

Closed sergioafeo closed 2 years ago

sergioafeo commented 2 years ago

When calling the service smart_thermostat.set_preset_temp, the new preset temperatures are not validated against the min_temp and max_temp parameters of the configuration. Instead, they appear to be validated against some fixed values. This effectively prevents the user from setting preset temperatures above 30°.

Steps to reproduce the behavior: Sample configuration (here, the controller is used to control humidity by switching a dehumidifier, hence the high values)

climate:
  - platform: smart_thermostat
    name: Smart Thermostat Example
    unique_id: smart_thermostat_example
    heater: switch.dehumidifier
    target_sensor: sensor.humidity
    min_temp: 45
    max_temp: 80
    ac_mode: True
    target_temp: 65

Create an automation with a service call as action:

service: smart_thermostat.set_preset_temp
data:
  home_temp: 65
target:
  entity_id: climate.smart_thermostat

The following error is found when debugging the automation:

Stopped because an error was encountered at [DATE] (runtime: 0.04 seconds)

value must be at most 30 for dictionary value @ data['home_temp']

The preset temperature is not updated.

Expected behavior The preset temperature should be updated to the indicated value (65).

Additional context Manually changing the set point of the controller to the desired value works as expected. Specifying a preset temperature in the configuration file works as well. Only the change through the service appears to have the faulty validation.

Thank you for the excellent work on this integration!

ScratMan commented 2 years ago

Should be fixed with v2022.1.1