Monoprice Dual Relay On/Off Device type 11990

anyone getting the below Java error? I am seeing this within the log files of the relay device. But there is no line 157 in your device.

java.lang.NullPointerException: Cannot invoke method leftShift() on null object @ line 157

Yes, I have many of these errors in my logs

Well, in the device type, I commented out the refresh def content and now it works without the Java errors. oddly, it still updates just fine. Something is broken in that def, but I havent had time to debug.

You will have to delete any virtual button bindings and redo them.

def refresh() {

//for ( i in 1..3 )
//cmds << zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:i, commandClass:37, command:2).format()
//cmds << zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:2, destinationEndPoint:i, commandClass:37, command:2).format()


Thanks I am in the process of doing a top down re-write or at least audit of all of the code as a learning experience I will look at this closely!

A refresh method that would get the job done and not throw errors could be:

def refresh() {
def cmds = []
for ( i in 1…3 ){
cmds << zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:i, commandClass:37, command:2).format()

I don’t have this relay, so I can’t tell for certain, but I don’t see how it is showing status updates when the physical switch is toggled. My friend has this switch and I was looking at his logs today. It is very similar to the Philio PAN04 in that when the physical switch is flipped, the relay sends a SwitchBinaryReport event. This event does not specify which physical switch is flipped. My device type for the Philio, when it receives a SwitchBinaryReport, requests for the switch to send it an updated status using the COMMAND_CLASS_MULTI_CHANNEL_V3 command class.

The original SmartApp for the Enerwave would fix this problem by requesting a refresh every minute or so to update the status of both switches. That is why @CDJ is seeing all those null object errors in his logs. The SmartApp is requesting a refresh from your device type about every minute, and then the system is throwing that error.

I had my friend try my Philio device type with his Monoprice dual relay and it works well. Status updates and all. Looking at the log, it looks like the devices act the same except the Philio supports energy reporting.

If anyone wants to try my Philio device type out, below is the link. Also, one advantage of my device type is the SmartApp no longer needs to trigger a refresh of the switch every minute. I’ve included a link for that as well.

Eric, This worked PERFECTLY for me. Thank you! I have the Vision ZL7432US Dual Relays in several places throughout the house and now everything syncs between the manual switch and virtual switches. Thanks again!

That is great to hear! I wasn’t aware of the Vision switch but I just looked at its manual and it states:

For Wall SW1, ZL 7432 will report the status of On/OFF after doing “Association”. However, Wall SW2 will only report the status if Z-Wave™ Interface Controller support Multi Channel command, and send Get Command to ask ZL 7432 Wall SW 2 to report the status

This is exactly what I discovered with the Philio so it makes sense that the Vision would work too. Seems like this may be a trait of most of the dual relays out there as the Philio, Monoprice, and Vision seem to work the same. I’d like to know if the Enerwave works with my device type. I might modify it to be a generic Dual Relay device type if it does.

I am still new to this so bare with me. I got everything setup using this code, but a problem that I ran into is when I use the smartapp smartlights it does not turn on the lights when a sensor is triggered. What I am I missing? Thanks

Got any screenshots of the device UI in ST? I’m thinking about picking some of these up and it would be helpful to see the UI.

Here is a screenshot with the Philio. It supports energy usage information.

1 Like

@erocm1231 I’m going to try this setup out with the Monoprice dual relay module. Quick question, with your smartapp, do I need to create some virtual switches in the IDE to associate with the “First Switch” and “Second Switch”?

Yep, if you want to use both switches in other SmartApps, Routines, etc. you have to create the two virtual devices and associate them to the physical switches in the SmartApp. Maybe someday SmartThings will support multi-switch switches, but until then we have to use this workaround.

I used the “On/Off Button Tile” device type for the virtual switches.

Cool. I used “Simulated Switch” for mine, and it’s working perfectly.

What are your thoughts on a Monoprice 11990 specific device type? The Philio PAN04 has a lot of features that the Monoprice doesn’t. I’d love to clean up the UI and get rid of everything except for the Switch 1, Switch 2, and Refresh tiles.

I’ve been itching to start writing some code for ST, so I’d be more than happy to maintain that if that’s okay with you. You’ve put in the bulk of the work, I’d be sure to accredit you.

I was going to try and make a generic dual relay device type that has different tiles based on the device that is detected but it might be a week or so before I can get to it. You are more than welcome to create a separate device type if you would like though. Cleaning up the interface for the Monoprice would be simple change to one line of code. If you want to get your feet wet in SmartThings device type code, take a shot at it. :smile:

Let me know if you have any questions!

I’ve got it published, just need to do some testing to make sure I didn’t break anything in the process. If you’re curious, here’s where it’s at:

Quick question about the dual-relay-adapter smartapp: I think the ST-supported “Multi-Channel Control” SmartApp (under “More”) will do just what your code does, but it won’t allow me to select the Monoprice. I can’t seem to find the source code to this smartapp to find out what capabilities it’s looking for. Do you happen to know where the source is? Does the Philio show up as a choosable option?

Thanks again!

1 Like

I can’t find the source for it either. It seems the app is looking for capability “Zw Multichannel”. I added that to my device type and it lets me choose my switch. I don’t see what it does beyond letting me choose my multi-channel switch though. Perhaps it got published before it should of, because the “Zw Multichannel” capability really isn’t documented anywhere (that I could find).

Your device type looks good. I would have just changed the “details” line and left it at that, but you did a good job cleaning things up. :smile:

Oh, one thing that you will probably want to update with your device handler is the fingerprint. This will make it so that if you add another Monoprice Relay onto your network it will automatically assign the correct device type. Here are some instructions for that:

Nice catch, I’ve updated the code. Thanks!

I created my own version of the same that seems to work completely for me. It also has the added benefit of only requiring one virtual switch. I have the dual relay setup to switch the first output and you only have to add the binder and 2nd virtual switch for the secondary function.


Smart App Binder: