Z-Wave Smart Fan Control Custom Device Type

@jpoole412,

I’m still using a version that still combines my original code (per se) and tweaks from this thread. It’s been rock solid for me:

https://raw.githubusercontent.com/constjs/jcdevhandlers/master/devicetypes/jscgs350/my-ge-fan-control-switch.src/my-ge-fan-control-switch.groovy

That looks to be the same code I’m using — I updated my code just in case I was using an older version. I’m still running into the same problem even after removing and re-adding the device multiple times. It seems the currentState never changes from changingState. I’m not sure how to fix this as changing it to a default dimmer switch works fine (although without the very nice Low/Med/High buttons).

Thanks for the earlier reply and help.

Edit: I’ve tried messing around with it a bit more and no matter what I do, I can never get it to change the currentstate. I’m going to assume it is user error as I’m fairly new to this, but any ideas to try would be greatly appreciated.

Edit 2: No idea what I did besides removing/re-adding for the 50th time, but this time it seemed to work.

2 Likes

Glad it’s working for you now, which is good news, but I am curious if you are using the very latest code at the very top of the thread, original post, from github, although it should of worked even in the old code, the newest one fixed a few things and added correct highlighting and changing state colors for the low/med/high that was not in the original code.

Second, if you were still having problems, going into the edit device and adding values for each , making them 33/67/99 might of fixed it, if for some reason your values got set to 0 by accident.

Third, I’ve seen some people had to reset the physical device to get it to work with a new device type, by pulling the air gap out or by killing power to the device ie, power breaker, has been known to fix weird things.

If anybody else has issues, then try the above to resolve.

I did make sure I was using the correct code. I completely deleted the device type and created a new one using the code in the first post.

Using the air gap, I just deleted/re-added the switch to smartthings a handful of times and for some reason the last one seemed to stick.

In the end, I feel pretty confident it is some type of user error as like I said, I’m still fairly new to all this. Thanks for the device however as it works great now and is much easier to use and control than the default dimmer switch device.

Thanks @ChadCK for the contribution to the community! I just used your device type on 5 Leviton Vizia RF + 1.5A Scene Capable Quiet Fan Speed Control. All 5 worked with out any issues and had the same Low/Med thresholds (32 & 66).

I’ve now commented out the parts of your code for the slider control and the setLevel % without any issues. I’ve also commented out the Indicator Light & Refresh tiles. I’m a real newbie to these custom device types, so is there any reason I should leave the indicator light & refresh tiles? I haven’t really ever used these on any of my devices.

Thanks again!

So I’m trying to create virtual fan control using this device type and I’m running into an issue. My use case is I would like to have a Master Fan Control that would control all 5 fans in my house. Utilizing Rule Machine I would control all of the fans based on this virtual fan control. The issue I’m having is once I’ve create a new device using this device type it constantly states that it’s adjusting and never goes On/Off or changes levels. I’ve done something similar using virtual dimmer and Rule Machine with great success. I’ve tried to hack this device type code but I’m a complete newbie to all of this and I’m hoping someone can provide some direction. Thanks in advance for any help.

You’ll need to really edit it down to work as a virtual device and add sendEvent() code to each of the commands (on/off/setLevel). The top part can stay as is, but starting with the parse() section, you can eliminate most if not all the code. Try this below.

Notes:
1 - You can remove refresh() and poll() from both the body and the UI since you can’t really refresh a virutal device. 2 - You can probably remove the indicator status stuff as well unless you were going to use a custom app to relay changes from the virtual device out to the slaves for that.

def parse(String description) {
}

def on() {
	log.info "on"
	sendEvent(name: "switch", value: "on")
    findSpeed(device.currentValue("level"))
}

def off() {
	log.info "off"
	sendEvent(name: "switch", value: "off")
sendEvent(name: "currentState", value: "OFF" as String)
}

def setLevel(value) {
	sendEvent(name: "currentState", value: "changingState" as String, displayed: false)
	def level = Math.min(value as Integer, 99)
	log.trace "setLevel(value): ${level}"
	sendEvent(name: "level", value: level)
    if (level > 0 && device.currentValue("switch") == "off") { 
     sendEvent(name: "switch", value: "on")
findSpeed(device.currentValue("level"))
}
}

    def setLevel(value, duration) {
	sendEvent(name: "currentState", value: "changingState" as String, displayed: false)
	def level = Math.min(value as Integer, 99)
	sendEvent(name: "level", value: level)
}
def findSpeed(value) {
def lowThresholdvalue = (settings.lowThreshold != null && settings.lowThreshold != "") ? settings.lowThreshold.toString() : "33"
def medThresholdvalue = (settings.medThreshold != null && settings.medThreshold != "") ? settings.medThreshold.toString() : "67"
def highThresholdvalue = (settings.highThreshold != null && settings.highThreshold != "") ? settings.highThreshold.toString() : "99"

if (value <= lowThresholdvalue) {
		sendEvent(name: "currentState", value: "LOW" as String)
	}
	if (value >= lowThresholdvalue+1 && item2.value <= medThresholdvalue) {
		sendEvent(name: "currentState", value: "MED" as String)
 	}
	if (value >= medThresholdvalue+1) {
		sendEvent(name: "currentState", value: "HIGH" as String)
	}
}

def lowSpeed() {
	def lowThresholdvalue = (settings.lowThreshold != null && settings.lowThreshold != "") ? settings.lowThreshold.toString() : "33"
	setLevel(lowThresholdvalue)
}

def medSpeed() {
	def medThresholdvalue = (settings.medThreshold != null && settings.medThreshold != "") ? settings.medThreshold.toString()  : "67"
	setLevel(medThresholdvalue)
}

def highSpeed() {
	def highThresholdvalue = (settings.highThreshold != null && settings.highThreshold != "") ? settings.highThreshold.toString() : "99"
	setLevel(highThresholdvalue)
}

def poll() {
}

def refresh() {
}

def indicatorWhenOn() {
	sendEvent(name: "indicatorStatus", value: "when on", display: false)
}

def indicatorWhenOff() {
	sendEvent(name: "indicatorStatus", value: "when off", display: false)
}

def indicatorNever() {
	sendEvent(name: "indicatorStatus", value: "never", display: false)
}

First off, thanks. I switched from the old code to this, and it’s improved nicely.
One issue however, is the never lit indicator seems to act more like when on. Anyone else have this? Could this be code related somehow?

Thanks for the really good direction @Sticks18. I will give this a try today.

It’s most likely the device. A lot of these zwave switches have an issue with the never lit parameter (none of my 7 dimmers, switches, fan controls work). You can try this SmartApp to manage the indicator. It switches the indicator setting when the fan is turned on/off to emulate the never lit option. You’ll need to install a new instance for each fan/switch you want to manage. I use it for two fans since we sometimes sleep with it on and sometimes off.

Thanks, I’ll give this a try. Almost all of my switches work fine, except the two fan controllers. Actually, one of the two might work I’ll have to recheck.

so I am a complete noob at this. Just got my SmartThings Hub today and hooked up the GE Smart Fan Controller. What I was wondering is how do i go about implementing this so my app looks/does what this codes does.

FYI I am using an iOS device for the SmartThings App

well i guess it helps not doing this at 2 in the morning. after some sleep and reading so more on the forums i was able to figure it out

2 Likes

Very nicely done! Big thanks to @johnconstantelo @Sticks18 @ChadCK for a great job. Love the little tweaks to keep it improving

UPDATE: Thermostat control of Ceiling Fan @ChadCK @johnconstantelo
Just wanted to say how much I appreciated all the effort and awesome work on your device handlers! I just uploaded a smartapp that I use with your device handler and it is working really well for automatically controlling the fan low, medium, high speeds based on any temperature input with the option of having motion control.

1 Like

Great thread and work being done here! I bought the GE 12730 Fan Control but want to use it for a different purpose… Specifically I want to use it to control this fan: http://www.amazon.com/GE-12730-Z-Wave-Smart-Control/dp/B00PYMGVVQ

That is a variable speed fan that goes into duct work. According to the manufacturer the fan is “100% speed controllable”. I take this to mean that instead of having a low/medium/high market like typical ceiling fans have, this duct fan can be set to run at speeds on a sliding scale.

Do you think I will be able to use the GE12730 to have this fine level of speed control, where it can be anywhere from say 0-100% speed (or something close to that)? Or do you think the GE 12730 will not send the incremental changes on the slider - but only signal it when it cross thresholds like what it considers slow/med/high speed? In other words - is the reason that the slider only works for three speeds a function of the ceiling fans, or a function of the GE device itself. If this is a limitation of the GE 12730, is there any other z-wave switch out there that will allow me to run my duct fan at a full range of speeds?

If I am stuck with just three speeds low/med/high, then hopefully I can still set the thresholds low? For instance I may need to only run the fan at 10%, 25% or 50% but never close to max speed.

Also on a related note- Will I be able to use Smart Rules or something like it to create commands like:
if motion is detected then
if temperature is < 30 degrees then
tell GE 12730 to run the fan at 10%
else if temperature is >=30 and temperature is < 50 then
tell GE 12730 to run the fan at 20%
etc etc

Thank you!

Hi @HDGuy. No, you won’t be able to that, so I think you’re stuck, and stuck with the defaults for low/med/high. I got the switch when it first came out, and in my testing while writing the first version of the device handler the switch would only change at set thresholds for low, med, and high. Those are set internally at the switch, not via ST.

I’ve tried incrementing the levelset values by 1% from 0 to 100, but the switch would not change until the built in values were met. I did not investigate if there are configuration parameters that could be tweaked to override the defaults (like what can be done for ramp rates for the GE dimmers).

With regards to your rules question, yes - assuming you can find a device that has the range and flexibility of a dimmer switch, but is designed for motor control.

Thanks John! I assume the way the duct fan work is that based on the amount of voltage it gets it ramps from 0 to 100% speed. Further I assume that the GE 12730 puts out a fixed voltage at low, medium and high. So I guess its correct to assume that whatever speed the fan spins at for those three voltages are my only options. Do I understand correctly that’s how it will be? I assume you don’t know of a Z-Wave device that supports variable speed or you would have mentioned it. I’ll try calling GE tomorrow (assuming I can even find the phone number to their Z-Wave controls group) to see if there is any way to override that fixed-preset behavior, but its unlikely.

So assuming there is no workaround for the GE device and no other device that can do it - I’m thinking now about possible work-arounds. This could be VERY cludgy but what do you think about the idea of having a group of these devices: http://amzn.com/B00EVYGPJQ

Say I had 3 of them. Each one would be manually set to give me the desired fan speed for three difference “presets” / scenarios. Then somehow wire these with a Z-Wave relay/switch so that it would give power to only one of the three (z-wave selectable) which would then feed the duct fan. Even tho this limits me to three fixed fan speeds, at least the 3 speeds would be what I wanted (instead of whatever speed those GE presets would run the fan at, the fastest of which I already know will be too fast).

Does that sound like a viable workaround? Any thoughts on what Z-Wave controls I could buy to work do the switching between the three Vantech manual switches and how they could be wired up to all feed the duct fan? Thanks!!

Could you not just use an actual Zwave Dimmer and not the fan control?

GE Z-Wave Smart Dimmer (In-Wall), 12724 https://www.amazon.com/dp/B006LQFHN2/ref=cm_sw_r_cp_awd_KDt2wbB75DHEF

I do not have one myself but I believe that provides the additional stepping you are wanting.

Maybe I’m missing something from what you are asking or someone else can chime in about a normal dimmer.

Chad - I am not sure about this, but someone told me that dimmers may work by regulating the wattage, whereas the fan switch may work by regulating the voltage. And that for some perhaps all variable speed fans, the voltage needs to be regulated not the fan. I am not sure about any of this so don’t go by me, but that was what I heard. If that indeed is the case (anyone know?) then to regular my fan speed I would not be able to use a dimmer.

You should definitely not use a dimmer to regulate most fans.

Here is an excellent write-up done by the very helpful @JDRoberts that will explain why this is such a bad idea:

1 Like