Z-Wave Smart Fan Control Custom Device Type

I’ve updated the code, and recommend everybody who is using the custom device type to do the same.

Fixed the issue reported that on Android the tile is not highlighted. I found through the documentation that the background color only works if the decoration is not “FLAT”. So ha, it was actually a bug of the IOS to still display the background color in “FLAT” mode. I think that should be one of the UI fixes they bring, you should be able to set background color regardless if using decoration flat or not.

Fixed a bug I noticed that if I manually set the speed to 8% it would say I was running High Speed. Well that turned out to be a integer/string comparison mistake. That’s been fixed, showing correct speed now.

Added additional Tile Highlighting now when you select a Tile, it will turn to the adjusting color and show you what you pushed before it becomes active. Its a nice touch you will notice when you use the device now.

I also cleaned up code, and decided atleast for now to move the logic of low/med/high thresholds into the setLevel command. The low/med/high commands now just simply call on setLevel with either “low”, “med”, “high”. It was in my attempt to get rid of the low/med/high commands all together that lead to it, and although i did not accomplish that yet, or maybe it can not even be done, i like the code cleaned up better this way code wise so its staying like so for now.

I’ve been running it this way for the past week and some and I haven’t had any issues come up yet. I just had not had time to come on here to update the github and thread :smile:

One minor thing still on my list is to figure out what icon and why it chooses that icon to display on the “Recently” Page, mainly why in the world just the “low” setting is highlighted there and not the other 2 speeds.

And just to Note here, I bought 5 more of the GE fan controls all hooked to different fans and the threshold values were the same for all of them. I think its still good to leave the values as user inputs as its possible other models of the fan controls will have different values, i think John had JE’s and mine we GE’s, must of been a slight change in there make. The good thing is the values are not a requirement to use the device type as it will default to the ones I’ve put in if user does not put it in themselves.

None the less, i recommend updating the custom code on your hubs people :smile:

1 Like

I think it’s because the background color for “low” is the default ST color for a switch that is “On”; so it’s treating that state differently. I don’t think we have any control over that.

But its the same setup/color for “med”, and “high” yet those do not get color highlighted in the feed.

Med and High are getting different background colors than Low. Color #79b821 is the ‘On’ green used in all the default devices, but Med is #60931a and High is #486e13. You could test it by changing the medium and high to the #79b821 and see if it makes a difference.

attributeState "HIGH", label:'HIGH', action:"switch.off", icon:"st.Lighting.light24", backgroundColor:"#486e13", nextState: "turningOff"
attributeState "MED", label:'MED', action:"switch.off", icon:"st.Lighting.light24", backgroundColor:"#60931a", nextState: "turningOff"
attributeState "LOW", label:'LOW', action:"switch.off", icon:"st.Lighting.light24", backgroundColor:"#79b821", nextState: "turningOff"

Okay sorry i see what was meant now. The problem is that was just a recent change, they use to all be the #79b821 color, only recently was it changed to match the speed value shade.

Update, just tested, i can change low to any color and that will be the color of the low state in the Feed, but again med/high don’t color highlight at all in the feed. Just weird.

Update: Okay with more troubleshooting, I atleast know the logic it is using, and its a problem with smartthings.

So i have 3 tiles based on the status of “device.currentState”, SmartThings will use the icon coloring and picture of which ever is the first in its list to hit. So i can place Med on top and it will do that one, since i color change low to non-color when its one of the others then it doesn’t highlight med or high. So no fixing that, oh well until they fix the way smarrthings handles it or gives us control to define icon/color to use in feed when sending an event. That’ll be awesome.

1 Like

I have this switch, and device type installed. It seems to be stuck on “Adjusting”. Any thoughts? IOS, btw

Is your switch a switch or a dimmer?

It the GE Fan controller.

More specifically, http://www.amazon.com/gp/product/B00PYMGVVQ?psc=1&redirect=true&ref_=oh_aui_detailpage_o02_s00

This is exactly what I have, i bought 5 of them and all work without issues throughout a 2 story home.

Try going to your switch and holding it down or up to manually adjust speed. Does it reflect in the app? Once it looks like it is, then try using the app again. Are you in range of your hub? Is it hub v2? Can you turn it off and on with the app? Have you rebooted your hub? I also only use IOS.

I ended up disabling the switch (air gap) and removed it from smartthings completely and then reinstalled. It’s working now. Thanks!

Does this custom device overrride switch controls? I’m seeing I make a change with the physical switch; the fan changes; then immediately goes back to the device setting.

I’m trying to figure out why. As next step I will look at IDE logs.

No it does not. If you physically change the speed at the switch, the device type is just showing you status not controlling anything. Control by the app is only a manual process, I.E., you press one of the buttons in the app.

You probably either have to pull the air gap in your device to fix it or shut power off to the switch, kill the breaker. So that all power is drained. The problem sounds to be your switch itself, and resetting should help fix it.

1 Like

I just tried this on my new GE 12730 Smart Fan Control switch and the main tile always stays blue and says ADJUSTING. I can change the fan speeds using the smaller tiles below the main one fine though. The main tile just never wants to turn green and say the fan speed. Any ideas what might be wrong?

I’m having the same problem with it always saying adjusting. Did you manage to fix your problem?


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:


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.


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!