[RELEASE] Fibaro FGBS-001 Universal Binary Sensor (UBS)

Hello all, i found a workaround to make Fibaro Universali Binary Sensor work again (just the contacts, not temperature)

  1. Insert this code at the end of Device Handler made by cjcharles
  2. Set Parameter 14 to value 1
  3. Press Send Config in the IDE of Fibaro UBS
  4. Enjoy

NOTE: when Smartthings will fix the multichannel bug just set Parameter 14 to 0

//NEED TO SET PARAMETER 14 (SCENES) TO VALUE 1 IN ORDER TO WORK PROPERLY
def zwaveEvent(physicalgraph.zwave.commands.sceneactivationv1.SceneActivationSet cmd) {
	def value = cmd.sceneId
    def result	
    def ep
    def currentstate
    def motionstate
    
    if (value == 10)
    {
    	ep="1"
       	currentstate = "open"
        motionstate = "inactive"       
    }
    else if (value == 11)
    {
    	ep="1"
       	currentstate = "closed"
        motionstate = "active"     
    }
    else if (value == 20)
    {
    	ep="2"
       	currentstate = "open"
        motionstate = "inactive"       
    }
    else if (value == 21)
    {
    	ep="2"
       	currentstate = "closed"
        motionstate = "active"     
    }	
    
    log.debug "Scene report: ${ep} is ${currentstate}"

    //First update tile on this device
    sendEvent(name: "contact${ep}", value: currentstate, descriptionText: "$device.displayName - ep${ep} is ${currentstate}")
	//If not null then we have found either ep1 or ep2, hence try to send to the child device aswell
    try {
        def childDevice = getChildDevices()?.find { it.deviceNetworkId == "${device.deviceNetworkId}-ep${ep}"}
        if (childDevice)
        	if(childDevice.currentValue("contact") != currentstate || childDevice.currentValue("motion") != motionstate)
            {
            	childDevice.sendEvent(name: "motion", value: motionstate)
            	childDevice.sendEvent(name: "contact", value: currentstate)
                log.debug "Updating state ${childDevice} to ${currentstate}/${motionstate}"
            }
    } catch (e) {
        log.error "Couldn't find child device, probably doesn't exist...? Error: ${e}"
    }    
	return result 	
}
2 Likes