Custom DTH for simulated thermostat?


#1

If I’ve posted this in the wrong section please let me know.

I am wondering if there is a way to create a simulated thermostat in ST. I have a simulated temperature sensor that I use to aggregate a bunch of other sensors (and in my case have an “Upstairs temperature” sensor)

Now here’s why I am needing it. I have a HVAC piston that, at night, takes a bunch of variables about occupancy and temperature target, and turns on the AC/Heater to hit set target. My target in this case is 72 degrees for summer. So it’ll run the HVAC to hit 72 degrees in the rooms that are occupied.

Herein lies the problem: My target (72) is a global variable that I set. Now let’s say my wife is cold, she says “hey google turn the temperature up” and google does it. But 10 minutes later my piston comes in and destroys it again. So I would like to have a simulated temperature controller that basically when I set it, that’s the new target.

Basically instead of using a global variable for my temp target, I’d like it to be a number that I can change via google home/alexa.

Does that make sense?


#2

SmartThings already has a “simulated thermostat” you can assign to a virtual device in the IDE. That said, if you wanted to you could also just use a simulated dimmer.


#3

I would use the Simulated Dimmer as @whoismoses suggested.
Log into ST’s IDE and create a new device… (called “My Temp” in the example below)

Then you can say, “Alexa, turn ‘My Temp’ to 75

Alexa will think she is changing the levels (brightness) but you will actually be setting a simulated device to any whole number from 1-100… Which can then be referred to (and acted upon) from any other piston.

The only tweak in webCoRE would be something like:

If My Temp's level changes
Then set variable @targetTemp to My Temp's level

Alternatively, if you have kids in the house, you can prevent extreme numbers this way:

If My Temp's level changes
Then
    If My Temp's level is below 65
    Then set variable @targetTemp to 65
    End If

    If My Temp's level is above 85
    Then set variable @targetTemp to 85
    End If

    If My Temp's level is between 65 - 85
    Then set variable @targetTemp to My Temp's level
    End If
End If

This prevents anyone from turning your house into an “igloo”, and also works as a safety net in case Alexa misunderstands your number.

Also keep in mind some AC units cannot go below 66 or whatever, so you may have to adjust this code accordingly.