ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
338 stars 49 forks source link

[Feature request] Add capability to switch between heating and cooling modes from UI #86

Closed GoNzCiD closed 10 months ago

GoNzCiD commented 1 year ago

This virtual thermostat with PID looks quite brilliant, thanks for your work!

I have a question: Is it also valid for cooling, or it only fits for a heater system?

T81 commented 1 year ago

This can be done by setting ac_mode parameter to True Read about it in Parameters

GoNzCiD commented 1 year ago

Thanks @T81! I suppose it's needed to edit the yaml and restart HA, I mean, there is no interactive switch to change it from the UI, right? If yes, it should be great to include this as a new FR...

ScratMan commented 1 year ago

Yes, you need to restart HA after editing the Yaml. I change the issue to feature request to add a service to switch the mode.

ScratMan commented 1 year ago

I had a look to this FR, but it's more complex that what it seems. When setting the ac_mode to true, PID is set to work between -100% and 0% ; but I'm not sure it's compatible with standard AC equipments. The way it should work strongly depends on the controlled equipment: Is it using a single switch to be on or off with another control to select between heating or cooling ? Or is it using a -100%/100% control range on a unique entity to cool or heat ?

Could someone please provide some examples of AC controlling in HA ?

ScratMan commented 1 year ago

I could at least switch on/off AC mode changing the value in the YAML and reloading the integration through the service.

service: smart_thermostat.reload
data: {}
GoNzCiD commented 1 year ago

Hi @ScratMan, at least for my case, with heating/cooling floor (with water circuits) it's completely the same output control than for heat mode. Just operate in the opposite way. So a relay is open/close to manage the valve & pump that flows water. Previously, you have changed the mode in the 'boiler' between heat/cool mode. I don't know if it's the same for the AC systems.

Just for this FR, I understood that the behaivour is the same as when ac_mode is set to true.

fisiomacao commented 1 year ago

Another one interested on this. I'm trying to use pid to control my buffer tank temperature with heat pump. The way it was functioning was with a radio thermostat in my living room, measuring room emperature and turning heat pump on and off. Problem was my fancoils still work while heat pump is off and buffer tank is cold, and temperature drops a lot. Now I eliminated that thermostat and have a thermometer reading buffer tank water temperature and a Shelly 2.5 turning heat pump on and off. And now I have two smart thermostats, one for heating and other for cooling. Why not having only one doing both?

ScratMan commented 1 year ago

Could you please provide your configurations for both thermostats so I can look for a way to merge them ?

fisiomacao commented 1 year ago
- platform: smart_thermostat
  name: Inércia Inverno
  unique_id: inercia_inverno
  heater: switch.shellyswitch25_c45bbe77520f_channel_1
  target_sensor: sensor.inercia_temperature
  min_temp: 20
  max_temp: 65
  ac_mode: False
  keep_alive:
    seconds: 300
  kp: 100
  ki: 0
  kd: 0
  ke: 0
  pwm: 00:10:00
  min_cycle_duration: 120
  sampling_period: 0
  target_temp_step: 0.5
  precision: 0.1
  preset_sync_mode: sync
  boost_pid_off: true
  away_temp: 40
  eco_temp: 45
  boost_temp: 55
  debug: true

- platform: smart_thermostat
  name: Inércia Verão
  unique_id: inercia_verao
  heater: switch.shellyswitch25_c45bbe77520f_channel_2
  target_sensor: sensor.inercia_temperature
  min_temp: 0
  max_temp: 25
  ac_mode: true 
  keep_alive:
    seconds: 300
  kp: 100
  ki: 0
  kd: 0
  ke: 0
  pwm: 00:10:00
  min_cycle_duration: 120
  sampling_period: 0
  target_temp_step: 0.5
  precision: 0.1
  preset_sync_mode: sync
  boost_pid_off: true
  away_temp: 12
  eco_temp: 10
  boost_temp: 5
  debug: true
fisiomacao commented 1 year ago

Could you please provide your configurations for both thermostats so I can look for a way to merge them ?

Any news?

AnduriI commented 1 year ago

what is the status of that FR? Is it now possible to switch heating/cooling in UI? I also have a underfloor water circuit with simple on/off-valves. The mode would be selected depending on the temperature coming from the heatpump, but the valves to a room should be opened or closed depending on heating/cooling needed for that room.

fisiomacao commented 1 year ago

For what I know, nothing changed. I'm using dual smart termostat https://github.com/swingerman/ha-dual-smart-thermostat

AnduriI commented 1 year ago

For what I know, nothing changed. I'm using dual smart termostat https://github.com/swingerman/ha-dual-smart-thermostat

could you please update the link to the correct url as shown in the text? The actual link is from this repo. The dual smart thermostat is not able to use a single switch to operate heating and cooling. Therefor I can not use it.

ScratMan commented 1 year ago

One option would be to add a service to switch AC mode to True or False. I understand that the driving of the boiler (control_output, own and on/off switch) should remain the same (no more -100/0 range for control output as of today with AC mode on); am I correct ? Switching to AC mode should be done by the service on Smart Thermostat and physically switching the boiler to cooling mode. Right?

AnduriI commented 1 year ago

well I can only specify that for my heating setup: In case it is in heating mode, the sensor for supply temperature is >25°C and in cooling mode it is <22°. That's the criteria I used at the moment to differentiate those to close some valves during cooling where not needed.

ScratMan commented 1 year ago

Hi, v2023.7.0-beta1 is available. It changes the way the AC mode is managed. When set to ac_mode: true in YAML configuration, the thermostat card will now get both HEAT and COOL modes displayed, allowing to switch between them directly from the HA interface or using core service 'climate.set_hvac_mode. You can also specify a dedicated cooling entity (switch or valve) using the cooler parameter in YAML if your system uses two different devices for heating and cooling.

You can switch to this pre-release by enabling "beta versions" in HACS download screen. I will make the final release if the pre-release is confirmed to work well. Thanks.

GoNzCiD commented 1 year ago

Thanks @ScratMan, I'll try it... but today looks cloudy ^_^.

Edit: I've installed beta1 as you said, but I've noticed there's a beta2. It's ok to try the b1?

ScratMan commented 1 year ago

Yes, beta2 adds capability to drive input_number helpers as heater entity, there will be no difference regarding AC mode.

AnduriI commented 11 months ago

@ScratMan I did test yor pre-release quite some time. For me it is working absolutly fine. The weather here in germany was only few weeks hot enough to make my heating system cool, so it took a little time to test everything. I still have to tune the pid correctly, but I think that is best done during the realy cold period to actually see the changes.