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