X-10 Support?

@enishoca

Oh boy, sorry for that delay

Here is the driver code for a HTTP GET "Switch:

/*

  • Http GET Switch
  • Calls URIs with HTTP GET for switch on or off

*/
metadata {
definition(name: "Http GET Switch", namespace: "community", author: "Community") {
capability "Actuator"
capability "Switch"
capability "Sensor"
}
}

preferences {
section("URIs") {
input "onURI", "text", title: "On URI", required: false
input "offURI", "text", title: "Off 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 on() {
if (logEnable) log.debug "Sending on GET request to [${settings.onURI}]"

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

}

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

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

}

Just paste that code into a new "driver" in the drivers tab... If that makes sense.

@enishoca

So you call that driver from a switch... remember I am using HomeGenie as my bridge to the X10 devices. I am sure I am not giving you enough detail here really... so ask questions... and I'll try to remember how I got it working :slight_smile:

1 Like

I know its probably an exercise in futility but I have ported over my node-red /mochad/heyu solution over to hubitat. Mostly because I wanted to learn the environment. I wanted to bypass node red and go directly to mochad, using the telnet interface but in the end the hubitat telnet implmentation is too literal and finicky so had to keep that in. But really like the telnet interface. Its a real improvement over the ST implementation, and feels much more robust.
Again not a whole lot of point in it, but will post it anyway after I clean up the code.

@ochilbrae - did you get it figured out? :slight_smile:

Yes, thank you! Old mini-PC running HG on Win 10; your driver assigned to a virtual switch in HE; and finally realising that I needed to open up a port in the Win10 firewall.

So I now have a hybrid system working, and can concentrate firstly on getting the dashboards and rules set up in HE, and then migrate the circuits from X10 to Z-wave as and when they fail and/or finances allow.

This has been a really useful thread!

EXCELLENT!

FWIW I chose to go with Zigbee... it seems to be a little easier to deal with that Z-Wave base only on the comments I've seen. YMMV :slight_smile:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.