I’m having the same issue, so obviously it’s a flaw in my code. I’ll be honest and say it will most likely be a while before I get around to fixing it, but anyone wants to take a crack without me have at it
Doh! I signed up just to report this same problem, i was seeing three days ago, also using the latest from the github, didn’t notice someone else posted about it till now lol.
Actually clicking low/mid/high changes the top tile to the correct value. And the changespeed tile to the correct word. But if you refresh by pulling the screen down, or if you exit and come back in, it always goes back to showing HIGH for the current value. Although the changespeed tile is always correct. Its just like the switch value is wrong but not always right away. i can exit and go back in a few times and it will say MED, and then refresh/exit whatever, and it’ll return back to saying HIGH. I’ve looked at the code, but i’m new to groovy and java and just don’t see where your logic might fail. Almost seems like a bug in smartthings app and not your code… just not sure…
Hopefully someone has a fix. I’ve been waiting to fix this before buying all the other GE Fan Switches for around the house.
Found this, and probably the key to our problems.
The following algorithm is used to determine which state to display, when there are multiple states:
- If a state is defined for the attribute’s current value, it will render that.
- If no state exists for the attribute value, it will render a state that has specified defaultState: true. Use this in place of the “default” state name that you may see in some device handlers.
- If no state matches the above rules, it will render the first state declaration.
This is from the documentation. Number 3 is our problem, i don’t think the default value of device.switch is onHigh/onMed/OnLow ect… what is the values this outputs? because it is not one of those, i tried moving around those in the attribute, and it always will go with whatever is the First State declaration. So that means no state matches. I guess we have to redefine those state values.
I’ve fixed alot of the bugs in this and added some features, hope it helps others. Thank You for starting this. Why the heck SmartThings doesn’t already have a decent Fan Controller right now is ridiculous. They are not new devices, and we are on Hub V2 and still nothing. See my new version here. Thanks.
Hello All, so I’ve been a forum follower for a year now, but only just bought/setup a Smartthings Hub and have my first devices. They are just dimmers/switches for LEDs, and one of these fan switches. I’m new: so I’m trying to track all of the above. My coding experience is out of date. What exactly do I need to do to get this special code and switch into my app? I see the code above, figured out how to add custom code. But do I call it a Device Type? And I just copied and pasted the OP’s code in, but there seems to be multiple refinements suggested, yet I have no clue where to put those refinements.
What would help is:
- Do I call this a Device Type
- Can someone share the code w/ the refinements built in so I don’t have to learn the code myself?
- Any other tips on getting this to work on my phone?
Thanks so much for your patience with me!
This is a Device Type
If you click on his Github link in post one I assume this is the most up to date version, It’s dated Sept 5th 2015.
I don’t have any real world experience coding. Everything I know (which isn’t a ton) is self taught. Adding community device types and smart apps is very simple for me.
1.You will need to do this with the developer tools you can find that in the upper right hand corner at community.smartthings.com Edit: This should be done via desktop/laptop not mobile.
2.Click on my device types, Create new from code - copy/paste the code, Save and publish for me.
3.Then go to the my device tab. Click on the fan switch you installed and paired. Click edit. Click type and select the device type you just added. Click update. Changes should push out.
Edit: Also Another better guide than my quick version: FAQ: An Overview of Using Custom Code in SmartThings
Great, thanks. It worked perfectly. Derek
The switch works great John.I wanted to the report the same issue with the high setting being displayed but soooooo much better than the slider. Also thanks to Schapper for the steps to adding it to my hub.
Anytime, glad to help.
I think the new ST app for iOS broke my fan controller. No matter what speed I set it to it changes back to 1%. I used the slider, the high/med/low buttons and I hear the fan speed up then immediately slow down and it shows 1% again. Anybody else experiencing this? Anyone have any ideas?
Mine seems to be working I’m using the chadck zwave smart fan controller
I updated to the newest code but still have an issue. If I select high it stats and within a second it goes to medium then low (33%) then to 1%. This is a bit frustrating as I use this fan every night when we sleep and run it on medium. If I remember correctly support will do noting for me as this is a community custom device type so I cannot really call them. @ChadCK or anyone else have any thoughts?
Edit: I pulled out the tab to the left of the led and it seems to be working properly now. Any ideas why that is?
Thanks for this!! Exactly what i was looking for
Just reading this now. If you mean “tab” by the LED on the actual switch. I would guess this is a “air gap” which is mean to stop electricity going to the “light” or “fan” so you can change a light blub (or what ever) without being harmed. My guess is it was setting it to 1% in an attempt to do just that which is also “low”.
I’m just catching up on really old forums (and I’m glad I did)! @ChadCK this is awesome I’m glad you got everything working on this app, especially that stupid “HIGH” bug.
Why has this not made it to a official device type to be selected during the pairing process? I would love to see this officially supported as well as “Condensed Dimmer w/ Preset” for the GE Dimmers.
I’m not an expert on this stuff. So, if I install a GE ceiling fan switch & this custom device type to my family room ceiling fan (currently just a dumb fan only switch/no lights) I would be able to tell “Echo/Alexa” to turn on or off my fan while I’m vegging on the couch watching tv?
Would it also be possible to have “Alexa” change the speed of the fan?
Side note: “Alexa” after numerous tries could not tell me how to spell “vegging”, but “Siri” got it on the first try. One would think that since I’m an expert at vegging, I would know how to spell it.
Yup and sorta. On/off will work as expected. Changing speed won’t because Alexa doesn’t have context for Low/Med/High. She just sees the fan as a dimmable “light”. What you can do is tell Alexa to set the “dim” level of the fan to a value in the range you want. So “set fan to 20” for low, 50 for med, 80 for high as an example. If you want to use language like low/med/high you’ll need to use virtual switches or some other workaround. Alexa Helper SmartApp would be a good tool for this.
Thank you for this great device handler.
You can say this, “Alexa, set the ceiling fan to 33 percent” This puts it on low.
"Alexa, set the ceiling fan to 66 percent" for medium.
You can also create a virtual momentary button tile for each speed. Then set up a trigger rule for each one.
Ceiling fan low
Ceiling fan medium
Ceiling fan high
You then can say, “Alexa, turn on Ceiling fan low”