Turn on fan when outside temp hits threshold

Can someone help me with a blueprint to turn on a plug when the outside temp hits like 22c and then turn off the plug once outside drops below 15c

I cant find an automation that starts and stops the plug when it goes above and below 2 temps.
Can someone help me out?

We can build an automation for that, just share the entity_id of the temperature sensor and the switch.

AWESOME!
I was thinking just using the outside temp from the built in weather entity?
So like weather forecast for the day, and once it reaches 20c outside as per the weather entity, and then turn off the fan again once it hits like 15c outside.

Basically I have a smart plug controlling some fans and an extractor for my loft where my server rack is.
I dont want the fan going 24/7, and I also dont want to control it manually. Right now its Winter in the UK so there is no need for it to be running.
But in Summer only really on the days where the loft warms up do I want it to run. In the evenings it generally cools down enough to not be needed again.
Hence the reason I want it to turn itself back off.

Hopefully this makes sense and helps explain it?
And thank you so much again.

The following automations has two triggers:

  • one if outside temperature goes above 20
  • one if outside temperature falls below 15

It turns on a switch (you smart plug), if temperature is above 20 and off otherwise. Since the automation only triggers on passing the thresholds 15/20, the switch will stay unchanged if temperature is between 15-20.

Replace <your-weather-entity> and <your-plug-entity> with appropriate values, of course.

alias: Fan Control
description: 'Turns plug on, if temperature is above 20°C, off otherwise'
mode: single
trigger:
  - platform: numeric_state
    entity_id: weather.<your-weather-entity>
    attribute: temperature
    above: '20'
  - platform: numeric_state
    entity_id: weather.<your-weather-entity>
    attribute: temperature
    below: '15'
condition: []
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: weather.<your-weather-entity>
            attribute: temperature
            above: '20'
        sequence:
          - service: switch.turn_on
            data: {}
            entity_id: switch.<your-plug-entity>
    default:
      - service: switch.turn_off
        data: {}
        entity_id: switch.<your-plug-entity>
3 Likes

Wow amazing man, thank you!
Let me test that out.

Can I install this as a blueprint? Or just copy the code?

Copy code into the automation editor switched to YaML mode. Switch back to visual mode and select your appropriate weather and switch entities.

I have no clue about blueprints.

Awesome!

Pretty sure that works! Thank you so much!

Thanks @sheminasalam too for your willing spirit!

1 Like