Just started playing with Node Red on my brand new Rpi 4. I was able to read information from an Arduino running a simple web server without a problem. Now, I'm trying to get Node Red to display some information from a webserver running on my solar panel data unit. It runs http 0.9.
In python, I get the following code to produce results:
What do you mean by this? Are you sure you really mean that? This is the very first version of the HTTP protocol and certainly should never be used now. It is highly insecure for one thing. It also doesn't support any of the expected more advanced HTTP features.
I very much doubt that node.js supports it either which is probably why it is failing since Node-RED is build on node.js.
The minimum recommended version of HTTP that you should be using is v1.2
So, I ran the HTML node just entering the address of the DTU in it, and I get this response in the debug, just in case there is a solution for this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<meta http-equiv="x-ua-compatible" content="ie=7" />
<TITLE>Hoymiles</TITLE>
<SCRIPT>
function getData(url) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
alertContents1(xmlhttp.responseText);
}
}
xmlhttp.open('GET',url + '?_t=' + new Date().getTime(),true);
xmlhttp.send(null);
}
setInterval("getData('hometable.xml')", 3000);
function alertContents1(text)
{
var t = 0;
var j = 0;
var k = 0;
var temp;
var str;
var ss;
var Rssi_Value = "";
var arr = text.split(";");
document.getElementById("outpw").innerHTML = arr[0] + " kW";
document.getElementById("tetot").innerHTML = arr[...
I'm really only interested in the first 4 or 5 data fields in there (the debug somehow only shows the first 2, "outpw" and "tetot")
If I can't get this running, I guess I could have my little Arduino get the data out of it and present it to Node-Red on the same Web-page that it already can read. "Kludge" comes to mind...
OK, so this tells you that you can bypass the page that you are requesting and directly ask for the XML.
So if the address you are currently getting is something like http://1.2.3.4/index.html, replace that with http://1.2.3.4/hometable.xml?_t= followed by a number that represents the current time, that's what the new Date().getTime() gives you. You can get node-red to deliver that.
When you have the XML, there is a node to convert that to a JavaScript object. Dump the output to debug and you will be able to find the values you are looking for.