Use Temperature Range in "If" Statement?

I am trying to build an automation that is triggered by a temperature range. I need this to automate a fan speed depending on the temperature. The options that I have now are limited to

“If the temperature matches a given temperature”

“If the temperature is equal or above a given temperature”

“If the temperature equal or below a given temperature”

I would need the option where I can select the following

“if the temperature is between XX deg and YY deg”

Is this something that is possible?

I think you could do multiple automations to achieve that.

something like if equal or below XX: turn on. and another if equal or above YY turn on

might take more than two, but I’m doing something like that with humidity

edit: I’ve not modified anything lately with the humidity ranges, but they are working. I haven’t tried adding any preconditions, but I’m sure they would be helpful.

^^ I had a quick look, and by adding a precondition, I believe you can add the other condition.

So,

IF temp is equal or above XX + precondition, temp is equal or below YY
turn on

I’m thinking another automation will have to manage the turn fan off part

*** OK, so maybe a giant temp increase would put the conditions outside of the ranges.

more automations might be better than using the preconditions

Or like JD suggests, do what I’ve been putting off and get familiar with Rules API. I’ve been hoping Automations would improve to the point that it woulldn’t be necessary, but so are, it hasn’t.

1 Like

It’s definitely possible, it’s just not as easy as it should be. :thinking:

If you want to stick with the official features, you should be able to do it with the rules API, but that has a pretty steep learning curve. It does allow you to do more complex rules than the ones you can just do through the app.

A simpler alternative, but clunkier, is to create a virtual switch. Have your first condition turn on the virtual switch in one automation. Then create a second automation which uses that virtual switch being turned on as a precondition and your second condition as the second part of the IF, with your fan coming on as the THEN. You should also turn the virtual switch off again in that second automation so it will be ready to use the next time.

  1. first automation: if temperature is above X, turn on the virtual switch.

  2. Second automation: precondition of the virtual switch being on, and if the temperature is below Y, turn on the fan and turn off the virtual switch.

That’s a technique called “daisychaining.“ It should work, it’s just awkward.

Creating a Virtual Switch

If you have an android phone and you are in the US or Korea, then there is a “Smart labs“ feature in the smartthings app which will allow you to create a virtual switch through the app.

https://www.smartthings.com/partners/smartthings-labs

If not, you will have to create one through the IDE, which is the web interface to your smartthings account. That takes a couple of extra steps, but it’s pretty easy.

https://account.smartthings.com

@Automated_House

1 Like

Since I get random internet and power interruptions, multiple automation’s works best for me. Automation’s seem to not always resume or even remember a command is running after the internet or power breaks, leaving the automation running with no time constraint. So I use a ‘safety’ automation to clean up a lingering state. Clunky, yes, but more durable .

So, if working to maintain a minimum critical temperature:
Heat on IF time period AND temp less than or equal to XX;
Heat off IF time period AND temp greater than or equal to XX;
IF end+ 5 min, heat off. (executed after the above automation period ends)

Good luck

1 Like