I have several relays that I need to move over from ST. They are using the "Z-Wave Virtual Momentary Contact Switch" DTH currently where they turn on for a few seconds and then turn off. I don't see the equivilent device in Hubitat unless I am missing something. The generic z-wave switch works to turn one of them on and off so I can confirm the relay is paired ok. But I need a device "handler" to turn it on and then off automatically.
How about using Rule Machine to turn it off after a few seconds once it sees it turn it on? Might be a pretty good workaround until a new Driver can be written.
2 Likes
This should work:
/**
* 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.
*
* SmartSense Virtual Momentary Contact Switch
*
* Author: SmartThings
* Date: 2013-03-07
*/
metadata {
definition (name: "Z-Wave Virtual Momentary Contact Switch", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.contact") {
capability "Actuator"
capability "Switch"
capability "Refresh"
capability "Momentary"
capability "Sensor"
capability "Relay Switch"
}
}
def parse(String description) {
def result = null
def cmd = zwave.parse(description, [0x20: 1])
if (cmd) {
result = createEvent(zwaveEvent(cmd))
}
log.debug "Parse returned ${result?.descriptionText}"
return result
}
def zwaveEvent(hubitat.zwave.commands.basicv1.BasicReport cmd) {
[name: "switch", value: cmd.value ? "on" : "off", type: "physical"]
}
def zwaveEvent(hubitat.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
[name: "switch", value: cmd.value ? "on" : "off", type: "digital"]
}
def zwaveEvent(hubitat.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
if (state.manufacturer != cmd.manufacturerName) {
updateDataValue("manufacturer", cmd.manufacturerName)
}
final relays = [
[manufacturerId:0x0113, productTypeId: 0x5246, productId: 0x3133, productName: "Evolve LFM-20"],
[manufacturerId:0x5254, productTypeId: 0x8000, productId: 0x0002, productName: "Remotec ZFM-80"]
]
def productName = null
for (it in relays) {
if (it.manufacturerId == cmd.manufacturerId && it.productTypeId == cmd.productTypeId && it.productId == cmd.productId) {
productName = it.productName
break
}
}
if (productName) {
log.debug "Relay found: $productName"
updateDataValue("productName", productName)
}
[name: "manufacturer", value: cmd.manufacturerName]
}
def zwaveEvent(hubitat.zwave.Command cmd) {
// Handles all Z-Wave commands we aren't interested in
[:]
}
def push() {
def cmds = [
zwave.basicV1.basicSet(value: 0xFF).format(),
zwave.switchBinaryV1.switchBinaryGet().format(),
"delay 3000",
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
]
}
def on() {
push()
}
def off() {
[
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
]
}
def refresh() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
])
}
3 Likes
Thanks. Seems to be working, but odd event logging. Its a Remotec ZFM-80 relay. I am still trying to figure out how to exclude a Qubino Flush relay and will try again with that one too.
I didn’t touch how the driver works or logs. Not surprised at oddness.
I have a driver specific to the remotec80, I’ll see If I can get that into the next release.
2 Likes
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.