This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Closed

Device trigger /w 2 dropdown options

I need some help with the trigger ([IF] column) of a device with 2 dropdown options (a remote)

I can't seem to make it trigger any flows, this is what i got so far:
driver.js
module.exports.on('initNode', function( token ){
	var node = module.exports.nodes[ token ];
	if( node ) {
		node.instance.CommandClass['COMMAND_CLASS_CENTRAL_SCENE'].on('report', function( command, report ){
			var remote_value = {
				"button": report['Scene Number'],
				"scene": report.Properties1['Key Attributes']
			};
			Homey.manager('flow').triggerDevice('octan_remote', null, remote_value, node.device_data);
		});
	}
});

app.json

		"triggers": [
			{
				"id": "octan_remote",
				"title": {
					"en": "Octan Remote",
					"nl": "Octan Afstandbediening"
				},
				"args": [
					{
						"name": "remote",
						"type": "device",
						"filter": "driver_id=OCTAN"
					},
					{
						"name": "button",
						"type": "dropdown",
						"values": [
							{
								"id": "1",
								"label": {
									"en": "Button 1 ( ● )",
									"nl": "Knop 1 ( ● )"
								}
							},
							{
								"id": "2",
								"label": {
									"en": "Button 2 ( + )",
									"nl": "Knop 2 ( + )"
								}
							},
							{
								"id": "3",
								"label": {
									"en": "Button 3 ( ◯ )",
									"nl": "Knop 3 ( ◯ )"
								}
							},
							{
								"id": "4",
								"label": {
									"en": "Button 4 ( - )",
									"nl": "Knop 4 ( - )"
								}
							}
						]
					},
					{
						"name": "scene",
						"type": "dropdown",
						"values": [
							{
								"id": "Key Pressed 1 time",
								"label": {
									"en": "Pressed 1x",
									"nl": "1x Gedrukt"
								}
							},
							{
								"id": "Key Pressed 2 times",
								"label": {
									"en": "Pressed 2x",
									"nl": "2x Gedrukt"
								}
							},
							{
								"id": "Key Held Down",
								"label": {
									"en": "Held Down (triggers until released)",
									"nl": "Ingehouden (triggerd tot los laat)"
								}
							},
							{
								"id": "Key Released",
								"label": {
									"en": "Key Released",
									"nl": "Losgelaten"
								}
							}
						]
					}
				]
			}
		]
there doesn't seems to be any documentation on how to trigger a device with a dropdown.
and too bad the KaKu app isn't open source (they use the same trigger way for the remotes)

I've tried some variations in the driver.js file but all don't work, any one that can help me out here?
Or point me in the right direction.
(the values put in the "remote_value" are being set properly)

Comments

  • Register
    Homey.manager('flow').on('trigger.octan_remote', function(callback, args, state) { ... });
    to check the conditions as set on the card (in the dropdowns) against the current trigger parameters.
  • ah, that was what i'm looking for, @RamonBaas thank you very much.
    Too bad that i can't try it out yet.
This discussion has been closed.