This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

html widget + custom js + grp library
#1
Hi, I was trying to create a cool widget for battery charging, and the widget seems to be working when I change values manually from JavaScript, but if I try to read a group object, it does not do anything, so I tried 
Code:
console.log(typeof grp )

And I can see in the console that grp is undefined. Is there another way in Visu to get hold of group addresses? Or is GRP still not available to use in the new visu?

I am using firmware 20251120 and visu 20251121
Reply
#2
See this: https://kb.logicmachine.net/misc/visu/#localbus-library
Reply
#3
Hey! Not sure if this is the right place to put my comment.

Found this thread and id like to ask where to put the javascript.

I can only get it to work inline in the html part when creating a custom html widget in the visu admin.

Is there another place i should place it?

edit:

Found the solution, it was in the top right corner of the visu editor.
Also custom javascript cannot run when inside the editor/admin. Need to be in the visu app!
Reply
#4
(04.12.2025, 07:49)admin Wrote: See this: https://kb.logicmachine.net/misc/visu/#localbus-library

Do you have an example of how to make a html widget that shows group adress 1/2/0 value? and updates it automatically when the object is updated?
Reply
#5
Here's a similar example that can be modified to display a value: https://forum.logicmachine.net/showthrea...4#pid40374
Reply
#6
(04.12.2025, 07:49)admin Wrote: See this: https://kb.logicmachine.net/misc/visu/#localbus-library

Thanks admin

I am now having a different problem: once I load a page with custom JavaScript, everything works fine, but if I change plan and then come back to the original plan then it does not execute the JavaScript functions anymore, and I need to refresh the web page to get them to work again as intended. Is there a way to fix it?
Reply
#7
See the example in my previous post. Your code must listen to widget-ready / widget-hide events. Unlike old Visu, widget elements only exist if the plan is visible. When switching to a different plan all widgets are removed.
Reply


Forum Jump: