03.05.2021, 09:23
Hi,
I am trying again. Hope somebody can help me
I found this code from another post her in the forum, but I need some help to get it right.
I am trying to write a value from my browser to LM, I have tried different codes but I think there is no connection between the javascript and LM.
And when I check the console in my browser no errors are there, but no log info from the bus either.
What am I missing? I have read this posts about Websockets but I am a beginner at this scripting thing so I don't understand it all.
I have also added websocket.lua (a file from another post) in my user library in LM.
I am trying again. Hope somebody can help me
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://192.168.10.111/apps/js/jquery.js.gz"></script>
<script src="http://192.168.10.111/apps/js/localbus.js.gz"></script>
<script src="http://192.168.10.111/scada/vis/busdecode.js.gz"></script>
</head>
<body>
<script>
$(function() {
// listen to all groupwrite telegrams
localbus.listen('groupwrite', function(event) {
console.log(event);
});
localbus.init('http://192.168.10.111, admin:admin');
});
</script>
</body>
</html>
I am trying to write a value from my browser to LM, I have tried different codes but I think there is no connection between the javascript and LM.
And when I check the console in my browser no errors are there, but no log info from the bus either.
What am I missing? I have read this posts about Websockets but I am a beginner at this scripting thing so I don't understand it all.
I have also added websocket.lua (a file from another post) in my user library in LM.