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.

JS'ed SVG for Siemens RDG1x0KN thermostats
#3
(12.01.2017, 21:54)buuuudzik Wrote: Please check this example of svg controlled via js:
http://forum.logicmachine.net/showthread...275&page=4

I can also prepare something to start for you. If this wouldn't work please change '0' to '1' or other value, it depends on how many other images do you have in your visualisation.

Code:
$(function(){

  $('object').load(function() {
    
    var svg = $('object')[0]; // Choosing svg
        
    var svgDoc = svg.contentDocument; // Choosing content from svg
    var temperature = svgDoc.getElementById("temperature"); // Choosing temperature from content
    var setpoint = svgDoc.getElementById("setpoint"); // Choosing setpoint from content
    var primary = svgDoc.getElementById("primary"); // Choosing primary from content
    var secondary = svgDoc.getElementById("secondary"); // Choosing secondary from content
    var radiator = svgDoc.getElementById("radiator"); // Choosing radiator from content
    var speed0_16 = svgDoc.getElementById("speed0_16"); // Choosing speed0_16 from content
    var speed16_33 = svgDoc.getElementById("speed16_33"); // Choosing speed16_33 from content
    var speed33_50 = svgDoc.getElementById("speed33_50"); // Choosing speed33_50 from content
    var speed50_83 = svgDoc.getElementById("speed50_83"); // Choosing speed50_83 from content
    var speed83_100 = svgDoc.getElementById("speed83_100"); // Choosing speed83_100 from content
    var fan = svgDoc.getElementById("g24"); // Choosing fan from content
    var heat = svgDoc.getElementById("g39"); // Choosing heat from content
    var cool = svgDoc.getElementById("g34"); // Choosing cool from content

    // Update temperature
    actual_temp = Scada.encodeGroupAddress('1/1/10'); // temperature
    objectStore.addListener(actual_temp, function(obj, type) {
    console.log(temperature, obj.value)
    temperature.textContent= obj.value
    });
    
});
 
});


At this moment I have only time for such little helpSad Maybe tomorrowWink

I see also some buttons, can you describe how do you change parameters on real thermostat?

HI  @buuuudzik,thanks for your hints. I've used embedded js at the moment. I'm not so familiar with js. I've used edgars example and tried to adapt it to my use case. I'll have a look at you example for custom js. It would be better because we can use only one instance of the image. I don't really know how to identify them from custom js.
I actually change parameters with standard visualization objs. The thermostat is read only at the moment.  Shy
Buttons and rotatory are not yet used (really i don't know how to get events from SVG and make them change objs status). Could you give some other hint for both questions?

Thanks

PS: I've updated the image in first post.
Reply


Messages In This Thread
RE: JS'ed SVG for Siemens RDG1x0KN thermostats - by lpala - 13.01.2017, 06:48

Forum Jump: