Securifi water/leak sensor driver?

Hi there!

I've been using for a couple years, flawlessly, the Securifi Water/Leak sensor (see amazon url below). ST would just show it as "thing" at pairing (zigbee) but then It would work great using their generic driver.

However, I can't pair those to my hub, and I have quite several of them! It's really disappointing now that I'm pretty advanced in my migration... Any help?

Best,
Elfege

No luck even after factory resetting them? Securifi devices usually work pretty well but I have noticed they can be a bit finicky about getting reset to pair with a different controller.

Nope... I've been trying since yesterday, to no avail. I'm also surprised that it doesn't even see it; for even without a full compatibility, it should be seen as an object to which I could then manage to patch a driver anyway. You answer is helpfull, though, because I was about to give up and leave leak management to ST, which would be really a bummer since the very reason I wanted to change platform was security reasons since, lately, ST's platform has gone totally nuts on my end, my hub going offline every other hour...

Since they are ZigBee they do not have the removal like Z-Wave devices, so it seems odd to me that they are not being seen. Securifi devices are pretty basic... But unfortunately this is one of the ones I do not have so I cannot give much practical advice. They are all still able to pair with the ST correct? Do you have any other ZigBee device you could try pairing to make sure SOMETHING pairs properly?

Last idea... Reboot the hub. I had a bunch of devices (I think mostly Z-Wave though) week before last that I could not get to pair. Finally rebooted and they all were happily paired after that.

Just noted, indeed, that I couldn't pair another zigbee water sensor of a different brand, Samsung moisture sensor (V4 I think). So I'll give a try at rebooting the hub, we'll see! :slight_smile: Thanks for your help.

No luck... Samsung's moisture sensor will indeed connect after reboot, but none of my Securifi's despite having no issue whatsoever when reconnecting them to ST... This is getting frustrating.

It'd be great if someone from Hubitat could tell me if there's no point in trying further so I'll know what to do from here, or if they should at least be seen.

@elfege: Any luck since? I am working on a combined Securifi sensor driver (v0.4 is posted) but the Water sensor is one I do not have in my selection. Cannot even find any available online either...

The only new idea to give you is about the ZigBee channel being used. There are posts in the forum about Securifi devices basically only working if your hub is set for channel 20.

@snell No, no luck. I have tried one last time yesterday to pair my securifi sensors, no joy so far. but the info you just give me might help! I'm going to set hubitat to channel 20 right now and see how it goes.

For what regard the drivers, I found this:

 //Credit to Serge Sozonoff whom I based this code on.
metadata {
	definition (name: "Securifi Moisture Sensor", namespace: "tchoward", author: "tchoward") {
		capability "Water Sensor"
		capability "Sensor"
        capability "Configuration"

        attribute "tamperSwitch","ENUM",["open","closed"]

        command "enrollResponse"

		fingerprint endpointId: '08', profileId: '0104', inClusters: "0000,0003,0500", outClusters: "0003"
	}

	// simulator metadata
	simulator {
		status "active": "zone report :: type: 19 value: 0031"
		status "inactive": "zone report :: type: 19 value: 0030"
	}

	// UI tile definitions
	tiles {
    	tiles(scale: 2) {
			multiAttributeTile(name:"moisture", type: "generic", width: 6, height: 4){
				tileAttribute ("device.moisture", key: "PRIMARY_CONTROL") {
					attributeState "dry", label: "Dry", icon:"st.alarm.water.dry", backgroundColor:"#ffffff"
					attributeState "flood", label: "Wet", icon:"st.alarm.water.wet", backgroundColor:"#53a7c0"
				}
			}
        }

        standardTile("tamperSwitch", "device.tamperSwitch", width: 2, height: 2) {
			state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
			state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
		}        
		main (["moisture"])
		details(["moisture","tamperSwitch"])
	}
}
> >
def configure() {
	log.debug("** PIR02 ** configure called for device with network ID ${device.deviceNetworkId}")
> >
	String zigbeeId = swapEndianHex(device.hub.zigbeeId)
	log.debug "Configuring Reporting, IAS CIE, and Bindings."
	def configCmds = [
    	"zcl global write 0x500 0x10 0xf0 {${zigbeeId}}", "delay 200",
		"send 0x${device.deviceNetworkId} 1 1", "delay 1500",

        "zcl global send-me-a-report 1 0x20 0x20 0x3600 0x3600 {01}", "delay 200",
        "send 0x${device.deviceNetworkId} 1 1", "delay 1500",

		"zdo bind 0x${device.deviceNetworkId} 1 1 0x001 {${device.zigbeeId}} {}", "delay 1500",

        "raw 0x500 {01 23 00 00 00}", "delay 200",
        "send 0x${device.deviceNetworkId} 1 1", "delay 1500",
	]
    return configCmds // send refresh cmds as part of config
}
def enrollResponse() {
	log.debug "Sending enroll response"
    [	

	"raw 0x500 {01 23 00 00 00}", "delay 200",
    "send 0x${device.deviceNetworkId} 1 1"

    ]
}

// Parse incoming device messages to generate events
def parse(String description) {
	log.debug("** PIR02 parse received ** ${description}")
    def result = []        
	Map map = [:]

    if (description?.startsWith('zone status')) {
	    map = parseIasMessage(description)
    }

	log.debug "Parse returned $map"
    map.each { k, v ->
    	log.debug("sending event ${v}")
        sendEvent(v)
    }

//	def result = map ? createEvent(map) : null

    if (description?.startsWith('enroll request')) {
    	List cmds = enrollResponse()
        log.debug "enroll response: ${cmds}"
        result = cmds?.collect { new physicalgraph.device.HubAction(it) }
    }
    return result
}

private Map parseIasMessage(String description) {
    List parsedMsg = description.split(' ')
    String msgCode = parsedMsg[2]

    Map resultMap = [:]
    switch(msgCode) {
        case '0x0038': // Dry
            log.debug 'Detected Dry'
            resultMap["moisture"] = [name: "moisture", value: "dry"]
            resultMap["tamperSwitch"] = getContactResult("closed")            
            break

        case '0x0039': // Wet
            log.debug 'Detected Moisture'
            resultMap["moisture"] = [name: "moisture", value: "flood"]
            resultMap["tamperSwitch"] = getContactResult("closed")            
            break

        case '0x0032': // Tamper Alarm
        	log.debug 'Detected Tamper'
            resultMap["moisture"] = [name: "moisture", value: "active"]
            resultMap["tamperSwitch"] = getContactResult("open")            
            break

        case '0x0034': // Supervision Report
        	log.debug 'No flood with tamper alarm'
            resultMap["moisture"] = [name: "moisture", value: "inactive"]
            resultMap["tamperSwitch"] = getContactResult("open")            
            break

        case '0x0035': // Restore Report
        	log.debug 'Moisture with tamper alarm'
            resultMap["moisture"] = [name: "moisture", value: "active"]
            resultMap["tamperSwitch"] = getContactResult("open") 
            break

        case '0x0036': // Trouble/Failure
        	log.debug 'msgCode 36 not handled yet'
            break
    }
    return resultMap
}

private Map getContactResult(value) {
	log.debug "Tamper Switch Status ${value}"
	def linkText = getLinkText(device)
	def descriptionText = "${linkText} was ${value == 'open' ? 'opened' : 'closed'}"
	return [
		name: 'tamperSwitch',
		value: value,
		descriptionText: descriptionText
	]
}


private hex(value) {
	new BigInteger(Math.round(value).toString()).toString(16)
}

private String swapEndianHex(String hex) {
    reverseArray(hex.decodeHex()).encodeHex()
}

private byte[] reverseArray(byte[] array) {
    int i = 0;
    int j = array.length - 1;
    byte tmp;
    while (j > i) {
        tmp = array[j];
        array[j] = array[i];
        array[i] = tmp;
        j--;
        i++;
    }
    return array
}

However, it seems that the generic driver works better on ST and there's a chance it'll be the same on hubitat if we can pair those. I'll let you know.

I saw that driver before, but since I am making my own I am not worrying about it too much. The problem with making one though is that it is tough to make sure it works properly AND has actual value beyond the generic drivers. I think the current driver does for the devices it supports, but I still want to improve on it.

If you do get it working any chance I could ask you to try out a custom driver and send me the debug logs from it?

I would certainly do that... But, so far, no luck. Channel 20 didn't help. They still pair immediately on ST... I can't help but think it's on Hubitat's end, but they wont answer my requests about this. So for now they stay on my ST hub.

Well, at least they work somewhere. If I manage to get one and get it working, I will let you know.

@elfege:
Maybe this will help:

Posted by @Diogynes

1 Like

It worked! Thanks a lot @snell and @Diogynes. Also had to... turn off my old ST hub because it would pair them automatically, hence the hassle!

1 Like