I have GE/Jasco ON/Off switches. I'd like to configure them such that if someone does a 'off' operation twice in X seconds on a given switch that it'll trigger a scene. The switches do not support associations, but I believe Niffler can see them.
So for example, the switch at the base of the stairwell would normally be on/off for the stairs light, but if it is double-clicked off then it would trigger the scene that turns off all lights downstairs.
Any suggestions on how to do this?
Double-click GE/Jasco devices
Re: Double-click GE/Jasco devices
You can create a user module and in the init method subscribe to metric changes in level like this:
Then when they occur you can query the device, to ensure you got the one you are looking for, and calculate if you need to execute an action and do what you need it to do.
This is just pseudo code for the purpose of describing the concept, the developer documentation describes in detail how to access virtual devices.
Code: Select all
//Define change handler
this.levelChanged = function (virtualDevice) {
if(virtualDevice.SwitchBinary.data.level.value === false){
//Do something, compare with timestamp of last time this happened for example
}
};
//Bind the handler to level changes
this.controller.devices.on('change:metrics:level', this.levelChanged);
This is just pseudo code for the purpose of describing the concept, the developer documentation describes in detail how to access virtual devices.
Re: Double-click GE/Jasco devices
Thank you, that points me in the right direction.