Thanks for the great support.
I currently have no errors with what you’ve helped provide me with. However, it displays the else condition, and NO DATA.
Right now, my MMM-EMonitor.js looks like the following:
Module.register ("MMM-EMonitor", {
//default module config.
defaults: {
// Insert defaults here
interval: 900000 // Every 15 mins
},
getStyles: function() {
return ["MMM-EMonitor.css"];
},
// Define the start sequence
start: function() {
Log.log("Starting module: " + this.name);
//this.securitykey = REDACTED;
this.url = 'https://api.emonitor.us/location/getCurrentData?security_key=REDACTED';
this.getCurrentData(this);
},
getCurrentData: function(that) {
that.sendSocketNotification('GET-CURRENT-DATA', that.url);
setTimeout(that.getCurrentData, that.config.interval, that);
},
getDom: function(){
var wrapper = document.createElement("div");
if(this.xml){
var channels = this.xml.getElementsByTagName("channel");
for(var i = 0; i < channels.length; i++){
for(var n = 0; n < channels[i].children.length; n++){
if(channels[i].children[n].tagName === "name" || channels[i].children[n].tagName === "watts"){
var element = document.createElement("div");
element.classList.add(channels[i].children[n].tagName);
element.innerHTML = channels[i].children[n].textContent;
wrapper.appendChild(element);
}
}
}
} else {
wrapper.innerHTML = "NO DATA";
}
return wrapper;
}
});
and my css looks like the following:
.MMM-EMonitor .centered {
text-align: center;
}
Like I mentioned, the NO DATA is showing up. The security key is working, and returns the XML which I have in my original post.