ZWN-RSM2 Create a new device type

I purchased a ZWN-RSM2 with the hopes on using it in locations that only have 1 hot wire in the ceiling where I’m trying to control fan and light independently. I’m only concerned with on/off on each load as that is the best I’ll get with device types available currently. Without spending over $200 per location. (total of 7 locations)

I have been struggling for a few days looking at code searching, reading learning but I just don’t know how to get started.

I was able to get this device hooked up correctly (I have it in the fan canopy rather than the switch)
I can toggle load 1 via app and via manually trigger at the device, I cannot toggle load 2 via the ST app because there is no device type to handle the request. I can toggle it via the device itself.

I need help on where to start creating a device type to handle that second load. Any input is appreciated.

1 Like

It’s kinda a lengthy thread, but we had some discussion about the AEON power strip here:

It’s a device, like your relay, that has multiple channels (in this case, 4). There’s some examples of device type code in there that you might be able to use.

I was doing a lot of reading today too trying to help you… thinking along the same lines with the code. I also remembered reading the thread chris just posted. You may be able to use that code and just 3/4 will be dead.

Also thought about maybe building an Arduino shield to accomplish this. I have never done it but figured whats wrong with some trial and error. But if the unit can do it, it would save a ton of time and hassle.

AWESOME!

Thats all I needed was a starting point. I read this post a few days ago and tried it. I must have done something wrong because at the time it didn’t work. NOW IT DOES!

I’m going to do some clean up to get rid of all the extra stuff and get polling/tiles to work and I’ll report back.

Good news @tail24 these devices can be used and managed from ST.

@mattjfrank awesome will be ordering tonight!

Let me know how it goes

@mattjfrank

I would recommend doing something similar to what I did as far as creating a binding app to bind the two channels in your device to two virtual on/off button tiles.

The issue I quickly discovered with the device type in the AEON power strip is the attributes were switch1, switch2, etc. But any SmartApp (or dashboard function, for that matter) only looks for devices that have the an attribute for switch. Which means any app I wanted to use with my device would have to be re-written to look for a device with switch1 or switch2.

So I wrote the app AEON Power Strip Binder (in the shared app section) that just looks for a virtual tile to turn on, then it turns on the associate channel on my power strip. Or if it’s turned off it turns off the channel on my strip. Now I just use the virtual tile in any standard SmartApp and it the binder apps flips the appropriate channel on or off for me.

Thanks @chrisb

I’ve chopped the code up and got it working, mostly. My issue now is tile updates and restrictive use of tile depending on the other tile state? Is this all because ST doesn’t understand the switch1 and switch2 ?

Also the refresh and configure button don’t work i’ve tried the ones from the aeon code and normal switch code.

The last thing I should note is that the tiles are correct when I open the app

@tail24 I ordered 2 more code is still buggy but does work. I’ll play with it more once my brain has a chance to relax.

My issue now is tile updates and restrictive use of tile depending on the other tile state? Is this all because ST doesn’t understand the switch1 and switch2 ?

Could be… I never got my tiles to work right on the AEON power strip when I was in the mobile app… it never was a major issue for me because I used the binder app to tie the virtual tiles to the individual channels. I could just uses the virtual tile to turn the channels on and off within the mobile app.

Plus I very, very rarely manually interact with this device. I use it for charging my various devices so I have it all scheduled to turn on/off at different times that I’d have my devices on the chargers.

I’m still trying to figure out how to use the binder app. I re-wrote it for 2 switches and it appears to work on the site but I’m not sure how to get it into the ST app.

I’m pretty sure though that the issue with the tiles not updating is something in the device code not separating out the replied on/off status

You need to publish the app (for yourself). Then you should be able to install it like any other SmartApp. It’ll be in the My Apps section.

Honestly I don’t know how to do that. I’m on Android and I knew how before last week when the app updated but not a clue now.

Huh! Interesting… I haven’t tried to add a SmartApp in the new MobileApp. You’re right… it doesn’t seem extremely straight forward. I think I found it though.

Hit the + at the bottom of the Dashboard.
In the top section where it says “Things”, swipe right to left repeatedly until you get to the end and it should show all of your “My Apps” to scroll through. Tap one to start the install process.

Got it had to log out and back in to get “my apps” to show, found that in another post.

Ok so now thats installed it’s not working like i thought, I’ll play around and post if I still have questions.

Thank

I’m hoping someone can look at this code and tell me what I’m doing wrong. I just can’t seem to get constant actions or tile updates.

I have used

and
http://z-wave.ru/podderzhka/skachat/category/82-tkbhome.html?download=200:tz04-manual

as reference points

EDITED : REMOVED

I edited the post above removing the code. That wasn’t the best working code I’ve got. The one below is. It works, mostly. Problem is when you toggle either switch it changes the tiles for both and sometimes you have to cycle through to be able to properly switch the other switch. When you clean open the app the tile statues are correct though so this should be an easy fix. But I’m striking out.

/**
 *  Enerwave Dual Load ZWN-RSM2
 */
 // for the UI
metadata {
	definition (name: "Enerwave Dual Load ZWN-RSM2", author: "matt") {
		capability "Switch"
		capability "Polling"
		capability "Configuration"
		capability "Refresh"

		attribute "switch1", "string"
		attribute "switch2", "string"


		command "on1"
		command "off1"
		command "on2"
		command "off2"
	}

	simulator {
		// TODO: define status and reply messages here
	}

	tiles {

		standardTile("switch1", "device.switch1",canChangeIcon: true) {
                        state "on", label: "switch1", action: "off1", icon: "st.switches.switch.on", backgroundColor: "#79b821"
                        state "off", label: "switch1", action: "on1", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
                }
        standardTile("switch2", "device.switch2",canChangeIcon: true) {
                        state "on", label: "switch2", action: "off2", icon: "st.switches.switch.on", backgroundColor: "#79b821"
                        state "off", label: "switch2", action: "on2", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
                }
        standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
                        state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
                }

        standardTile("configure", "device.switch", inactiveLabel: false, decoration: "flat") {
        				state "default", label:"", action:"configure", icon:"st.secondary.configure"
                }
                
       
        main(["switch1", "switch2"])
        details(["switch1","switch2","refresh","configure"])
	}
}

// 0x25 0x32 0x27 0x70 0x85 0x72 0x86 0x60 0xEF 0x82

// 0x25: switch binary
// 0x32: meter
// 0x27: switch all
// 0x70: configuration
// 0x85: association
// 0x86: version
// 0x60: multi-channel
// 0xEF: mark
// 0x82: hail

// parse events into attributes
def parse(String description) {
	// log.debug "Parsing desc => '${description}'"

    def result = null
    def cmd = zwave.parse(description, [0x60:3, 0x25:1, 0x70:1, 0x72:1])
    if (cmd) {
        result = createEvent(zwaveEvent(cmd))
    }
    
    return result
}


//Reports

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
        [name: "switch", value: cmd.value ? "on" : "off", type: "physical"]
}

def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
        [name: "switch", value: cmd.value ? "on" : "off", type: "digital"]
}



def zwaveEvent(physicalgraph.zwave.commands.multichannelv3.MultiChannelCmdEncap cmd) {
	// log.debug "MultiChannelCmdEncap $cmd"
    
    def map = [ name: "switch$cmd.sourceEndPoint" ]
    if (cmd.commandClass == 37){
    	if (cmd.parameter == [0]) {
        	map.value = "off"
        }
        if (cmd.parameter == [255]) {
            map.value = "on"
        }
        map
    }

}


// handle commands

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()



    delayBetween(cmds)
}


def poll() {
	delayBetween([
		zwave.switchBinaryV1.switchBinaryGet().format(),
		zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
	])
}

def configure() {
	log.debug "Executing 'configure'"
    delayBetween([
        zwave.configurationV1.configurationSet(parameterNumber:4, configurationValue: [0]).format()				// Report reguarly
    ])
}

def on1() {
	delayBetween([
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:1, parameter:[255]).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:2).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:2, destinationEndPoint:2, commandClass:37, command:2).format(),
	])
}

def off1() {
	delayBetween([
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:1, parameter:[0]).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:2).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:2, destinationEndPoint:2, commandClass:37, command:2).format(),

    ])
}

def on2() {
	delayBetween([
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:2, destinationEndPoint:2, commandClass:37, command:1, parameter:[255]).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:2, destinationEndPoint:2, commandClass:37, command:2).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:2).format()
    ])
}

def off2() {
	delayBetween([
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:2, destinationEndPoint:2, commandClass:37, command:1, parameter:[0]).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:2, destinationEndPoint:2, commandClass:37, command:2).format(),
		zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:2).format()
	])
}
1 Like

@chrisb I was able to get your “app” installed but I was hoping to use it under tiles or under lights & switches to toggle each relay but that doesn’t appear to be the case? it does work great from when simulator

@mattjfrank did you use this code as a device or as a smartapp?

Trying to use your code just not sure where to copy and paste, mine looks a little different than yours as headings.

@tail24 I used the code a couple above this post as a custom device type. I could not get chrisb’s code to work. Be sure the ST app is completely closed and reopened after making changes on the IDE with the device type info.

I was going to post last night to tell you that I used my wife’s phone to switch a light off last night and noticed that her iPhone works exactly as it should, meaning it all updates as it should and is not buggy at all. Even the icons changes work on her iPhone and now that I updated them on her iPhone show correct only my android. So I think the only bug is with the Android and not with the device type.

Lastly, I got info from enerwave on commands etc. So I will be verifying those with what I’m doing to verify no improvements can be made.

Here is the document I received from Enerwave.

Maybe someone can help clean up the code to improve the custom device type.

The device type is working it’s a little buggy on Android and almost perfect on iOS