Ceiling Fan Control Compatibility

Hi All :slight_smile: I am planning to wire up qubino flush dimmer 0-10v to my ceiling fan (not purchased yet)
But am unsure which ceiling fan would go well with the qubino flush dimmer.
I have consulted the tech support of the ceiling fan company but they are unsure as well.
Qubino support team hasn’t got back to me for over a week.

Was wondering if you guys can help to provide some insights on which ceiling fans I could purchase from this list here?
https://www.kdk.com.my/products/ceiling-fans/remote-control-type/

Compatible being not burning out the fan motor or module. Thank you!

Dimmer is not suitable for ceiling fan and may damage either the fan or the dimmer. Search the forum, many similar thread

Hi CSC! I have looked around, but am unable to find any wall switches that works for ceiling fan (UK frequency).
Do you happen to know any? Appreciate if you could advise :slight_smile:

There’re 2 ways that I figure out recently, the control will not be the switch but either via IR or RF.

For fan that control via IR, you can use zmote.

For fan that control via RF, I’m using Sonoff RF flashed with Espurna, then control them using http parameter. I’ll be posting the guide in next couple of day.

Hey CSC, thank you for sharing… Looking forward to your guide!

I found this project online, they manage to hook up their ceiling fan to a dimmer.
Not sure if this is safe - https://h4sh.automate.asia/blogs/guides-and-reviews/controlling-fan-speed-with-aeotec-nano-dimmer

We kept our fingers crossed during the test as the last time we tested Qubino Dimmer (which claimed that it works with fan), the Qubino Dimmer blew. This time it was a success with the Nano Dimmer. Here’s the video of the fan speed control via Amazon Echo.

The Qubino blew as per the article, and I’m not sure if it’s safe to use nano dimmer

FYI Aeotec advertise their nano as suitable for fans <100W

HI CSC, did you ever put together a guide for espurna on the sonoff RF? I am looking to do the samething with the Sonof RF bridge to control my pre-lit Christmas tree.

ESPurna on Sonoff RF from the creator of ESPurna :wink:

Thanks I already looked at that. Was hoping someone started the DTH for Espurna stuffs using their REST API already.

I haven’t got round to setting up my RF yet, but I’m using the following DTH for my current 433MHz ESP8266 transmitter, tweaked on the handler from @JZst .

    /**
 *  Generic HTTP Device v1.0.20160402
 *
 *  Source code can be found here: https://github.com/JZ-SmartThings/SmartThings/blob/master/Devices/Generic%20HTTP%20Device/GenericHTTPDevice.groovy
 *
 *  Copyright 2016 JZ
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */

import groovy.json.JsonSlurper

metadata {
    definition (name: "Generic HTTP Device - ESP8266 - 433MHz transmit", author: "jymbob", namespace:"jymbob") {
        capability "Switch"
        attribute "triggerswitch", "string"
        command "DeviceTrigger"
    }


    preferences {
        input("DeviceIP", "string", title:"Device IP Address", description: "Please enter your device's IP Address", required: true, displayDuringSetup: true)
        input("DevicePort", "string", title:"Device Port", description: "Please enter port 80 or your device's Port", required: true, displayDuringSetup: true)
        input("DevicePath", "string", title:"URL Path", description: "Rest of the URL, include forward slash.", displayDuringSetup: true)
        input(name: "DevicePostGet", type: "enum", title: "POST or GET", options: ["POST","GET"], required: true, displayDuringSetup: true)
        input("DeviceBodyText", "string", title:'Body Content', description: 'Type in "GateTrigger=" or "CustomTrigger="', required: true, displayDuringSetup: true)
        input("UseJSON", "bool", title:"Use JSON instead of HTML?", description: "Use JSON instead of HTML?", defaultValue: false, required: false, displayDuringSetup: true)
        section() {
            input("HTTPAuth", "bool", title:"Requires User Auth?", description: "Choose if the HTTP requires basic authentication", defaultValue: false, required: true, displayDuringSetup: true)
            input("HTTPUser", "string", title:"HTTP User", description: "Enter your basic username", required: false, displayDuringSetup: true)
            input("HTTPPassword", "string", title:"HTTP Password", description: "Enter your basic password", required: false, displayDuringSetup: true)
        }
    }

    simulator {
    }

    tiles {
        standardTile("DeviceTrigger", "device.triggerswitch", width: 2, height: 2, canChangeIcon: true, canChangeBackground: true) {
            state "triggeroff", label:'OFF' , action: "on", icon: "st.Appliances.appliances11", backgroundColor:"#ffffff", nextState: "trying"
            state "triggeron", label: 'ON', action: "off", icon: "st.Appliances.appliances11", backgroundColor: "#79b821", nextState: "trying"
            state "trying", label: 'TRYING', action: "", icon: "st.Appliances.appliances11", backgroundColor: "#FFAA33"
        }
        main "DeviceTrigger"
        details(["DeviceTrigger"])
    }
}

def on() {
    log.debug "Triggered on!!!"
    sendEvent(name: "triggerswitch", value: "triggeron", isStateChange: true)
    state.fan = "on";
    runCmd("on")
}
def off() {
    log.debug "Triggered off!!!"
    sendEvent(name: "triggerswitch", value: "triggeroff", isStateChange: true)
    state.fan = "off";
    runCmd("off")
}

def runCmd(String varCommand) {
    def host = DeviceIP
    def hosthex = convertIPtoHex(host).toUpperCase()
    def porthex = convertPortToHex(DevicePort).toUpperCase()
    device.deviceNetworkId = "$hosthex:$porthex"
    def userpassascii = "${HTTPUser}:${HTTPPassword}"
    def userpass = "Basic " + userpassascii.encodeAsBase64().toString()

    log.debug "The device id configured is: $device.deviceNetworkId"

    //def path = DevicePath
    def path = DevicePath + varCommand
    log.debug "path is: $path"
    log.debug "Uses which method: $DevicePostGet"
    def body = ""//varCommand
    log.debug "body is: $body"

    def headers = [:]
    headers.put("HOST", "$host:$DevicePort")
    headers.put("Content-Type", "application/x-www-form-urlencoded")
    if (HTTPAuth) {
        headers.put("Authorization", userpass)
    }
    log.debug "The Header is $headers"
    def method = "GET"
    try {
        if (DevicePostGet.toUpperCase() == "GET") {
            method = "GET"
            }
        }
    catch (Exception e) {
        settings.DevicePostGet = "POST"
        log.debug e
        log.debug "You must not have set the preference for the DevicePOSTGET option"
    }
    log.debug "The method is $method"
    try {
        def hubAction = new physicalgraph.device.HubAction(
            method: method,
            path: path,
            body: body,
            headers: headers
            )
        hubAction.options = [outputMsgToS3:false]
        //log.debug hubAction
        hubAction
    }
    catch (Exception e) {
        log.debug "Hit Exception $e on $hubAction"
    }
}

def parse(String description) {
    //log.debug "Parsing '${description}'"
    def whichTile = ''  
    log.debug "state.switch " + state.fan
    
    if (state.fan == "on") {
        //sendEvent(name: "triggerswitch", value: "triggergon", isStateChange: true)
        whichTile = 'mainon'
    }
    if (state.fan == "off") {
        //sendEvent(name: "triggerswitch", value: "triggergoff", isStateChange: true)
        whichTile = 'mainoff'
    }
    
    //RETURN BUTTONS TO CORRECT STATE
    log.debug 'whichTile: ' + whichTile
    switch (whichTile) {
        case 'mainon':
            def result = createEvent(name: "switch", value: "on", isStateChange: true)
            return result
        case 'mainoff':
            def result = createEvent(name: "switch", value: "off", isStateChange: true)
            return result
        default:
            def result = createEvent(name: "testswitch", value: "default", isStateChange: true)
            //log.debug "testswitch returned ${result?.descriptionText}"
            return result
    }
}

private String convertIPtoHex(ipAddress) {
    String hex = ipAddress.tokenize( '.' ).collect {  String.format( '%02x', it.toInteger() ) }.join()
    //log.debug "IP address entered is $ipAddress and the converted hex code is $hex"
    return hex
}
private String convertPortToHex(port) {
    String hexport = port.toString().format( '%04x', port.toInteger() )
    //log.debug hexport
    return hexport
}
private Integer convertHexToInt(hex) {
    Integer.parseInt(hex,16)
}
private String convertHexToIP(hex) {
    //log.debug("Convert hex to ip: $hex")
    [convertHexToInt(hex[0..1]),convertHexToInt(hex[2..3]),convertHexToInt(hex[4..5]),convertHexToInt(hex[6..7])].join(".")
}
private getHostAddress() {
    def parts = device.deviceNetworkId.split(":")
    //log.debug device.deviceNetworkId
    def ip = convertHexToIP(parts[0])
    def port = convertHexToInt(parts[1])
    return ip + ":" + port
}

You then set up a device like this:

So my code is expecting a GET to 192.168.1.210/sw1/on to switch my first switch on.
And to switch the third switch off, it would be 192.168.1.210/sw3/off

Hope that helps!

1 Like