Support for Modern Forms Ceiling Fan Control

Hey Folks - new here. This is the last device I have and it's driving me nuts. I'm using the V2 device handler. I have the correct IP for the fan itself but I still can't control it. Here's the error I'm getting in the logs. Do you folks have any ideas?

dev:442021-03-13 08:10:21.827 pm errorgroovy.lang.MissingMethodException: No signature of method: user_driver_gjunky_Modern_Form_Fan_410.checkHttpResponse() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, groovyx.net.http.HttpResponseDecorator) values: [error in lightBrightness, groovyx.net.http.HttpResponseDecorator@1570a76] on line 72 (setLevel)

dev:442021-03-13 08:10:21.792 pm errorgroovy.lang.MissingMethodException: No signature of method: user_driver_gjunky_Modern_Form_Fan_410.checkHttpResponse() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, groovyx.net.http.HttpResponseDecorator) values: [error in lightBrightness, groovyx.net.http.HttpResponseDecorator@198cbaf] on line 72 (setLevel)

Hi BPIA,

Sorry, but I don't have access to a V2 device and the API has changed (apparently). @jhaustin was looking at the differences in V2, not sure if he got the fan to work with the driver

If anyone has postman installed and has a V2 device, could you please try the following:
Create a new request
URL = GET http:///mf
in the header section, select "Content-Type" with a value of application/json
in the body put {"queryDynamicShadowData": 1}
And click Send
This should give you the status of the Fan. The V1 version shows this:
(Fan ID Removed)

{
"clientId": "MF_C###########",
"lightOn": false,
"fanOn": true,
"lightBrightness": 12,
"fanSpeed": 3,
"fanDirection": "forward",
"rfPairModeActive": false,
"resetRfPairList": false,
"factoryReset": false,
"awayModeEnabled": false,
"fanSleepTimer": 0,
"lightSleepTimer": 0,
"decommission": false,
"schedule": "",
"adaptiveLearning": false
}
It will be pretty easy to try command to the fan from here:
for instance, changing the body to:
{"fanSpeed": 4}, you guessed it, changes the fan speed

Here's what I get on V2:

{
"clientId": "<removed by me>",
"cloudPort": 8883,
"lightOn": true,
"fanOn": false,
"lightBrightness": 1,
"fanSpeed": 1,
"fanDirection": "reverse",
"wind": false,
"windSpeed": 2,
"rfPairModeActive": false,
"resetRfPairList": false,
"factoryReset": false,
"awayModeEnabled": false,
"fanTimer": 0,
"lightTimer": 0,
"decommission": false,
"schedule": "",
"adaptiveLearning": true,
"userData": "local_wifi"
}

And yes, sending {"fanSpeed": 4} changes the fan speed.

1 Like

Thank you!
So does the V2 driver work for you? Do you have any idea what windSpeed if? Does it show in the Modern Forms App?

I need to find a way for the device to retain the state or some way to run the Status command otherwise nothing is shown in the Rule Machine (as mentioned) and it can't be used.

windSpeed is the fan level, and it does show in the Modern Forms App. I believe it has 5 or 6 steps.

I had already modified the 1.0x code, so I never installed the 2.x driver per se; I'd stripped out SwitchLevel, FanOn, FanOff, LightOn, and LightOff, and added a simple On and Off call — there didn't seem to be a way to use capability FanControl to both turn the fan on and off as well as set its speed. If you add this functionality in, I'd use it — because I would definitely use automations for setting the speed as well as on/off. Other than that 2.00 looks fine re: the quoting; I can test if you need me to, but there's no net new functionality for me.

Thanks for keeping active on it,
Jeremy

For the record, I'd simply renamed FanOn and FanOff:
`def On() {
if (logEnable) log.debug "Sending Fan On Command "
sendCommand("fanOn", true)
}

def Off() {
if (logEnable) log.debug "Sending Fan Off Command "
sendCommand("fanOn", false)
}`

@jhaustin Thank you again. I used the fanOn/Off and lightOn/Off to give you both functions but with the separate drivers, they can just be on/off as you have it.
It would be easy enough to add on/off in the list of speeds but that was the implementation of the FanControl capability. I am thinking about implementing everything as a dimmer control and divide the dim level by 6 (since my fan has 6 speeds). It would then have a simple on/off and would just be a driver for the fan. The light can have its own dimmer. I am hoping this will make it compatible with Google Home.

why have fanSpeed and windSpeed?

Still need to have a way to retrieve the current values to make automation work

Jeremy, any chance you mind sharing your modified code? I’d love to test it on my fans if you don’t care to share!

Based on everyone's great work, I built a brand new Modern Forms Fan and Light device driver and uploaded it to Github under the Apache open-source license:

Compared to @1info's driver, this driver:

  1. Automatically creates a child Dimmer device for the light (to support separate on/off controls for the light and the fan — this greatly simplifies dashboards and smart home integrations like Google Home that don't support combined fan and light devices)
  2. Properly supports setting the level attribute of the fan, so dashboards know how fast the fan is spinning
  3. Polls the state of the device every 30 seconds to pick up any changes performed via physical controls (these were never seen by the old driver until some action was performed in the app)
  4. Supports cycling the fan speed
  5. Removes the unused auto fan speed

I'd love any and all feedback. I tested this with my device, which I suspect is a "V1" device, so I'd appreciate any feedback for the V2 devices.

I didn't yet add support for the fan or light sleep timer features. Let me know if you find those useful.

Thanks!

2 Likes

My fan has a "breeze" mode which pulsates the speed of the fan to simulate gusting wind. The breeze mode has three levels 1-3 vs. 1-6 for standard mode. I would assume "windSpeed" is the breeze mode setting level.

I've tested the basic fan functionality with V2. (I don't have a light attached to my controller, though the wires are there.)

Fan direction, speed, and on/off all appear to work, as does polling. I'll test this functionality with Alexa and Siri soon.

Should the 'refresh' button force a poll? Polling does happen — when I load the device details (edit device), the state of the fan is correct, but I cannot force a poll by clicking refresh, and the state (as shown in the browser) does not appear to update immediately after a settings change takes effect, nor does it update at 30 second intervals in the browser.

1 Like

Thanks for taking a look!

Hmm, that's interesting. It should both update after any command as well as automatically.

Could you enable debug logs and send me the logs after you see it fail to update, please?

Apologies for not getting to debug logging yet. I'll get there. In the meantime, the 30s poll rate appears to be crashing the fan controller — I have to power it completely down (using the wall breaker!) to reset it. I'll adjust the timer to something more sane (300s?) and see if it recurs.

To be clear, this has once crashed the IP stack (device no longer responds to ping) and once crashed the stack and the wall remote functions as well.

Has there been any progress on this issue? I have a fan I will be installing this weekend and will want to get it working with my smart home too.

Thanks,

Ed

I am running a scheduled reboot of the fan and with that it’s been stable. Kind of a bandaid I know, but at least in my case it was needed as the problem seems to be with the fan’s firmware. It would stop responding to WiFi commands after about a day, with or without this driver polling. Since I set up a reboot schedule I have had no more problems. Though there’s a mismatch on fan modes, mine has six, but the driver as posted only supports five.

Hopefully whatever the issue is will be resolved and I can eventually stop the regular rebooting. But for now, it seems to do the trick, even if it’s a kludge. :grinning:

For more information on rebooting the fan see this thread over on the Home Assistant forum.

Thanks, Can you tell me how to apply this reboot within Hubitat? I am new to the system and have not created any programs, just rules and copy paste of device drivers, etc. Thanks.

Ed

Unfortunately I am also running Home Assistant and implemented the rest call there since it was a quick configuration change. I am not aware of something similar in Hubitat. The only way I know of is to write a custom app or driver that makes the HTTP Rest call.

Maybe one of the two driver authors on this thread can add a custom command to their driver to make the reboot rest call? Then you would be able to schedule the reboot in Rule Machine.

While I have created a handful of custom apps for myself, none of the have made restful calls, so don’t have any example code I could share on how to modify the existing drivers without digging into the code and figuring out how to add the additional command. Hopefully someone else on this thread who has more experience there can chime in.

If you can tell me what the reboot command is, i can add it as a command to the driver. That wouldn't schedule it but would allow you to the x cute the command from hubitat