[OBSOLETE]How to makes lights Flash (code for DTH modification)

It is possible to add a custom command to either z-wave or zigbee device handlers to make them flash when commanded. Once the custom device handler is created and published, you can edit the device you want to flash to use that device handler. After that, the flash command can be exposed in Rule Machine Create Custom Commands, and used as an action in Rule Machine.

For either type, add this line in the metadata:

command "flash"

For a zigbee device add this code:

def flash() {
	delayBetween ([
    	delayBetween ([	zigbee.on(),
        		zigbee.off()], 1000),
    	delayBetween ([	zigbee.on(),
        		zigbee.off()], 1000),
    	delayBetween ([	zigbee.on(),
        		zigbee.off()], 1000),
                        ], 1000)
}

For a z-wave device add this code:

def flash() {
	delayBetween ([
    	delayBetween ([	zwave.basicV1.basicSet(value: 0xFF).format(),
        		zwave.basicV1.basicSet(value: 0x00).format()], 1000),
	delayBetween ([	zwave.basicV1.basicSet(value: 0xFF).format(),
        	        zwave.basicV1.basicSet(value: 0x00).format()], 1000),
        delayBetween ([	zwave.basicV1.basicSet(value: 0xFF).format(),
        		zwave.basicV1.basicSet(value: 0x00).format()], 1000),
    	zwave.switchBinaryV1.switchBinaryGet().format()], 2000)
}
15 Likes

does this create a series of schedule items?

No, it does not. This is done in the device handler through a sequence of delays and commands. Delays are handled differently than things that are scheduled. Most z-wave device handlers use delays, and they all work. So we know that this particular mechanism is more or less OK.

1 Like

Am I correct that if I modify the stock DTH that runs local now it will no longer run local?

Yes, but if your using rule machine it isn’t running local anyways… unfortunately. …

2 Likes

Hi Bruce,

Thanks for all your work here!

I’m able to select my custom device handler for a Z-Wave Switch. But I don’t see a “Flash” command exposed when I create a custom command.

I also don’t see a “Flash” button when I’m testing the device driver. But the buttons visible there are ones exposed in the Rule Machine custom commands.

Is there something I need to do to add “flash” to the list of custom commands?

You probably failed to add the metadata

command "flash"

2 Likes

That was it. Thanks!