zacs / ha-dualmodegeneric

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

Fan turns off when selecting heating or cooling twice + ESPHome based thermostat restarts on heat/cool cycle #53

Closed krosseyed closed 6 months ago

krosseyed commented 1 year ago

Whenever I enable the heating (fire icon) or cooling (snowflake icon) by pressing on it it twice in the dashboard widget I made for my ESP8266 based thermostat, it turns off the fan but leaves the heater or cooler turned on and maintains that it is in its previous heating or cooling state. I have press the on/off toggle to get it out of this state.

I do not think this is good as it will keep my heater or A/C running without the fan, wasting power at best and damaging my HVAC system at worst. I have mitigated this somewhat by putting a switch for the fan on the dashboard.

I also have an issue where the ESP will keep heating the room and reset itself after it gets about 3-5F above the target temperature I want it to stay in. Not sure if this is related to the widget causing issues, but I figured I would lump these two together as they seem to stem from the same bugs.

david-kalbermatten commented 1 year ago

This is unfortunately by design as the "fan entity" in the config is not actually meant for representing the fan in an HVAC but rather a "fan mode" so the logic for controlling the fan of your HVAC should be handled with a template entity of some kind. Run scripts for on/off actions.

My climate config with this integration:

# climate.yaml
- platform: dualmode_generic
  name: David's Bedroom Thermostat
  unique_id: climate.david_s_bedroom_thermostat
  # heater: input_boolean.space_heater_david
  cooler: switch.furber_ac_cooler
  fan: switch.furber_ac_fan
  fan_behavior: neutral
  dryer: switch.furber_ac_dryer
  dryer_behavior: cooler
  # reverse_cycle: cooler, fan, dryer
  target_sensor: sensor.david_bedroom_temperature_sens_temperature
  # enable_heat_cool: True
  min_temp: 15
  max_temp: 30
  cold_tolerance: 0.8
  hot_tolerance: 0.6
  min_cycle_duration:
      minutes: 15

And this is what one of my template switches looks like:

# switches.yaml
- platform: template
  switches:
    furber_ac_cooler:
      friendly_name: Furber AC Cooler
      icon_template: mdi:snowflake
      # value_template: "{{ states('sensor.shelly_shsw_pm_e8db84d2160c_current_consumption') | int > 750 }}"
      value_template: "{{ is_state('input_boolean.air_conditioner_david', 'on') }}"
      turn_off:
        - condition: state
          entity_id: input_boolean.air_conditioner_david
          state: 'on'
        - service: script.furber_ac_turn_off_cool
        - service: input_boolean.turn_off
          entity_id: input_boolean.air_conditioner_david
      turn_on:
        - condition: state
          entity_id: input_boolean.air_conditioner_david
          state: 'off'
        - service: input_boolean.turn_on
          entity_id: input_boolean.air_conditioner_david
        - service: script.furber_ac_cool_mode