zacs / ha-dualmodegeneric

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

[Bug] Enabling thermostat when switch already active results in idle #12

Closed KairuByte closed 7 months ago

KairuByte commented 3 years ago

Reproduction Steps:

  1. Set up thermostat with two switches, one for heat and one for cool (as expected)
  2. Set thermostat to off
  3. Set thermostat to within heating range (if ambient is 70 set target to 74 for example)
  4. Manually turn cool switch on
  5. Set thermostat to heat

Expected results:

Thermostat should swap cool switch to off, and heat switch to on.

Actual results:

Both switches are set to off, and heat will not kick on after multiple minutes.

Workaround:

Set mode to heat a second time.

Note:

I believe this works in both modes, but heat was chosen for the steps arbitrarily.

zacs commented 3 years ago

You know, I think I actually ran into this last week. Should be easy to fix, I will add explicit setting of both switches in all modes.

bbbates commented 3 years ago

@KairuByte can you try setting the reverse_cycle property on the thermostat component to true, and see if that fixes the issue for you? I have that property turned on for my thermostat, and I couldn't reproduce using the steps above.

zacs commented 3 years ago

@bbbates Looking through the code last night, my guess is that https://github.com/zacs/ha-dualmodegeneric/blob/09455b0afc64950eebd575c361d787646e643d42/custom_components/dualmode_generic/climate.py#L331 (and the matching lines) is the likely culprit, since that _async_cooler_turn_off() gets missed. My fix adds a backup call to turn off the cooler, but I am respecting the reverse_cycle property so I'm guessing the fix will be subject to the same issue.

@KairuByte are you using reverse_cycle at all?

KairuByte commented 3 years ago

@zacs I am currently not using reverse_cycle. I can give it a shot later tonight though.

KairuByte commented 3 years ago

@zacs @bbbates I can confirm that reverse_cycle does prevent immediate idle status, and switches being turned off. That said it leads into #13, including what I would consider a breaking bug (as mentioned here)

phretor commented 3 years ago

I'm on the latest release (just pulled now) and I noticed that the "on/off" toggle switch doesn't call the switch.turn_on service on the switch.studio_a_c entity. Here's my configuration:

- platform: dualmode_generic
  name: Termostato studio
  unique_id: climate.termostato_studio
  cooler: switch.studio_a_c
  heater: switch.studio_a_c
  reverse_cycle: cooler, heater
  target_sensor: sensor.studio_thp_temperature
  enable_heat_cool: True
  min_temp: 20.0
  max_temp: 35.0
  precision: 0.5
  cold_tolerance: 0.2
  hot_tolerance: 0.2
  min_cycle_duration:
    minutes: 1
david-kalbermatten commented 2 years ago

I'm on the latest release (just pulled now) and I noticed that the "on/off" toggle switch doesn't call the switch.turn_on service on the switch.studio_a_c entity. Here's my configuration:

- platform: dualmode_generic
  name: Termostato studio
  unique_id: climate.termostato_studio
  cooler: switch.studio_a_c
  heater: switch.studio_a_c
  reverse_cycle: cooler, heater
  target_sensor: sensor.studio_thp_temperature
  enable_heat_cool: True
  min_temp: 20.0
  max_temp: 35.0
  precision: 0.5
  cold_tolerance: 0.2
  hot_tolerance: 0.2
  min_cycle_duration:
    minutes: 1

Yea, that won't work because you're trying to use the same switch for both heating and cooling... (at least according to your config)