ESPHome climate fan speed bases on temperature

Hi,

Is there a way to set a ESPhome fan speed bases on the difference between the wanted temperature and the actual temperature?

The problem I want to solve is the following. I have a patchrack running with a ESPhome controled fan on top. On the same ESPhome I have two dallas temperatures measuring the input temperature and the actual temp inside the patchrack. I want to keep the rack, say on 26C’, and the temp is 30, that means the fans need to run on 100%. When the temp is 27, the fans can run on 50% and below the 26 the fans can run on say 20%. I’m realy strugling to figure this out.

I know how to control everything, but would like to have it al running on ESP with just the wished temp changed from home assistant for instance.

Assuming you have say a H-Bridge fan controlling your fan speed (or any other fan entity with a controllable speed), use an on_value_range: action in your temperature sensor to issue a fan.turn_on: action with an appropriate speed for the desired range.

Without your yaml that’s about the level of detail I can give for a solution.

sensor:
  - platform: dallas
    # ...
    on_value_range:
      - below: 25.0
        then:
          - fan.turn_on: 
              id: fan_1
              speed: 20% # can't remember the exact syntax
      - above: 25.0
        below: 30.0
        then:
          - ...
      - above: 30.0
        then:
          - ...

How are you controlling the fan? H-Bridge? Mosfet?

This may be overkill but, it would work and you could quickly change your set points from the HA front end. It has Fan only modes for just cooling with a fan.


1 Like

Sorry for the lack of info in the first post.

I’ve been going the wrong way with this. I have the fan running with PWM, not sure if this is mosfet or H-bridge, but it is controlled with a ESP8266 running ESPhome. Got is configured with the thermostat climate as mentioned by @Fallingaway24. I was trying to do the logic in the esp itself, but converted it to HA. So now I have multiple presets with fanspeed 1, 2, 3, 4, 5 and HA checks if the temperature is getting out of hand to increase the fanspeed (1 is low, 5 is highest).

Thanks for getting me out of my tunnelvision :stuck_out_tongue:

The thermostat climate controller runs on the esp8266 therefore the logic is done by the esp8266.

So, Esphome has a thermostat and HA has a thermostat. You can use either one. If you use the esphome thermostat, it provides your wirh a similar looking thermostat controller in HA so you can easily configure the esp8266 logic from HA.

Rather than not giving a Fu** and saying you dont know if you set it up to use an H-Bridge or a mosfet, its pretty easy to figure out. Its also kind of important to know these things, ya know?

All it takes is a stroll over to the esphome docs…