25.03.2020, 07:24
You can use an additional object to control whether to play the sound or not. In this example the sound will play only when 1/1/1 value is true.
Code:
function CreateListeners(groupaddr,url){
// Make event listener to object
if (typeof grp != 'undefined') {
grp.listen(groupaddr, function(object, state) {
var value = object.value;
var enabled = grp.getvalue('1/1/1');
if (state == 'value' && value == 1 && enabled) {
Play_Audio(url);
}
}, true);
}
}