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 whether you accept or reject these cookies being set.

Widget with autovalues
#1
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 changeSmile
Reply
#2
Hi,

I posted something like that last year, check this post: https://forum.logicmachine.net/showthrea...5#pid11145

BR,

Erwin
Reply
#3
I read that post earlier but didnt understand it completly.
Where do i input room number and how does it get correct values?
Reply
#4
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
Reply
#5
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);
}
);

});
Reply


Forum Jump: