Logic Machine Forum
javascript group read - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: javascript group read (/showthread.php?tid=3853)



javascript group read - jmir - 03.02.2022

Hi,

Is there any way to send group read telegrams from javascript? 

Is there any documentation where I can see which knx bus functions are available using javascript?

Thanks.


RE: javascript group read - admin - 03.02.2022

Full list of functions: https://forum.logicmachine.net/showthread.php?tid=321
Since read is not available at the moment you can use this:
Code:
var req = { action: 'read', address: '1/1/1' };
localbus.ws.send(JSON.stringify(req));



RE: javascript group read - jmir - 03.02.2022

(03.02.2022, 14:28)admin Wrote: Full list of functions: https://forum.logicmachine.net/showthread.php?tid=321
Since read is not available at the moment you can use this:
Code:
var req = { action: 'read', address: '1/1/1' };
localbus.ws.send(JSON.stringify(req));

Ok thanks!!


RE: javascript group read - jmir - 03.02.2022

(03.02.2022, 14:29)jmir Wrote:
(03.02.2022, 14:28)admin Wrote: Full list of functions: https://forum.logicmachine.net/showthread.php?tid=321
Since read is not available at the moment you can use this:
Code:
var req = { action: 'read', address: '1/1/1' };
localbus.ws.send(JSON.stringify(req));

Ok thanks!!

Hi,

I've tested and it says localbus.ws is not defined...


RE: javascript group read - admin - 04.02.2022

You are probably calling it before localbus is connected.
Try this:
Code:
$(localbus).on('connect', function() {
  console.log('connected');
  var req = { action: 'read', address: '1/1/1' };
  localbus.ws.send(JSON.stringify(req));
});



RE: javascript group read - jmir - 04.02.2022

(04.02.2022, 08:42)admin Wrote: You are probably calling it before localbus is connected.
Try this:
Code:
$(localbus).on('connect', function() {
  console.log('connected');
  var req = { action: 'read', address: '1/1/1' };
  localbus.ws.send(JSON.stringify(req));
});

Ok, now it works!
Thanks!