I've done some enhancements to Knxweb (I use it with other automation system than EIB)....
I have merged Scale and Dimmer objects (so one can see blinds going up/down by clicking on +/-)... But I spot something weird and would like to ask if this is normal or I've done something wrong...
When you press +/- there is usually 2 secs delay - in case if you make further +/- clicks. Command is sent 2 secs after last click. But if I have two or more objects of same type and I click fast on them, it seems that only the first in the row gets change, desired actions on other are not triggered and state returns to previous state...
Have I done something wrong or is this somekind of system limitation? If yes, how to avoid such problems, cause it is quite confusing...
Thanks in advance,
regards,
Bulek.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't see any system limitation for this. if the different objects of same type have different object ids then they are independent. And I don't understand where the 2 sec delay comes from. When I click on the +/- buttons of my dimmer, the light is dimming up/sown immediately, and stopping when I release the mouse button.
Can you provide the code of your combined Scale/Dimmer object so that I can try it?
Regards,
Jean-François
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'll provide the code - no problem, when it will work...
I've changed behaviour in my case, so one can click on +/- to increase/decrease desired dimming level and then after 2 secs of inactivity it gets sent to xml server....
My question is related to this :
- for delayed action we use for instance :
runAfter.add(this.owner.sendSetValue,2, this.owner);
- then we check in updateObject method if anything is in run time queue, then we wait with updating real state :
if ((obj==this.returnObject)&&(!runAfter.isIn(this.sendSetValue)))
- now my question is relating to this check - is there a distinction between sendSetValue entries of different instances of same type of object in run queue?
In my case if I click on one object and while waiting for that action to trigger, I also click on another instance of same object, and then when action triggers for the first one (sendSetValue) then the desired action for the second one is resetted (not triggered) - it seems like to second one is not entered into queue at all (probably cause the first one already exists in it?)... The second one then just resets to previous state like nothing was done on it....
Is this a mess in my code or normal behavour ?
Similar happens also in other objects that use time delayed queue for actions... Since I'm begginer in Javascript and KnxWeb - I could be doing something wrong.... To me it seems that there is no distinction of similar entries from different instances of same objects in queue....
Thanks in advance,
regards,
Bulek.
my Dimmer code :
function CDimmer(conf) {
this.commandObject=conf.getAttribute("dim");
this.onoffObject=conf.getAttribute("switch");
this.returnObject=conf.getAttribute("value");
this.value=0;
var widget = this.init(conf, 'dimmerDiv', '36px', '96px');
aRow = $("<tr/>");
content = $("<td align='center'/>");
aRow.append(content);
widget.append(aRow);
In short time I'll send you my scale/dimmer hybrid code along with other changes (since I'm newbie, it would be good for someone to revise them and decide what to include...)...
I'm still on 0.5 version, so would kindly ask if I can somehow get more info on code changes since then, so I could adapt to newer versions ? Any changelog or some other easy way to compare v0.5 vs recent cvs ?
Thanks in advance,
regards,
Bulek.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've done some enhancements to Knxweb (I use it with other automation system than EIB)....
I have merged Scale and Dimmer objects (so one can see blinds going up/down by clicking on +/-)... But I spot something weird and would like to ask if this is normal or I've done something wrong...
When you press +/- there is usually 2 secs delay - in case if you make further +/- clicks. Command is sent 2 secs after last click. But if I have two or more objects of same type and I click fast on them, it seems that only the first in the row gets change, desired actions on other are not triggered and state returns to previous state...
Have I done something wrong or is this somekind of system limitation? If yes, how to avoid such problems, cause it is quite confusing...
Thanks in advance,
regards,
Bulek.
Hi,
I don't see any system limitation for this. if the different objects of same type have different object ids then they are independent. And I don't understand where the 2 sec delay comes from. When I click on the +/- buttons of my dimmer, the light is dimming up/sown immediately, and stopping when I release the mouse button.
Can you provide the code of your combined Scale/Dimmer object so that I can try it?
Regards,
Jean-François
Hi,
I'll provide the code - no problem, when it will work...
I've changed behaviour in my case, so one can click on +/- to increase/decrease desired dimming level and then after 2 secs of inactivity it gets sent to xml server....
My question is related to this :
- for delayed action we use for instance :
runAfter.add(this.owner.sendSetValue,2, this.owner);
- then we check in updateObject method if anything is in run time queue, then we wait with updating real state :
if ((obj==this.returnObject)&&(!runAfter.isIn(this.sendSetValue)))
- now my question is relating to this check - is there a distinction between sendSetValue entries of different instances of same type of object in run queue?
In my case if I click on one object and while waiting for that action to trigger, I also click on another instance of same object, and then when action triggers for the first one (sendSetValue) then the desired action for the second one is resetted (not triggered) - it seems like to second one is not entered into queue at all (probably cause the first one already exists in it?)... The second one then just resets to previous state like nothing was done on it....
Is this a mess in my code or normal behavour ?
Similar happens also in other objects that use time delayed queue for actions... Since I'm begginer in Javascript and KnxWeb - I could be doing something wrong.... To me it seems that there is no distinction of similar entries from different instances of same objects in queue....
Thanks in advance,
regards,
Bulek.
my Dimmer code :
function CDimmer(conf) {
this.commandObject=conf.getAttribute("dim");
this.onoffObject=conf.getAttribute("switch");
this.returnObject=conf.getAttribute("value");
this.value=0;
var widget = this.init(conf, 'dimmerDiv', '36px', '96px');
aRow = $("<tr/>");
content = $("<td align='center'/>");
aRow.append(content);
widget.append(aRow);
content.css('width','32px');
// Ampoule
this.light = $("<img src='images/light_off.png'/>").get(0);
this.light.onclick=function() {
if (this.owner.value>0) {
EIBCommunicator.eibWrite(this.owner.onoffObject,0);
this.owner.value=0;
}
else {
EIBCommunicator.eibWrite(this.owner.onoffObject,80);
this.owner.value=80;
}
};
this.light.owner=this;
content.append(this.light);
// Plus
this.plus = $("<img src='images/plus.png'/>").get(0);
this.plus.owner=this;
this.plus.onclick=function() {
this.owner.value+=10;
if (this.owner.value>100)
this.owner.value = 100;
this.owner.setPosition(this.owner.value);
runAfter.add(this.owner.sendSetValue,2, this.owner);
}
content.append(this.plus);
// Moins
this.moins = $("<img src='images/moins.png'/>").get(0);
this.moins.owner=this;
this.moins.onclick=function() {
this.owner.value-=10;
if (this.owner.value<0)
this.owner.value = 0;
this.owner.setPosition(this.owner.value);
runAfter.add(this.owner.sendSetValue,2, this.owner);
}
content.append(this.moins);
var content2 = $("<td align='left' valign='bottom' width=4/>");
this.positionBar = $("<div style='width: 4px; height: 0px; background-color: yellow;'/>").get(0);
content2.append(this.positionBar);
aRow.append(content2);
}
CDimmer.type='dimmer';
UIController.registerWidget(CDimmer);
CDimmer.prototype = new CWidget();
CDimmer.prototype.getListeningObject = function() {
return Array(this.returnObject);
};
CDimmer.prototype.setPosition = function(value) {
if ((value>=0)&&(value<=100)) {
this.positionBar.style.height=((value/100)*96)+'px';
this.value=value;
}
};
CDimmer.prototype.updateObject = function(obj,value) {
if ((obj==this.returnObject)&&(!runAfter.isIn(this.sendSetValue))) {
this.setPosition((value/100)*100)
if (value>0)
this.light.src='images/light_on.png';
else
this.light.src='images/light_off.png';
}
};
CDimmer.prototype.sendSetValue = function(sender) {
// EIBCommunicator.eibWrite(this.owner.commandObject,this.owner.value);
EIBCommunicator.eibWrite(sender.commandObject,sender.value);
};
P.s: :
correction of last function :
CDimmer.prototype.sendSetValue = function(sender) {
EIBCommunicator.eibWrite(sender.commandObject,sender.value);
};
Published code is for modified dimmer device that also exposes similar behaviour - will post for combined scale/dimmer once I solve this problem.
The main question is if different instances of same object can independently enter actions into time delay queue...
Thanks in advance,
regards,
Bulek.
Hi,
Yes, you discovered a bug in the code.
I made the correction in CVS:
http://linknx.cvs.sourceforge.net/viewvc/linknx/knxweb/knxweb/js/common.js?r1=1.10&r2=1.11
Regards,
Jean-François
Hi,
thanks for help. That solved my issues...
In short time I'll send you my scale/dimmer hybrid code along with other changes (since I'm newbie, it would be good for someone to revise them and decide what to include...)...
I'm still on 0.5 version, so would kindly ask if I can somehow get more info on code changes since then, so I could adapt to newer versions ? Any changelog or some other easy way to compare v0.5 vs recent cvs ?
Thanks in advance,
regards,
Bulek.