Neo Smart Controller for blinds

We have recently had outdoor motorised blinds installed that use motors by a company called Alpha (here). I bought a wifi controller for them that arrived in the mail a couple of days ago - a Neo Smart Controller (here). I've set it up and it works really well through their native app and our Google Homes. My next step is to add them to HE. The controller uses a really simple API that uses http GET calls with a half dozen commands. I'm really only interested in four commands - open/close/stop/favourite. I found the HE community driver httpGetSwitch and have it successfully opening and closing the blinds but I'm missing the 'close' and 'favourite' commands as that device handler is only two-state. @anon61068208 has been very helpful but I don't want to burden him solely with helping me, so I'm reaching out to the wider community.

I'm a complete noob at building custom device handlers. What's the easiest way to add the two additional commands (stop/favourite) to the two-state driver above?

2 Likes

Like I said -- it needs the setLevel() commands added to support the favourite or percentage open.

Stop should be a simple off() command.

But the 'switch' capability doesn't support the setLevel() command, right? So I need to change/add the 'switchLevel' capability to use it?

Sorry mate. You're talking to a novice, so you might have a level of assumed knowledge that I simply don't possess. Think "Dummies Guide" here. Feel free to state what some might consider rudimentary knowledge. I've spent a fair amount of time scouring these and the ST forums and I've got to say, it's not simple to get started. I'm doing the best I can.

capability ChangeLevel
capability SwitchLevel

And

def setLevel()

has to be coded in.

It's not going to be easy and if I do it - it will be a lot of debugging since I dont have that device.

https://docs.hubitat.com/index.php?title=Driver_Capability_List

Ok thanks. I don't (yet) understand how that'll work but I'll keep searching. Since each of the open/close/stop/favourite commands have their own discrete GET message (the favourite position is defined using the app then you just send the GET call to the controller to send it to the predefined favourite position), I was hoping I could use the doorControl capability (which has open/close commands) and adding the stop/favourite commands. I saw something similar to that in another driver here that added commands for setting colours to the switch capability. I may be completely off-track here.

If its a set url for each favourite setting that will have to be defined as a command then. That relatively easy to add in.

It is. Each blind has a single favourite setting and there's a set URI that sends the blind to whatever that setting is.

1 Like

Then that's pretty easy to add in

Life would be peachy if there was simply a four-state switch. It seems harder than it should be.

drivers are never easy to create or edit... that's why developers like me are around

Here was my first attempt at doing what I said previously.

* Neo Smart Controller
 *
 * Calls URIs with HTTP GET for shade open/close/stop/favourite
 * 
 * Based on the community driver httpGetSwitch
 */
metadata {
    definition(name: "Neo Smart Controller", namespace: "bigrizzo", author: "bigrizz") {
        capability "Actuator"
        capability "doorControl"
        capability "Sensor"
		
		command "stop"
		command "favourite"
    }
}

preferences {
    section("URIs") {
        input "closeURI", "text", title: "Close URI", required: false
        input "openURI", "text", title: "Open URI", required: false
		input "stopURI", "text", title: "Stop URI", required: false
		input "faveURI", "text", title: "Favourite URI", required: false
        input name: "logEnable", type: "bool", title: "Enable debug logging", defaultValue: true
    }
}

def logsOff() {
    log.warn "debug logging disabled..."
    device.updateSetting("logEnable", [value: "false", type: "bool"])
}

def updated() {
    log.info "updated..."
    log.warn "debug logging is: ${logEnable == true}"
    if (logEnable) runIn(1800, logsOff)
}

def parse(String description) {
    if (logEnable) log.debug(description)
}

def close() {
    if (logEnable) log.debug "Sending close GET request to [${settings.closeURI}]"

    try {
        httpGet(settings.closeURI) { resp ->
            if (resp.success) {
                sendEvent(name: "doorControl", value: "close", isStateChange: true)
            }
            if (logEnable)
                if (resp.data) log.debug "${resp.data}"
        }
    } catch (Exception e) {
        log.warn "Call to close failed: ${e.message}"
    }
}

def open() {
    if (logEnable) log.debug "Sending open GET request to [${settings.openURI}]"

    try {
        httpGet(settings.openURI) { resp ->
            if (resp.success) {
                sendEvent(name: "doorControl", value: "open", isStateChange: true)
            }
            if (logEnable)
                if (resp.data) log.debug "${resp.data}"
        }
    } catch (Exception e) {
        log.warn "Call to open failed: ${e.message}"
    }
}

def stop() {
    if (logEnable) log.debug "Sending stop GET request to [${settings.stopURI}]"

    try {
        httpGet(settings.stopURI) { resp ->
            if (resp.success) {
                sendEvent(name: "shade", value: "stop", isStateChange: true)
            }
            if (logEnable)
                if (resp.data) log.debug "${resp.data}"
        }
    } catch (Exception e) {
        log.warn "Call to stop failed: ${e.message}"
    }
}

def favourite() {
    if (logEnable) log.debug "Sending favourite GET request to [${settings.faveURI}]"

    try {
        httpGet(settings.faveURI) { resp ->
            if (resp.success) {
                sendEvent(name: "shade", value: "favourite", isStateChange: true)
            }
            if (logEnable)
                if (resp.data) log.debug "${resp.data}"
        }
    } catch (Exception e) {
        log.warn "Call to favourite failed: ${e.message}"
    }
}
1 Like

Can you edit that post and put the entire code inside the </> format please.

Hope that's better.

Much

For each favourite setting it needs its own command.

EG command "morning"

Then you have to create the def morning() action

Isn't that what I have done? The def favourite() is at the end.

Yes but I was just giving the example for multiple favourite settings.

Does it work ?

Ah ok. Don't know if it works yet. It's been an evolving bit of code as I trawl the forums looking for inspiration. If you think I've got it about right, I'll give it a try tonight and see what happens.

There's only one favourite setting.

give it a go -- make sure you have debugging on and watch the logs in a new tab.