That did not work. So the question is how do I refer to these power variables?
Code: Select all
PVLogger.prototype.fetchSolar = function (instance) {
var self = instance;
http.request({
url : "http://" + self.config.pvlogger1 + "/status.xml",
method : "GET",
async : true,
success : function (response) {
try {
var doc1 = response.data; // it is already ZXmlDocument
power1 = parseFloat(doc1.findOne("/response/gauge_power/text()"));
self.vDev.set("metrics:watts1", power1);
} catch (e) {
//error handling
}
},
error : function () {
//error handling
}
});
http.request({
url : "http://" + self.config.pvlogger2 + "/status.xml",
method : "GET",
async : true,
success : function (response) {
try {
var doc2 = response.data; // it is already ZXmlDocument
power2 = parseFloat(doc2.findOne("/response/gauge_power/text()"));
self.vDev.set("metrics:watts2", power2);
} catch (e) {
//error handling
}
},
error : function () {
//error handling
}
});
icon = "http://quadras:8083/user/solarok58px.png";
self.vDev.set("metrics:icon", icon);
};