SmartThings Community

[RELEASE] 3 Speed Ceiling Fan Thermostat

thermostat
smartapp_hvac

(Dale C) #1

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


Home Decorators Ceiling Fan/Light Controller MR101Z - First Impressions
Smart Fan Control App
Ceiling Fans & Switches
Thermostat (HVAC) Fan to Control Ceiling Fan
Fan controller: Need help choosing what to get
New to home automation
Control 3-speed Ceiling Fan and Light Kit?
Fan controller suggestion needed
Want to Control Ceiling Fan Speed Based on Temp?
Ceiling Fan Set up
Hampton Bay Zigbee Fan controller
Hampton Bay Zigbee Fan controller
Routine/SmartApp to automatically turn on/off a fan in a kid's room
[BETA v0515] Hampton Bay Zigbee Ceiling Fan/Light Controller
GE Z-Wave Wireless Smart Fan Speed Control, 3-Speed, In-Wall
Ceiling Fan Recommendation (for use with ST)?
Room Fan Control using Temperature?
[DEPRECATED][Alpha] Hampton Bay/Home Decorators Zigbee Ceiling Fan Controller
3 Speed Ceiling Fan Thermostat Motion Issues
Rooms Manager: Smarter Rooms: Personalized home automation with Occupancy
Auto ceiling fan controller?
Z-Wave Smart Fan Control Custom Device Type
Free Icon Design For SmartThings Developers
GE Ceiling Fan Switch Custom Device Type - Low, Med, High buttons w/no slider!
Control 3-speed Ceiling Fan and Light Kit?
Auto ceiling fan controller?
Ceiling fan controller?
Trying my first crack at a SmartApp, 3-Speed Ceiling Fan Thermostat
How to use range option?
Calling all community members: New SmartApp Ideas
Z-Wave Smart Fan Control Custom Device Type
On/Off Fan Based on Temp & Presence?
4 way switch help
Error troubleshooting
Controling ceiling fan and light with one switch?
Ceiling Fan Guru [Beta]
(Saifmaster) #2

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


(Dale C) #3

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:


(Kevin) #4

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)


(Dale C) #5

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.


(Kevin) #6

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) 
    }
}

GE fan controller acting like dimmer
(Dale C) #7

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:


(Saifmaster) #8

Looks like it triggers but turn off right away


(Dale C) #9

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.


(Saifmaster) #10

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.


(Dale C) #11

[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.


(Dale C) #12

@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?


(Kevin) #13

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.


(Dale C) #14

Thanks Kevin!


(Daniel Pena) #15

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.


(Dale C) #16

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.


(Daniel Pena) #17

It’s 1.0.20160515d


(Dale C) #18

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


(Daniel Pena) #19

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.


#20

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?