Widget with autovalues - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9) +--- Thread: Widget with autovalues (/showthread.php?tid=2128) |
Widget with autovalues - PassivPluss - 25.06.2019 Hi In a current project we will use LM or SL to visu a building containing 50 rooms with control of room temperature. I would like to have a map over 1 and 2 floor with display of current room temperature. With push on temperature a widget will open displaying current room temperature, set point, current % on heat output and link to trends for this values. Is it possible to make one widget and use tags or css /java to link values in the widget to correct values? This will make visu much quicker and if we wntt to change the widget it will just be one to change RE: Widget with autovalues - Erwin van der Zwart - 25.06.2019 Hi, I posted something like that last year, check this post: https://forum.logicmachine.net/showthread.php?tid=1742&pid=11145#pid11145 BR, Erwin RE: Widget with autovalues - PassivPluss - 25.06.2019 I read that post earlier but didnt understand it completly. Where do i input room number and how does it get correct values? RE: Widget with autovalues - Erwin van der Zwart - 26.06.2019 Hi, It grabs the address from the widget button and then it search the class(es) of the button(s) on your widget, then it removes the original address of the widget button and it attach the new address calculated from the original widget address so you need a logical address structure. BR, Erwin RE: Widget with autovalues - PassivPluss - 26.06.2019 ok. But where do I insert the text it shall link to? In the widget i need the following values: With push on the map of building on a room temperature a widget will open displaying current room temperature, set point, current % on heat output and link to trends for this values. $(function(){ // Declare vars var MainObject = "0/0/0"; var StatusObject = "0/0/0"; var MainObjectSplitted = []; var StatusObjectSplitted = []; // Detect adresses linked to widget button and create arrays $(".screen_widget").on("click", function(e) { MainObject = $(this).data("object"); StatusObject = $(this).data("status-object"); if (typeof(MainObject) !== 'undefined') { MainObjectSplitted = MainObject.split("/"); } if (typeof(StatusObject) !== 'undefined') { var StatusObjectSplitted = StatusObject.split("/"); } }); function removelistener(src) { var el = $(src) // source element reference , addr = el.data('status-object') // group address of status object , id = Scada.encodeGroupAddress(addr) // address to id , obj = objectStore.objects[ id ]; // get object's store reference if (obj) { // find listener that is attached to the source element $.each(obj.listeners, function(index, listener) { // remove the listener if (listener.bind.el && el.is(listener.bind.el)) { obj.listeners.splice(index, 1); } }); } } // Remove original events from up button on widget $(".screen_widget_up") .off("vclick") .on("vmousedown", function() { var btnthis = $(this), objthis = btnthis.data("object") removelistener(btnthis); }) // Add new action to button .on("vclick", function() { var newaddressup = (Number(MainObjectSplitted[0])+0) + "" + (Number(MainObjectSplitted[1])+1) + "" + (Number(MainObjectSplitted[2])+0) grp.write(newaddressup, true); } ); // Remove original events from down button on widget $(".screen_widget_down") .off("vclick") .on("vmousedown", function() { var btnthis = $(this), objthis = btnthis.data("object") removelistener(btnthis); }) // Add new action to button .on("vclick", function() { var newaddressdown = (Number(MainObjectSplitted[0])+0) + "" + (Number(MainObjectSplitted[1])+1) + "" + (Number(MainObjectSplitted[2])+0) grp.write(newaddressdown, false); } ); }); RE: Widget with autovalues - PassivPluss - 13.09.2019 Hi all In next week I will start programming this building. I am not sure how to make this widget and script to make it work. Could you explain it a bit more? In the widget i want the following group adress: Set temperature for the room Status temperature of the room Heat output status Trend link to multiple trends for this values I want to make one widget and make the group adresses change automaticaly to room number Group adress names are 1/0/1 101 temperature status 1/0/2 101 temperature set point 1/0/3 101 heat output This would make the programmering easier as I have almost 50 rooms. RE: Widget with autovalues - PassivPluss - 21.09.2019 Hi I dont understand how this one works. I tried it with 2 buttons with virtual adress but i cant write any value to them. On push on widget the widget opens but the var main and status dont update to the value of the main/status on the main widget open button. Can anyone explain this one to me? RE: Widget with autovalues - Daniel - 23.09.2019 Did you add additional classes to them? screen_widget_up screen_widget_down RE: Widget with autovalues - PassivPluss - 23.09.2019 Yes. I use virtual adresses. Is that ok or do it has to be real adress? Should it work on 1byte also or only bit? RE: Widget with autovalues - Daniel - 24.09.2019 There is missing "/" in the code where new address is calculated Code: var newaddressup = (Number(MainObjectSplitted[0])+0) + "/" + (Number(MainObjectSplitted[1])+1) + "/" + (Number(MainObjectSplitted[2])+0) RE: Widget with autovalues - PassivPluss - 24.09.2019 Perfect, my css/js skills are none to less. Thank you Daniel I will try this later on RE: Widget with autovalues - admin - 01.10.2019 Changing assigned objects on the fly is not trivial and might lead to hard to find errors. I suggest duplicating widgets and assigning them to objects via a script. This is a more robust solution if done right. RE: Widget with autovalues - PassivPluss - 02.10.2019 Ok. Can you make an example of this? RE: Widget with autovalues - Daniel - 04.10.2019 Have a look here, https://forum.logicmachine.net/showthread.php?tid=1249&pid=7450#pid7450 RE: Widget with autovalues - PassivPluss - 04.10.2019 Thanks Daniel |