ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
361 stars 55 forks source link

Output values are ignored #243

Open geduxas opened 2 weeks ago

geduxas commented 2 weeks ago

Describe the bug Smart thermostat will go out of min/max range

To Reproduce Steps to reproduce the behavior:

  1. Create input entity with helper, set input element range 0-10, step 1.
  2. Create smart thermostat from sample, use input entity we created earlier as heater, set output_min: 0 and output_max: 10
  3. Increase heat request temperature to max (28°)
  4. Smart thermostat wil try set input element out of max range.

Expected behavior Heat element should be drived with min-max values

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

Error in HomeAssistant

Logger: homeassistant.core
Source: core.py:2781
First occurred: 22:55:57 (5 occurrences)
Last logged: 22:57:18

Error executing service: <ServiceCall input_number.set_value (c:01J9PV7R354KACV5PR9A5WDM5N): entity_id=['input_number.z1valve'], value=33.6>
Error executing service: <ServiceCall input_number.set_value (c:01J9PV8CFR1011HD1H961T875E): entity_id=['input_number.z1valve'], value=33.6>
Error executing service: <ServiceCall input_number.set_value (c:01J9PV8E2JA7H9AGTRAZ615XS8): entity_id=['input_number.z2valve'], value=27.1>
Error executing service: <ServiceCall input_number.set_value (c:01J9PVA72SZDWB6XPCY54X8KEZ): entity_id=['input_number.z1valve'], value=33.6>
Error executing service: <ServiceCall input_number.set_value (c:01J9PVA72X5NJP9HXK198280CF): entity_id=['input_number.z2valve'], value=27.1>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 2781, in _run_service_call_catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/input_number/__init__.py", line 307, in async_set_value
    raise vol.Invalid(
voluptuous.error.Invalid: Invalid value for input_number.z1valve: 33.6 (range 0.0 - 10.0)

Sample thermostat

climate:
  - platform: smart_thermostat
    name: Zone1 Thermostat
    unique_id: zone1_thermostat
    heater:
      - input_number.z1valve
    target_sensor: sensor.temp_temperature
    min_temp: 7
    max_temp: 28
    ac_mode: false
    target_temp: 19
    keep_alive:
      seconds: 60
    away_temp: 14
    kp: 5
    ki: 0.01
    kd: 500
    output_min: 0
    output_max: 10
    pwm: 0
geduxas commented 2 weeks ago

If it's help's, what i am trying to accomplish, is to make automatic adjustments for heating pump. I have setup, where i can adjust temperature shift by increasing by 5 steps, or decreasing. So have range -5..0..+5 , though i could use input slider with range 0-10, make substraction from it and pass directly to pump..