GE Ceiling Fan Switch Custom Device Type - Low, Med, High buttons w/no slider!

Try this, if you’re using askAlexa…

Continuing the discussion from Z-Wave Smart Fan Control Custom Device Type:

Continuing the discussion from [RELEASE] Ask Alexa:

You could also do it with ifttt and a virtual switch. Alexa trigger living room fan low

@johnconstantelo I’m using your DTH (Thanks!) and have one small anomaly. I suspect it’s a limitation of the hardware, but wanted to see if you could do anything. I’m checking the isPhysical state, particularly whether it has been pressed off.

If the switch is on, it reports a physical switch off. Good.

But, if it’s already off, it does not report the physical press off. I’m trying to use this to override other actions, so it’s useful to press off an already off switch. Any chance your DTH can see this?

Thanks again.

Hi @CAL7, I just tested both physical and through the app. All scenarios worked as expected. I was actually surprised how quick the app updated after I physically turned off or on the fan.

@johnconstantelo Thanks for looking at that so promptly. I’m still figuring out the nuances of ST, so I had not checked the device log; but now I see the same thing you pointed out.

The logs show that, even when already OFF, a physical press sends an OFF. So, I suppose I need to look elsewhere for a solution. You referenced “through the app” - is this the device handler status page or can you refer me to a SmartApp that you know responds to the physical press?

I’m stymied because the only apps I know of, and have tested, that differentiate between digital and physical OFF are Rule Machine and CoRE. My test case using both of those apps does not give me a response to the OFF if the switch is already off (they do if the switch is on and the physical press changes the state to off).

I would appreciate any help you can give to point my way to the next step of debugging. Tagging @ady624 in case he knows any reason that CoRE would purposefully ignore an OFF if already in an off state.

I meant the phone app, sorry about that. The device updated in the phone app within a few seconds of physically using it.

I was able to test, and you’ll see in the screen shot below that the first entry is another physical event turning off the switch (@5:55pm) which was already off (@5:53pm):

Every time I press off on the device I get a log entry like the first one.

What I see in the log agrees with your test (Thanks for that, BTW). But my two test programs, with either RM or CoRE, never report the physical OFF press if the condition was already off.

(Contributing to the flakiness is that rarely, but every once in a while, a digital OFF will be interpreted as a physical OFF.)

Do you know of a SmartApp that can differentiate between digital and physical state change?

Thanks for the DTH, @johnconstantelo ! I too had to make the same changes as @rey_rios to get the speed to display correctly.

No worries. I’m actually still using my original code with just a couple changes from others (display the transition of states, ie “turning off”), and not the one people have been tweaking above. I don’t need to adjust any parameters for low/med/high because all my fans are the same and what I hard coded for those values work perfectly fine.

@johnconstantelo Hi, again. I spent some more time (ref: Post #127-129) trying to diagnose my attempts to determine the physical switch press.

My issue is that if the switch is OFF, the physical press OFF does not get reported by CoRE. If the switch is ON, the physical press OFF does report. I set up a simple piston to look just for the physical press.

So, I went to the logs. Here I see that when it starts OFF, each switch off press gets one log entry. But, CoRE does not see it.

However, it is different if I physically turn on the switch (I don’t believe it matters if it’s turned on programatically or physically) before pressing the OFF. With it on, the single OFF press gives two log entries:

It would seem that the PHYSICAL press indicator only registers if it is also a change-of-state. As you pointed out in #128, each press is logged; but there is something different depending on whether it is a state change and that difference hides it from CoRE.

Is it possible for the DTH to send the notification of the switch press, whether previously on or off?

Also, tagging @ady624 to see if there is a CoRE solution.

Thank you.

You need to manually specify isStateChange: true in the sendEvent if you want each to register into CoRE or any other subscribed app for that matter. Otherwise, isStateChange is set automatically by ST and I believe that if new state and old state match, it is set to false. CoRE also has code to prevent duplicate messages, but it would warn you in the logs if it filters out an event. Events are not filtered if data exists in the event object (think buttons with their buttonNumber data element) or if the event value is a number (temperature, power, etc)

1 Like

@ady624 The DTH was modified by @johnconstantelo to add isStateChange:true, but CoRE doesn’t see the physical switch event if the starting state was OFF. CoRE does report it if it was ON.

If you’re willing to look into it any further, I’d be happy to send you logs or whatever would be helpful.

OTH, if this is too much of a niche problem, I’ll leave it alone. Thanks for your earlier comments - they were very helpful.

1 Like

Sorry I couldn’t help too much @CAL7.

For other community members still using my DH, the code for my original DH was based off of ST’s dimmer DH, and that has changed since then. I did create a new DH using ST’s latest dimmer switch DH:

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

I might have been seeing something similar. Just not smart enough to know. At night I am using CoRe to set my fan speed to low at 2am. Usually it’s on med or high when we crawl in bed. Gets cool later so switch to low when we’re asleep.
Anyway I had trouble setting speed using a level. I ended up using the "triangle"loW command available in CoRe. This works every time. Buuuut smartthings and smartiles still show the fan in whatever previous state was.
Weird but I didn’t care was just a visual thing.

I’ll look into it tomorrow. Splitting head ache right now ;(

Can you post the latest code please?

The code @CAL7 is using is here:

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

He’s trying to capture the same type of events that Double Tap does, which works great with switches, but I could not get Double Tap to work with dimmer switches, even using ST’s stock code.

Hope your head ache gets better. I know those are no fun.

And none provide the physical for off>on transition only? But provide it for off>on?

They provide the transition for off-on on-off, but it’s off-off, or on-on like double tap, or just pressing off when already off regardless of when off was pressed last.

Wait, @CAL7 mentions physical which is an attribute of events. CoRE may be filtering out duplicate events - would you please check the trace logs and the debug logs for any warning signs? Something like duplicate event…

I would imagine it could be a duplicate event, perhaps regardless of how far apart the even takes place? What you see below are 2 OFF presses in close succession, and then another OFF 6 minutes later. This came from the DH @CAL7 is using. How would CoRE handle this scenario?