Great work! One little note...all of the native drivers have a function to turn debug logging on or off that automatically turns off after 30 mins. It is strongly recommended that all user drivers feature the same thing. This is to prevent excess logging for devices that are functioning normally as to not tie up hub resources. You have a lot of logging but no disable for that. I would check out any of the drivers from some of the other users on the forum here to see what I mean. And for a VERY little example:
/*
* Http GET Switch
*
* Calls URIs with HTTP GET for switch on or off
*
*/
metadata {
definition(name: "Http GET Auto Off Switch", namespace: "ryancasler", author: "Ryan Casler") {
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 "delay", "integer", title: "Off Delay", required: false
input name: "logEnable", type: "bool", title: "Enable debug logging", defaultValue: true
input name: "autooff", type: "bool", title: "Auto-Off Enabled?", defaultValue: false
}
}
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}"
if (autooff)
runIn(delay, off)
}
} 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}"
}
}
If you turn off detailed logging in the preferences then the logging switches off. It doesn't switch off on a timer though, you have to do it manually.
I'll have a look at tidying it up next week. I also have drivers for the temp humidity and power monitoring sonoff which I'll release next week as well
I find it confusing to know what Tasmota instance to use and which Driver to use. There were posts at the top of the thread saying "relase 6-7-8 etc" and right underneath somebody would be posting a different code for what seemed to me the same thing. Some were for a bunch of devices, some were for specific devices only. I've tried two or three different ones with no luck.
But my biggest issue is actually getting the
Some of the tutorials say to use "add virtural device" to actually add the flashed Sonoff Basic to Hubitat. I can get it to show up on the list but nothing responds. There are a ton of different drivers that people say to use, I've tried three at least.
There is also info asking to use "Sonoff Connect" to "discover your devices" after you've properly setup your Sonoff. I finally found the code for that one and installed it in the "Apps Code" and can't seem any way to actually use it or find a "discover devices button"
My apologies if this post seems like I'm cranky, I just invested way too much time on this and I though I was relatively technically capable before I jumped into the Hubitat thing. Right now it's kicking my ass.