Fibaro - Universal Binary Sensor - Does it work with Smart Things

it works :smiley:

With some other fibaro devices that I have 2 outputs, I used a custom device, then a smart app and 2 virtual switches to make it all work.

so far I have

your code for the device.

I have hacked the on/off tile to make it

/**

  • Copyright 2015 SmartThings

  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except

  • in compliance with the License. You may obtain a copy of the License at:

  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed

  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License

  • for the specific language governing permissions and limitations under the License.

  • On/Off Button Tile

  • Author: SmartThings

  • Date: 2013-05-01
    */
    metadata {
    definition (name: “On/Off Sensor Tile”, namespace: “smartthings”, author: “Paul Crookes”) {
    capability "Contact Sensor"
    capability "Switch"
    capability “Sensor”
    }

    // simulator metadata
    simulator {
    }

    // UI tile definitions
    tiles {
    standardTile(“contact”, “device.contact”, 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 "contact"
    details "contact"
    

    }
    }

def parse(String description) {
}

def on() {
sendEvent(name: “switch”, value: “on”)
}

def off() {
sendEvent(name: “switch”, value: “off”)
}

and then the custom app

/**

  • Dual Relay Adapter (i.e. Enerwave ZWN-RSM2 Adapter, Monoprice Dual Relay, Philio PAN04)
  • Copyright 2014 Joel Tamkin
  • 2015-10-29: erocm123 - I removed the scheduled refreshes for my Philio PAN04 as it supports instant
  • status updates with my custom device type
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

*/
definition(
name: “Fibaro Universal Sensor App”,
namespace: “”,
author: “Paul Crookes”,
description: “Associates Dual Relay Switch Modules with one or two standard SmartThings ‘switch’ devices for compatibility with standard control and automation techniques”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
section(“ZWN-RSM2 Module:”) {
input “rsm”, “capability.contactSensor”, title: “Which FUS Module?”, multiple: false, required: true
input “switch1”, “capability.contactSensor”, title: “First Switch?”, multiple: false, required: true
input “switch2”, “capability.contactSensor”, title: “Second Switch?”, multiple: false, required: false
}
}

def installed() {
log.debug “Installed!”
//subscribe(rsm, “switch”, rsmHandler)
subscribe(rsm, “switch1”, rsmHandler)
subscribe(rsm, “switch2”, rsmHandler)
subscribe(switch1, “switch”, switchHandler)
subscribe(switch2, “switch”, switchHandler)

initialize()
}

def updated() {
log.debug "Updated!"
unsubscribe()
subscribe(rsm, “switch”, rsmHandler)
subscribe(rsm, “switch1”, rsmHandler)
subscribe(rsm, “switch2”, rsmHandler)
subscribe(switch1, “switch”, switchHandler)
subscribe(switch2, “switch”, switchHandler)

initialize()
}

def switchHandler(evt) {
//log.debug "switchHandler: ${evt.value}, ${evt.deviceId}, ${evt.source}, ${switch2.id}"
switch (evt.deviceId) {
case switch1.id:
switch (evt.value) {
case ‘open’:
log.debug "switch1 open"
rsm.open1()
break
case ‘closed’:
log.debug "switch1 closed"
rsm.closed1()
break
}
break
case switch2.id:
switch (evt.value) {
case ‘open’:
log.debug "switch2 open"
rsm.open2()
break
case ‘closed’:
log.debug "switch2 closed"
rsm.closed2()
break
}
break

default:
	pass

}
}

def rsmHandler(evt) {
log.debug "$evt.name $evt.value"
if (evt.name == “switch1”) {
switch (evt.value) {
case ‘open’:
Switch1.open()
break
case ‘closed’:
switch1.closed()
break
}
}
else if (evt.name == “switch2”) {
switch (evt.value) {
case ‘open’:
switch2.open()
break
case ‘closed’:
switch2.closed()
break
}
}

}

def rsmRefresh() {
rsm.refresh()
}

def initialize() {
unschedule()
//def exp = “* * * * * ?”
//log.debug “Scheduling RSM refreshes”
//schedule(exp, rsmRefresh)
// TODO: subscribe to attributes, devices, locations, etc.
}

just need to make it all work…

Paul

After 4 hours, of tinkering I am finished for the moment. will have another look in the week. if anyone else want to chime in please feel free.

I know what is needed but my skills let me down :frowning:

we need the device app (done by @Fuzzyligic)

2 virtual devices and an app to link the 2 together,

if I get it going I will update you all.

Paul

1 Like

Hi,
One thing I forgot to mention is that after saving and publishing the code make sure to press the config button to ensure the correct association to group 2 is stablished.
You can also do this by using the simulator, installing the device type in the physical device and then, under Tools, click on the custom button “multiset”
This way the 2 inputs should work ok.

Done it :smiley:

Here is the custom device type, install it then apply to the device and make sure you click configure.

Create 2 simulated contact sensors and then use this app to link the 3 item together:

Paul

cool, well done

i’ve just got another one to actually use as a dual contact sensor…so your device type is handy…the only thing i would change is the smartapp, there is no need IMHO to have two simulated contact sensors. you should only need one i think…unless of course i am mistaken.

I also have the temp sensors to install and get working, but i am still having issues with a PIR sensor which should be a monostable switch not a NC type. but i will breadboard this new one and work on the device type with the PIR before i permanently solder this one as a dual contact switch. with temp sensor

ok i finished the Contact/Motion/Temp universal sensor.

ive posted the link and info here

Hi, I’m new to ST but working my way through some bits and already installed some Fibaro dimmers and inline relays with some device handling i stole from a clever programmer.

Anyhow, I have a visonic powermax pro alarm which has 1 pgm output. I have connected my Fibaro UBS to 12v power to the Visonic, GND to visonic GND and Input1 to visonic PGM output. The Visonic can toggle on/off to the pgm for certain functions. I would like to know when the alarm is on or off which i have set in the Visonic to send to the pgm output (which i believe i have done right) however the UBS Z-wave device multichannel just display ON constantly. Have i wired this wrong or do i need a specific device handler for the UBS to pick up the input signal.

The objective of all of this is to turn on red rgb light strip power socket to remind everyone the alarm is on of a night. As everyone forgets or wakes me up to ask if the alarm is on!

I think if i could get the UBS to know when the alarm is on or off i could then get it to turn on the rob light socket….but i haven’t den got that far.

should i give up know or can someone help me please.

Looking at this link it looks like this can be done. you have wired up “OUT 4” to the IN 1 on the UBS, but this wont work as the Alarm panel outputs 12v on that circuit. I had a similar issue recently using a motion sensor that output 3.3v when active. to do this you need to use a transistor, i used a BC549C transistor,

overview is in this thread

so essentially apply the 12v from Out-4 to the base leg of the transistor and ground of the UBS to the Collector and IN-1 to the Emitter. ensure the SW-2 is set to OFF in your alarm panel dip switch, then you need to make sure that in the configuration block you set Parameter 3 as N.O (1) like below.

zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()

this should mean that the circuit is treated as Normally Open so the Contact Sensor would be Open for Disarmed & closed for Armed when 12v is output to the base leg which will connect the Collector & Emitter.

you will also need to Connect the COM from the Alarm Circuit to the Negative of your UBS circuit

its certainly doable but its not as straight forward as the UBS will not read the 12v output

Wow, super quick reply, thanks.:slightly_smiling:

So the powermax pro already has 1 pgm output built into the board itself, so i’m not using the PGM-5 board you provided in the link. please see manual 3.5.2 for circuit and 4.8.2 for programming the pgm output.

I assume i can do similar to what you explained with the transistor. (i may find i wish to buy the PGM-5 board later to perform additional tasks)

With regards to configuration block i, this is line 79 right of pukkahq which is already as you specified i believe?

If and i mean if i get this to work how would i then get an St device to turn on/off etc depending on the UBS being open/cosed. Sorry for being such a newbie

Thanks for you help

I guess i should use your code as in “Fibaro Universal Sensor with Contact/Motion/Temp Sensors” but do i need all that code? still trying to get to grips with it. trial and error approach…

:blush:

Hopefully someone can help. I’m setting up the sensor, I am a new to ST.
I have followed the instructions as set out by Pukkahq but I dont understand this bit:

How do you link the 3 devices - is it perhaps to do with what you call them?
Appreciate any advice.

Hi Can anyone tell me what code i need to add in to this to get more than one temp sensor value? taken from fuzzyligic’s code. I have tried a few things but still not working i have been able to add extra tile for simulator which shows same temp as main tile. Two instances of temp readings are showing in logs as endpoint 3 and 4.
Any help would be great.

def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv2.SensorMultilevelReport cmd )
{
log.debug "Sensor MultiLevel Report"
def map = [:]
switch (cmd.sensorType) {
case 1:
// temperature
def cmdScale = cmd.scale == 1 ? “F” : "C"
map.value = convertTemperatureIfNeeded(cmd.scaledSensorValue, cmdScale, cmd.precision).toDouble().round(1)
log.debug("tempvalue: " + map.value)
map.unit = getTemperatureScale()
log.debug("tempunit: " + map.unit)
map.name = "temperature"
break;

Hi
I take it you have added the device handler and smartapp?
If so then create them via the web IDE. Devices>New device then drop down box device type select simulated contact sensor and fill in the other field bits. Then go to pukka’s smartapp and add the two virtual sensors, then you should be all good and link up.

Just so that I understand the last bit “add the two virtual sensors” - You mean via the Simulator and select them accordingly there?
Thanks

Is there nobody who can lend a hand on this temp sensor code :wink:

In the smartthings app on your phone or tablet go to market place then select smartapps tab.
1 Bottom of list select my apps.
2 then select fibaro universal sensor app.
3 select your fibaro ubs.
4 select your simulated contact and again for the one below.
5 assign name
6 select modes if you wish or just leave
7 tap done

You should now have in things the simulated contacts working as they are now linked. you will still see the the fibaro ubs in the list of things as a device as well as the 2 x simulated contacts but there is no way to hide it.

1 Like

Many thanks

Looks like I will have to drop the idea of using the Fibaro universal sensor for 2 x contacts and multi temperature sensors, as I don’t know enough to sort code out and have tried to no avail and nobody with the talent has offered up anything. It’s a shame this device is not supported in ST it would have been great! :slightly_frowning_face:

Hi,
I have edited a device handler made by @pukka and @Fuzzyligic.
I have basically mashed together an Aeon Key Fob DH into this so the Binary Sensor simulates 2 buttons on the two inputs. You can use this in CoRE then.
The code may be a little all over the place as I cant write the code but I can read and cobble together snippets! :laughing:
Hope it helps!

/**
 *  Device Type Definition File
 *
 *  Device Type:		Fibaro Universal Sensor - Buttons
 *  File Name:			Fibaro Universal Sensor - Buttons.groovy
 *	Initial Release:	2016-01-17
 *	Author:				Stuart Buchanan
 *  Modified:   Paul Crookes 25-01-2016
 *  Modified:   Miles Frankland 08-01-2017
 *
 *  Copyright 2016 Stuart Buchanan, based on original code by carlos.ir33 with thanks
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 ***************************************************************************************
 */
 
metadata {
	definition (name: "Fibaro Universal Sensor - Buttons", namespace: "", author: "MiloF") {
	capability "Button"
	capability 	"Configuration"
	capability "Sensor"
	command "listCurrentParams"
	
	fingerprint deviceId: "0x2001", inClusters: "0x30 0x60 0x85 0x8E 0x72 0x70 0x86 0x7A 0xEF"
}

simulator {
}

	tiles {
		standardTile("button", "device.button", width: 2, height: 2) {
			state "default", label: "", icon: "st.unknown.zwave.remote-controller", backgroundColor: "#ffffff"
			state "button 1 pushed", label: "pushed #1", icon: "st.unknown.zwave.remote-controller", backgroundColor: "#79b821"
			state "button 2 pushed", label: "pushed #2", icon: "st.unknown.zwave.remote-controller", backgroundColor: "#79b821"
			state "button 1 held", label: "held #1", icon: "st.unknown.zwave.remote-controller", backgroundColor: "#ffa81e"
			state "button 2 held", label: "held #2", icon: "st.unknown.zwave.remote-controller", backgroundColor: "#ffa81e"
		}

standardTile("configure", "device.configure", inactiveLabel: false, decoration: "flat") {
	state "configure", label:'', action:"configuration.configure", icon:"st.secondary.configure"
}

main(["button"])
details(["button","configure"])
}
}

def parse(String description) {
	def result = null
	def cmd = zwave.parse(description, [ 0x60: 3])
	if (cmd) {
		result = zwaveEvent(cmd)
	}
	log.debug "parsed '$description' to result: ${result}"
	result
}

def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv1.ManufacturerSpecificReport cmd) {
	log.debug("ManufacturerSpecificReport ${cmd.inspect()}")
}

def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd) {
	log.debug("ConfigurationReport ${cmd.inspect()}")
}

def buttonEvent(button, held) {
	button = button as Integer
	if (held) {
		createEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true)
	} else {
		createEvent(name: "button", value: "pushed", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
	}
}

def configure() {
	log.debug "configure"
	def cmds = []
	cmds << zwave.multiChannelAssociationV2.multiChannelAssociationSet(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
	cmds << zwave.associationV2.associationSet(groupingIdentifier:3, nodeId:[zwaveHubNodeId]).format()
	cmds << zwave.associationV1.associationRemove(groupingIdentifier:1, nodeId:zwaveHubNodeId).format()
	cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()
	cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 4, size: 1).format()

	delayBetween(cmds, 500)
	}

def zwaveEvent(physicalgraph.zwave.commands.multichannelv3.MultiChannelCmdEncap cmd) {
	log.debug "ZWaveEvent V3 ${cmd.inspect()}"
	def result
	if (cmd.commandClass == 32) {
		if (cmd.parameter == [0]) {
			if (cmd.sourceEndPoint == 1) {
				result = createEvent(name: "button", value: "pushed", data: [buttonNumber: 1], descriptionText: "$device.displayName button 1 was pushed", isStateChange: true)
				log.debug "Button 1 is Pressed"
			}
			else
			if (cmd.sourceEndPoint == 2) {
				result = createEvent(name: "button", value: "pushed", data: [buttonNumber: 2], descriptionText: "$device.displayName button 2 was pushed", isStateChange: true)
				log.debug "Button 2 is Pressed"
			}
		}
	}
	return result
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
	// This will capture any commands not handled by other instances of zwaveEvent
	// and is recommended for development so you can see every command the device sends
	return createEvent(descriptionText: "${device.displayName}: ${cmd}")
}

def listCurrentParams() {
	log.debug "Listing of current parameter settings of ${device.displayName}"
	def cmds = []
	cmds << zwave.multiChannelAssociationV2.multiChannelAssociationGet(groupingIdentifier:2).format()
	cmds << zwave.associationV2.associationGet(groupingIdentifier: 3).format()
	cmds << zwave.associationV1.associationGet(groupingIdentifier: 1).format()
	cmds << zwave.configurationV1.configurationGet(parameterNumber: 3).format()
	cmds << zwave.configurationV1.configurationGet(parameterNumber: 4).format()
	
	delayBetween(cmds, 500)
}

def installed() {
	initialize()
}

def updated() {
	initialize()
}

def initialize() {
	sendEvent(name: "numberOfButtons", value: 2)
}

What does this merging add to the mix? I’m just getting familiar with ST now and trying to learn through a few examples.
Thanks