23.12.2020, 06:54
You are missing a closing } for the CreateListeners function. It should be like this:
Next time if Custom JS is not working check browser console (F12) for any error messages.
Code:
// Function to create event listeners
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('32/2/1');
if (state == 'value' && value == 1 && enabled) {
Play_Audio(url);
}
}, true);
}
} // missing closing "}"
// Start creating listeners
for (var i in AudioTable) {
CreateListeners(AudioTable[i].address,AudioTable[i].url);
}
Next time if Custom JS is not working check browser console (F12) for any error messages.