24.12.2020, 08:04
(23.12.2020, 06:54)admin Wrote: You are missing a closing } for the CreateListeners function. It should be like this:
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.
ok, thank you. Now it's working!
Another request, be patient : I would repeat the play of the beep until the condition change. I tried with a while - do loop, but it seems I make something wrong....