Trouble passing custom attribute to Rule Machine

I am using a custom driver to trigger outputs on my Elk M1 hardware. This is working just fine. However, I would like to tie this into Rule Machine and understand there is no direct support for this. I have tried many different ways but can't seem to make any progress.

Any advice is appreciated!

Here is the code for the child driver.
Child Driver Elk Outputs

metadata {
	definition (name: "Elk M1 Driver Outputs", namespace: "belk", author: "Mike Magrann") {
		capability "Switch"
	}
}

def on(){
	output = device.deviceNetworkId
	substringCount = output.length()-3
	output = output.substring(substringCount).take(3)
	time = '00000'
	getParent().ControlOutputOn(output, time)
}
def off(){
	output = device.deviceNetworkId
	substringCount = output.length()-3
	output = output.substring(substringCount).take(3)
	getParent().ControlOutputOff(output)
}

And here is the parent code stripped down quite a bit.
Parent Driver Elk M1

metadata {
	definition (name: "Elk M1 Driver", namespace: "belk", author: "Mike Magrann") {
		capability "Actuator"
		capability "Initialize"
		capability "Telnet"
		capability "Thermostat"
		capability "Switch"
        command "ControlOutputOn", ["number","time"]
        command "ControlOutputOff", ["number"]
        command "ControlOutputToggle", ["number"]
	}

def ControlOutputOn(output, time){
 	ifDebug("controlOutputOn()")
    	def cmd = elkCommands["ControlOutputOn"]
	output = output.toString();
	time = time.toString();
    	output = (output.padLeft(3,'0'));
	time = (time.padLeft(5,'0'));
	cmd = cmd + output + time;
    prepMsg2(cmd)
}
def ControlOutputOff(output){
 	ifDebug("controlOutputOff()" + output)
    	def cmd = elkCommands["ControlOutputOff"]
	output = output.toString();
    	output = (output.padLeft(3,'0'));
	cmd = cmd + output;
    prepMsg2(cmd)
}

def prepMsg2(cmd) {
	def future = "00";
	def msg = cmd + future;
	def len  = (msg.length()+2);
	String msgStr = Integer.toHexString(len);
	msgStr = (msgStr.toUpperCase());
    	msgStr = (msgStr.padLeft(2,'0')); 
	msg = msgStr + msg
	def cc = generateChksum(msg);
	msg = msg + cc + '\r\n'
	sendMsg(msg)
}
private parse(String message) {
    ifDebug("Parsing Incoming message: " + message)
		def commandCode = message.substring(2, 4);
	switch(commandCode) {
         case 'CC': 
            ifDebug("Output Change Update: ");
			outputStatus(message)
			break;
}
}

def outputStatus(message){
		def ElkM1DNI = device.deviceNetworkId
		def outputNumber = message.substring(4, 7)
			def outputState = message.substring(7, 8)
			outputState = elkOutputStates[outputState];
		deviceNetworkId = ElkM1DNI + "_O_" + outputNumber;
if (getChildDevice(deviceNetworkId)!=null){
     zoneDevice = getChildDevice(deviceNetworkId)
         if (zoneDevice.capabilities.find { item -> item.name.startsWith('Switch')}){
            zoneDevice.sendEvent(name: "switch", value: (outputState), isStateChange: true)
         }
}
}

Are you referring to those commands?

Yes!

The child driver is sending an on/off command to the parent triggering the ControlOutputOn or ControlOutputOff commands. The status updated properly on the child device page.

Try Custom Commands....

That's RM's way of extending it's command set. You add it once by picking the device/driver that has the commands you want, then identify them...

From then on it's a command you can use in Rules.. there's a Custom Command selector in each Rule.

I thought I tried this but I will try again when I get home and document the steps and results. Do I have to have Actuator capability on both child and parent drivers.

Thanks

I am so lost here. I can setup ControlOutputOn as a custom command but when I go to rule machine and create a new rule. I need to select a condition capability so I select switch and pick my output switch. When I turn the output switch on this condition never changes to true.

You didn't include the Output 002 switch in your rule.

Ok I think I tried that before but here it is again no joy.

Does that switch turn on and off? It has to for the rule to fire. When you say "no joy", do you mean the rule doesn't fire? Have you looked at the events for the switch (on device page), and the events for the app (on app status page -- gear icon)?

From the device page yes the switch turns on and off. It also turns my hardware system on and off. Yes sorry I meant the rule doesn't fire (no joy).

Device Events

App Status Events

Does this App Status Settings page tell us something, look at the condition 'ENUM'?

That's quite strange. Please delete that rule. Since you only have actions for true and a single condition, make a Trigger and see if that works.

Ok here it is as a trigger rule. Still no luck using rule machine to see it.

No, not Triggered Rule. As Trigger. The simplest one.

Sorry for all the screen shots but hoping it might help~

And nothing happens with this trigger? What is the type of device involved? There is something funky about this device, but I don't know what it is.

Nothing happens with the trigger! It is one of potential many outputs in the Elk M1 control system. Yeah something funky here but it might not be the device, it could be me. So thanks for your insight thus far!

Here is a definition from the Elk User Manual.

OUTPUTS Provides the ability to view and control individual outputs. An
output may be a relay used to signal or switch a device On or Off. Outputs
are not necessarily a physical form. Outputs must first be assigned and
programmed by the installer before you can utilize them in this menu. A relay
might be used to control a Pool pump motor. When this output is On the
pump would be running. When the output is Off the pump would be off.

Here is a screenshot of the available outputs I exposed to HE:

The output state is changing correctly.

app:4402019-03-23 10:11:52.814 am debugElk M1 Module: Connection Driver: Output Change Update:

app:4402019-03-23 10:11:52.778 am debugElk M1 Module: Connection Driver: Parsing Incoming message: 0ACC002100E6

app:4402019-03-23 10:11:52.698 am debugElk M1 Module: Connection Driver: sendMsg 0Ecn0020000000D8

app:4402019-03-23 10:11:52.659 am debugElk M1 Module: Connection Driver: controlOutputOn()

In the driver where it sends those events, it probably needs an additional parameter:

isStateChange: true

Yep already have that!

def outputStatus(message){
		def ElkM1DNI = device.deviceNetworkId
		def outputNumber = message.substring(4, 7)
			def outputState = message.substring(7, 8)
			outputState = elkOutputStates[outputState];
		deviceNetworkId = ElkM1DNI + "_O_" + outputNumber;
if (getChildDevice(deviceNetworkId)!=null){
     zoneDevice = getChildDevice(deviceNetworkId)
         if (zoneDevice.capabilities.find { item -> item.name.startsWith('Switch')}){
            zoneDevice.sendEvent(name: "switch", value: (outputState), isStateChange: true)
         }
}
}

From the device screen this updates properly.
Current States
switch : On

I did notice that I am not updating the state variable.

State Variables
Switch : Off