[OBSOLETE] 3 Speed Ceiling Fan Thermostat

This smartapp uses any temperature input to control the High, Medium, Low speeds of a ceiling fan based on your desired room temperature setpoint turning on each speed automatically in 1 degree differential increments (adjustable). For example, if you set your desired room temperature setpoint at 72, the low speed comes on first at 73, the medium speed comes on at 74, the high speed comes on at 75. And vice versa on decreasing temperature until at 72 the ceiling fan turns off.

A notable feature is when low speed is requested high speed is turned on briefly to overcome the startup load then low speed is engaged. This mimics the pull chain switches that most manufacturers use by always starting in high speed.

There is a motion option so that the fan turns off automatic mode when no motion is detected. A thermostat mode option allows the ceiling fan to be controlled automatically by the smartapp or manually using the device handler. Currently this smartapp works specifically with GE 12730 Z-Wave Smart Fan Control or Leviton VRF01-1LX designed specifically for motor control. I use the custom device handler by @ChadCK Z-Wave Smart Fan Control Custom Device Handler

There is an update for a compatible 4-Speed zigbee version of this smartapp for the new [Hampton Bay ZigBee Combo Fan/Light Controller] (Home Decorators Ceiling Fan/Light Controller MR101Z - First Impressions) using this new custom device handler. Click on this link if you are interested in downloading the working beta version of the 4 Speed Ceiling Fan Thermostat - Zigbee.

Shout out to @whoismoses Eric for his contribution making it Parent-Child based smartapp. It will be the start of Version 2.

I modified the existing Virtual Thermostat which can only do on-off to make it work specifically for 3 Speed Ceiling Fan control.

This is the actual Ceiling Fan installation from the discussion on Control 3-speed Ceiling Fan and Light Kit. I use to do this fan control with Rule Machine and although it works adequately it was cumbersome to make a simple room temperature setpoint change due to the number of rules that needed to be modified. Now that Rule Machine is no longer supported I needed to get something to replace it and wanted to make it more user friendly. Edit (CoRE using pistons replaces Rule Machine)

How To Install 3-Speed Ceiling Fan Control smartapp
If you need help installing this custom smartapp @JDRoberts gave some excellent step-by-step instructions here

13 Likes

I have been looking for something like this. Just installed it, will test it and let you know, thank you.

Thanks, I need more testing in real world.

I am working on a little bug right now that I found. In the IDE simulator I get perfect operation but in real life after installing it I am finding that when changing a setpoint I am expecting the fan to turn on but it doesn’t at any speed. But if I configure motion into the app whenever I trigger the motion sensor it does indeed seem to bring the smartapp to life and trigger the correct fan speeds? The code for controlling the fan speed it appears won’t get evaluated unless you configure a motion sensor from the app?

@slagle @krlaframboise is there a someone that take a look at my code to help me figure out why the smartapp appears stopped and won’t execute the lo, med, hi speeds unless I keep walking in front of the motion sensor? Since I grabbed the foundation of this code from Virtual Thermostat I wonder if it does this issue? UPDATED: @Ben The SmartThings Virtual Thermostat has this same behavior where ST waits for the temperature to change to qualify as an event to trigger the control even after I make a setpoint change. So say the room is too warm and I change the setpoint down to cool it off nothing will happen until the room temperature gets even warmer?! I also notice changing “heat” to “cool” has similar issues

Thanks in advance for any help or pointers to getting the code to execute correctly. :slight_smile:

The temperatureHandler method won’t get called unless the temperature actually changes which is why changing the setpoint doesn’t automatically trigger the fan to come on.

Try adding a line like the one below to your updated method:

evaluate(sensor.currentTemperature, setpoint)

Thanks so much for the explanation and help Kevin! So the change you want me to try evaluate(sensor.currentTemperature, setpoint) is to cause the temperatureHandler method to be called up when a setpoint change is made correct? I am just trying to learn so I know the best place to put this line of code.

Based on your code, it looks like when the temperature changes and there’s been recent motion, it calls the evaluate method and passes in the current temperature and the setpoint setting.

The change I recommended bypasses the temperatureHandler method and calls the evaluate method with the current temperature and setpoint setting.

If you want to execute the same code that the temperatureHandler method calls, you should break that code into a separate method.

Example:

def updated() {
    unsubscribe()
    subscribe(sensor, "temperature", temperatureHandler)
    if (motion) {
        subscribe(motion, "motion", motionHandler)
    }
    handleTemperature(sensor.currentTemperature)
}

def temperatureHandler(evt) {
    handleTemperature(evt.doubleValue)
}

def handleTemperature(temp) {
    def isActive = hasBeenRecentMotion()
    if (isActive || emergencySetpoint) {
        evaluate(temp, isActive ? setpoint : emergencySetpoint)
    }
    else {
        fanDimmer.off()
        fanDimmer.setLevel(0) 
    }
}

Kevin, that did it!! Thanks !! :clap:

I am digging into the documentation looking into a better understanding of how you solved the problem so easily. Thank you for teaching me through your patience and helping a first time coder solve the problem. I really appreciate it. :relaxed:

Looks like it triggers but turn off right away

It looks like you have more than my one smartpp or rule fighting for control for the Living Room Fan? To test out my 3-Speed Fan Control (3SFC) smartapp you should temporarily disable or remove all the others trying to control your Living Room Fan. What product exactly are you using for your Living Room Fan and what device handler did you have for it? It looks like you may only have a switch that is on and off not 3-speed?

Here is what 3SFC produces on my mobile app and I had to remove my Rule Machine rules to not conflict. The name of my ceiling fan switch is Ceiling Fan Speed.

I using a Ge zwave fan controller and I’m using the handler that was in the link. It’s 3 speed, I’ve removed smartrules and reinstall the your smart app.

[quote=“saifmaster, post:10, topic:47080”]
I’ve removed smartrules and reinstall the your smart app.
[/quote]Sounds like you have it under control. So SmartRule made it a little confusing for me on the reporting it was giving based on your screen capture. :confused:
FYI: The current version Ver 0.9a should now show up in your SmartApp settings page at the very bottom. Ver 0.9a fixes the little quirk about changing a setpoint and it not immediately affecting the ceiling fan.

@slagle Sorry if you are the wrong person to ask?
I would like to submit this for SmartThings for review. Is there some kind of help or point me in the direction for what I need to do in terms of making code acceptable to ST that would speed things up or what you are looking for before I submit? From what I have been reading on the forums it seems the delay is really long right now for ST review of submitted apps so is it best to just submit and get it in the que? And what if I added some additional functionality at some future date how does that update get reviewed?

I’ve asked the same question in the forum and in the slack channel and never received an answer. I submitted a Device Handler and a SmartApp about a month ago and I haven’t heard anything, but since there are 240+ open pull requests, it’s probably going to be a really long wait.

The documentation has a basic guideline that mentions consistent indenting and commenting the public methods so you should probably make those changes before submitting.

1 Like

Thanks Kevin!

I installed and played with this yesterday, the temperatures rising works good, I really didn’t go through the temp dropping though. Another thing is when I try to add a motion sensor I get this error.

Sorry Daniel. can you let me know what version you loaded? It shows up on the user preferences at the bottom, right above the Assign a name. I made a bunch of little changes to clean it up before submitting it to SmartThings and I must have dinged it. I’m looking for the bug now and it will help speed it up if I know which version you got this error at.

It’s 1.0.20160515d

Thanks. OK, I think I found my typo error that caused your issue. It was like I thought when I was cleaning up the code I neglected a line. The IDE simulator didn’t flag it.

Go back to github link above and get the latest code from today,

Version: 1.0.20160516

Yes this did the trick, thank you. This app makes it much simpler.

Like you I also used Rule Machine to do these rules before, but for my bedroom ceiling fans I rely on presense as a trigger because I don’t want them to shut off at night.

1 Like

I have a couple of questions to see if this may work for me. Hopefully one of you using this app or @dalec will be able to advise me.

I’m using GE 12727 switches which are strictly on/off. What I would like is to turn my fans on when ecobee reported temp gets to 75 or more and mode is home. If temp drops below 75 turn fans off. If mode changes from away to home evaluate temp and turn fans on if 75 or more.

I know this app was created to control speed as well but would the scenario I described above be possible with this app?