HomeWizard P1 working with DeviceName

The API of HomeWizard for P1 logging can work with IP and/or DeviceName.
But after of power failure the IP is lost, and a new is assigned.
So it is advised to work with DeviceName (suffix of mac) in scripts... or with Static IP, but unless my misunderstanding... TELENET does not support this. Not so TELE-Netjes. :frowning:

But :

  • In html node (web page) : does not work, and returns “Header fields are too long”
  • In http request node : works
  • Via Chrome browser : works

<p>... : <a href="http://p1meter-090bb6.local/api/v1/telegram">Telegram</a></p>

<p>... : <a href="http://192.168.0.143/api/v1/telegram">Telegram (IP)</a></p>

Any Suggestion ?
Thanks.
T

[Moderator edit to format code correctly]

Hi @Tany

Not knowing what HomeWizard or P1 refers to.
why not just give it a static/reserved IP on your network router via its Mac address?

The IP will then never change, seems a lot easier to accomplish :man_shrugging:

How do you make the request ?
Looking at their documentation it could be as simple as getting an url using the http request node:
http://<IP ADDRESS>/api/v1/telegram

The 'static' ip address is inside your own network, if you have a router, usually you can 'bind' the ip address to a mac address, so that it will always gets the same ip adress in your own network. (no need to deal with telenet)

1 Like

Hi,
HomeWizard P1 is a device to log consumption/injection of electrical energy (kWh). Typically there is a S1 (real time), and a P1 output port where the HomeWizard is to be plugged into.
It is part of my setup to run EMHASS, a Linear Programming model to optimize energy usage.
A Static IP is preferred but TELENET does not support it.
However, working with the DeviceName should work... but apparently not from an html-node.
Cheers,
T

What do you mean here?
You cant set a static IP for your own (internal) devices?

like @bakman2 said - your own network devices are what needs a Static IP - not your internet connection - if you cant set a private (local lan) device to have a static IP - Yuk!

Off course - it might be my misunderstanding on the system, and how it works

I do set static ip for my RPIs, ESP32s, ZigBee Coordinator... via the device web interfaces.
And yes TELENET is our internet provider, but no the TELENET-router does not accept setting static ip for local devices... except for professional (paid) subscription.

if a DeviceName-URL in a "http request node" works perfect, and ditto via Chrome browser.
Why is then the calling in a "html node" not working, and returning "Header fields are too long".

Sorry - I may still not be getting this.
But the "html node" (html) is a parser - its parsing HTML content (not making a http request).

it requires you pass a HTML string to look at - its not designed to make requests

Could you maybe share your flow - might help things a lot.

yes, my fault... "template node" it is, not html-node. Sorry, i erroneously copied the "name".

And in the body of the there are the <a href= > as described in the beginning of the post.

[
    {
        "id": "90285409b0fb68a5",
        "type": "http in",
        "z": "6d0b25e93ef1be89",
        "name": "",
        "url": "/wpESPost",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 362.93328857421875,
        "y": 377.9333190917969,
        "wires": [
            [
                "010f835be972f2b3"
            ]
        ]
    },
    {
        "id": "010f835be972f2b3",
        "type": "function",
        "z": "6d0b25e93ef1be89",
        "name": "process Post",
        "func": "var mpl = msg.payload;\nfor(var key in mpl){\n    var x=mpl.newID;\n    var y=mpl.newVal;\n    if (isNaN(y)) { global.set(x, y,     \"file\"); }\n    else          { global.set(x, y * 1, \"file\"); }\n}\nreturn null;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 602.9332885742188,
        "y": 377.9333190917969,
        "wires": [
            []
        ]
    },
    {
        "id": "ac226cf023bea91b",
        "type": "http in",
        "z": "6d0b25e93ef1be89",
        "name": "",
        "url": "/wpES",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 342.93328857421875,
        "y": 337.9333190917969,
        "wires": [
            [
                "0f6563ec6335aa74"
            ]
        ]
    },
    {
        "id": "0f6563ec6335aa74",
        "type": "template",
        "z": "6d0b25e93ef1be89",
        "name": "HTML",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n<head>\n    <title>NodeRed S8AB01</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <link rel=\"icon\" href=\"data:,\">\n<style>\n    html { font-family: Arial, Helvetica, sans-serif; text-align: left; }\n    h1 { font-size: 1.8rem; text-align: center;  color: white }\n    h2 { font-size: 1.5rem; font-weight: bold;   color: #143642; }\n    h3 { font-size: 1.0rem; font-weight: normal; color: #143642;\n    }\n    .topnav { overflow: hidden; background-color: #143642; }\n    body { margin: 10; }\n\n</style>\n\n    <script src=\"https://cdn.jsdelivr.net/npm/moment@2.29.4/min/moment.min.js\"></script>    \n    <script type = \"text/javascript\">\n        window.onload = function() {\n            formatP1LastFetch();\n            formatELIALastFetch();\n            formatSolCastLastFetch();\n            formatEV_ModeTimeT();\n        }\n\n        function input_update(newID, newVal) {\n            switch(newID) {\n                case \"EV_Mode\":\n                    if      (newVal==\"OFF\")  { \n                        document.getElementById(newID).value = \"Ext\";  \n                        newVal = \"Ext\";\n                        var newRgVal = document.getElementById(\"EV_ModeTime\").value;\n                        var d = new Date();  \n                        d.setHours(d.getHours()+newRgVal*1);\n                        var hm = ('00'+(d.getHours())).slice(-2) + \":\" + ('00'+d.getMinutes()).slice(-2);   \n                        document.getElementById(\"EV_ModeTimeT\").value = hm;\n                        d = Date.parse(d);\n                        input_post(\"EV_ModeTimeT\", d);\n                    }                            \n                    else if (newVal==\"Ext\")  { \n                        document.getElementById(newID).value = \"Auto\";  \n                        newVal = \"Auto\";\n                        document.getElementById(\"EV_ModeTimeT\").value = \"--:--\";                                                \n                        input_post(\"EV_ModeTimeT\", 0);\n                    }\n                    else if (newVal==\"Auto\") { \n                        document.getElementById(newID).value = \"OFF\"; \n                        newVal = \"OFF\"; \n                        document.getElementById(\"EV_ModeTimeT\").value = \"--:--\";\n                        input_post(\"EV_ModeTimeT\", 0);\n                    } \n                      \n                    input_post(\"EV_Mode\", newVal);\n                    document.getElementById(newID).style.color = \"blue\";\n                    document.getElementById(\"EV_ModeTimeT\").style.color = \"blue\";\n                    break;\n\n                case \"rgEV_MPA\":\n                    document.getElementById(\"EV_MPA\").value = newVal;\n                    input_post(\"EV_MPA\", newVal);\n                    break;\n\n                case \"rgEV_ModeTime\":\n                    document.getElementById(\"EV_ModeTime\").value = newVal;\n                    document.getElementById(\"EV_ModeTime\").style.color = \"blue\";\n                    input_post(\"EV_ModeTime\", newVal);\n                    break;\n\n                default:\n                \n            }    \n        }\n        function input_post(newID, newVal) {\n            fetch(\"/wpESPost\", {\n            method: \"POST\", \n            body: JSON.stringify({newID, newVal}),\n            headers: { \"Content-type\": \"application/json; charset=UTF-8\" } })\n            .then((response) => response.json())           \n        }\n        function formatDateTime(context) {\n            const d = new Date(context);\n            var ymdhm = moment(d).format('YYYY-MM-DD HH:mm');            \n            return ymdhm; \n        }\n        function formatTime(context) {\n            const d = new Date(context);\n            var hm = ('0' + (d.getHours())).slice(-2) + \":\" + ('0' + (d.getMinutes())).slice(-2);\n            return hm; \n        }\n\n        function formatP1LastFetch() {\n            document.getElementById(\"P1_LF\").value = formatDateTime({{global[file].P1LastFetch}});\n            if ('{{global[file].P1Status}}' == \"Success\" ) {\n                document.getElementById(\"P1_LF\").style.color  = \"black\";  \n                document.getElementById(\"P1_Sts\").style.color = \"black\";       \n            }\n            else {\n                document.getElementById(\"P1_LF\").style.color  = \"red\";\n                document.getElementById(\"P1_Sts\").style.color = \"red\";               \n            }\n            \n            //Gas\n            document.getElementById(\"P1_LFGas\").value = formatDateTime({{global[file].P1LastFetchGas}});            \n        }\n        \n        function formatELIALastFetch() {\n            document.getElementById(\"ELIA_LF\").value  = formatDateTime({{global[file].ELIALastFetch}});   \n            if ('{{global[file].ELIAStatus}}' == \"Success\" ) {\n                document.getElementById(\"ELIA_LF\").style.color  = \"black\";  \n                document.getElementById(\"ELIA_Sts\").style.color = \"black\";       \n            }\n            else {\n                document.getElementById(\"ELIA_LF\").style.color  = \"red\";\n                document.getElementById(\"ELIA_Sts\").style.color = \"red\";               \n            }\n\n            document.getElementById(\"SMARD_LF\").value = formatDateTime({{global[file].SMARDLastFetch}});  \n            if ('{{global[file].SMARDStatus}}' == \"Success\" ) {\n                document.getElementById(\"SMARD_LF\").style.color  = \"black\";  \n                document.getElementById(\"SMARD_Sts\").style.color = \"black\";       \n            }\n            else {\n                document.getElementById(\"SMARD_LF\").style.color  = \"red\";\n                document.getElementById(\"SMARD_Sts\").style.color = \"red\";               \n            }             \n        }\n\n        function formatSolCastLastFetch() { \n            document.getElementById(\"SOLCAST_LF\").value = formatDateTime({{global[file].SolCastLastFetch}});              \n            if ('{{global[file].SolCastStatus}}' == \"Success\" ) {\n                document.getElementById(\"SOLCAST_LF\").style.color  = \"black\";  \n                document.getElementById(\"SOLCAST_Sts\").style.color = \"black\";       \n            }\n            else {\n                document.getElementById(\"SOLCAST_LF\").style.color  = \"red\";\n                document.getElementById(\"SOLCAST_Sts\").style.color = \"red\";               \n            }\n        }\n\n        function formatEV_ModeTimeT() {\n            var gvlf = {{global[file].HC_08LastFetch}};    \n            document.getElementById(\"HC_08_LF\").value = formatDateTime(gvlf);  \n            var d  = new Date();  \n            var lf = new Date(gvlf);\n            lf.setHours(lf.getHours()+1*1);\n            if (lf < d) { document.getElementById(\"HC_08_LF\").style.color  = \"red\"; }\n            else        { document.getElementById(\"HC_08_LF\").style.color  = \"black\"; }\n\n            var gvhm = {{global[file].EV_ModeTimeT}};\n            if (gvhm == 0) {\n                document.getElementById(\"EV_ModeTimeT\").value = \"--:--\";     \n            }\n            else {\n                hm = new Date(gvhm);\n                hm = ('00' + hm.getHours()).slice(-2) + \":\" + ('00' + hm.getMinutes()).slice(-2); \n                document.getElementById(\"EV_ModeTimeT\").value = hm;    \n            }             \n        }\n\n    </script>\n</head>\n\n<body>\n    <div class=\"topnav\"> <h1>wp Energy & Services</h1> </div>\n\n    <p>Return ... : <a href=\"/wpHC\">Home Control</a></p>\n    <p>GoTo...... : <a href=\"/wsE\">ws Energy</a></p>    \n    \n    <! -------------------------------------------->\n    <h2>Technical Room</h2>\n    <b>HomeWizard P1 FLUVIUS</b>\n    <p>... : <a href=\"http://p1meter-090bb6.local/api\">Basic Information</a></p>\n        <input type=\"text\" id=\"P1_Version\"  name=\"P1_Version\"        size=\"6\" style=\"text-align:right\"  title=\"P1_Firmware\" value=\"{{global[file].P1FirmwareVersion}}\" readonly />\n            <label for=\"P1_Version\"> : Firmware Version</label><br>    \n    <p>... : <a href=\"http://192.168.0.143/api/v1/data\">Data</a></p>\n    <p>... : <a href=\"http://p1meter-090bb6.local/api/v1/telegram\">Telegram</a></p>\n    <p>... : <a href=\"http://192.168.0.143/api/v1/telegram\">Telegram (IP)</a></p>                     \n    \n    <form action=\"/#\">\n        <input type=\"text\" id=\"P1_LF\"  name=\"P1_LF\"                  size=\"12\" style=\"text-align:left\"  title=\"P1_LF\"  value=\"{{global[file].P1LastFetch}}\" readonly />\n            <label for=\"P1_LF\"> : Last Fetch</label><br>\n        <input type=\"text\" id=\"P1_Sts\" name=\"P1_Sts\"                 size=\"12\" style=\"text-align:left\"  title=\"P1_Sts\" value=\"{{global[file].P1Status}}\"    readonly />\n            <label for=\"P1_Sts\"> : Fetch Status</label><br>\n        <input type=\"text\" id=\"P1ActTariff\" name=\"P1ActTariff\"       size=\"6\" style=\"text-align: right\" value=\"{{global[file].P1_act_tariff}}\"    readonly />\n            <label for=\"P1ActTariff\"> : actual Tariff</label><br>          \n        <br>\n\n        <input type=\"text\" id=\"P1TotImport_t2\" name=\"P1TotImport_t2\" size=\"6\" style=\"text-align: right\" value=\"{{global[file].P1_tot_import_t2}}\" readonly />\n            <label for=\"P1TotImport_t2\"> : kWh total Import N</label><br>\n        <input type=\"text\" id=\"P1TotImport_t1\" name=\"P1TotImport_t1\" size=\"6\" style=\"text-align: right\" value=\"{{global[file].P1_tot_import_t1}}\" readonly />\n            <label for=\"P1TotImport_t1\"> : kWh total Import D</label><br>\n        <input type=\"text\" id=\"P1TotImport\" name=\"P1TotImport\"       size=\"6\" style=\"text-align: right\" value=\"{{global[file].P1_tot_import}}\" readonly />\n            <label for=\"P1TotImport\"> : kWh total Import</label><br>\n        <input type=\"text\" id=\"P1TotExport\" name=\"P1TotExport\"       size=\"6\" style=\"text-align: right\" value=\"{{global[file].P1_tot_export}}\" readonly />\n            <label for=\"P1TotExport\"> : kWh total Export</label><br>\n        <br>\n        \n        <input type=\"text\" id=\"P1_LFGas\" name=\"P1_LFGas\"             size=\"12\" style=\"text-align:left\"  title=\"P1_LFGas\"  value=\"{{global[file].P1LastFetchGas}}\" readonly />\n            <label for=\"P1_LFGas\"> : Last Fetch</label><br>\n        <input type=\"text\" id=\"P1TotGas\" name=\"P1TotGas\"             size=\"6\" style=\"text-align: right\" value=\"{{global[file].P1_tot_gas}}\"    readonly />\n            <label for=\"P1TotGas\"> : M3 total Gas</label><br>     \n    </form><br>\n\n    <h2>Services</h2>\n    <b>Day Ahead</b><br>\n        <h3>ELIA</h3>\n        <input type=\"text\" id=\"ELIA_LF\"  name=\"ELIA_LF\"              size=\"12\" style=\"text-align:left\"  title=\"ELIA_LF\"  value=\"{{global[file].ELIALastFetch}}\" readonly />\n            <label for=\"ELIA_LF\"> : Last Fetch</label><br>\n        <input type=\"text\" id=\"ELIA_Sts\" name=\"ELIA_Sts\"             size=\"12\" style=\"text-align:left\"  title=\"ELIA_Sts\" value=\"{{global[file].ELIAStatus}}\"    readonly />\n            <label for=\"ELIA_Sts\"> : Fetch Status</label>\n        <br> \n        <h3>SMARD</h3>\n        <input type=\"text\" id=\"SMARD_LF\"  name=\"SMARD_LF\"            size=\"12\" style=\"text-align:left\"  title=\"SMARD_LF\"  value=\"{{global[file].SMARDLastFetch}}\" readonly />\n            <label for=\"SMARD_LF\"> : Last Fetch</label><br>\n        <input type=\"text\" id=\"SMARD_Sts\" name=\"SMARD_Sts\"           size=\"12\" style=\"text-align:left\"  title=\"SMARD_Sts\" value=\"{{global[file].SMARDStatus}}\"    readonly />\n            <label for=\"SMARD_Sts\"> : Fetch Status</label>\n        <br> \n\n        <p>... : <a href=\"/wpDA\">wp Day Ahead Prices</a></p>\n        <p>... : <a href=\"https://www.elia.be/nl/grid-data/transmissie/day-ahead-referentieprijs\">http://ELIA Day-ahead prices </a></p> \n        <br>\n\n    <b>Meteo</b><br>\n        <p>... : <a href=\"/wpKMI\">wp KMI Weer waarnemingen</a></p>\n        <p>... : <a href=\"https://www.meteobelgie.be/weerbericht-belgie/uur-per-uur/3590/diepenbeek\">http://MeteoBelgie - Weer per uur</a></p>\n        <p>... : <a href=\"https://www.meteo.be/nl/weer/waarnemingen/neerslagradar/bliksem\">http://KMI Forecast</a></p>        \n        <p>... : <a href=\"https://www.buienradar.be/weer/diepenbeek/be/2799412\">http://Buienradar Forecast</a></p>        \n        <br>\n\n    <b>Solar Forecasts </b><br>\n    <h3>ELIA</h3>\n        <p>... : <a href=\"https://www.elia.be/nl/grid-data/productie-gegevens/zonne-energieproductie\">https://Zonne-energieproductie</a></p> \n\n    <h3>SOLCAST </h3>\n        <p>... : <a href=\"https://toolkit.solcast.com.au/home-pv-system/xxxxxxxx/detail\">http://Live and Forecasts</a></p>\n        <p>... : <a href=\"/wpSC\">wp SolCast Data</a></p>\n\n        <input type=\"text\" id=\"SOLCAST_LF\" name=\"SOLCAST_LF\"         size=\"12\" style=\"text-align:left\"  title=\"SOLCAST_LF\"    value \"{{global[file].SolCastLastFetch}}\" readonly />\n            <label for=\"SOLCAST_LF\"> : Last Fetch</label><br>\n        <input type=\"text\" id=\"SOLCAST_Sts\" name=\"SOLCAST_Sts\"       size=\"12\" style=\"text-align:left\"  title=\"SOLCAST_Sts\"   value=\"{{global[file].SolCastStatus}}\"    readonly />\n            <label for=\"SOLCAST_Sts\"> : Fetch Status</label><br>\n        <input type=\"text\" id=\"SOLCAST_OLact\" name=\"SOLCAST_OLact\"   size=\"6\"  style=\"text-align:right\" title=\"SOLCAST_OLact\" value=\"{{global[file].SolCast_ol_D1act}}\" readonly />\n            <label for=\"SOLCAST_OLact\"> : kW actual Outlook</label><br>\n        <input type=\"text\" id=\"SOLCAST_OLrem\" name=\"SOLCAST_OLrem\"   size=\"6\"  style=\"text-align:right\" title=\"SOLCAST_OLrem\" value=\"{{global[file].SolCast_ol_D1rem}}\" readonly />\n            <label for=\"SOLCAST_OLrem\"> : kWh remaining Outlook</label><br>\n        <input type=\"text\" id=\"SOLCAST_FCD1\" name=\"SOLCAST_FCD1\"     size=\"6\"  style=\"text-align:right\" title=\"SOLCAST_FCD1\"  value=\"{{global[file].SolCast_fc_D1}}\"   readonly />\n            <label for=\"SOLCAST_FCD1\"> : kWh Forecast D1</label><br>\n        <input type=\"text\" id=\"SOLCAST_FCD2\" name=\"SOLCAST_FCD2 \"    size=\"6\"  style=\"text-align:right\" title=\"SOLCAST_FCD2\"  value=\"{{global[file].SolCast_fc_D2}}\"   readonly />\n            <label for=\"SOLCAST_FCD2\"> : kWh Forecast D2 </label><br>      \n        <input type=\"text\" id=\"SOLCAST_FCD3\" name=\"SOLCAST_FCD3 \"    size=\"6\"  style=\"text-align:right\" title=\"SOLCAST_FCD3\"  value=\"{{global[file].SolCast_fc_D3}}\"   readonly />\n            <label for=\"SOLCAST_FCD3\"> : kWh Forecast D3 </label><br> \n\n    <! -------------------------------------------->   \n    <h2>Garage</h2>\n    <b>EV 08_ESP32</b><br>\n        <input type=\"text\" id=\"HC_08_LF\" name=\"HC_08_LF\"                    size=\"12\" style=\"text-align:left\"  title=\"HC_08_LF\"          value \"{{global[file].HC_08LastFetch}}\" readonly />\n            <label for=\"HC_08_LF\"> : Last Fetch</label><br>\n        <input type=\"text\" id=\"EV_SDM_actA\" name=\"EV_SDM_actA\"              size=\"6\" style=\"text-align: right\" title=\"EV_SDM_actA\"       value=\"{{global[file].EV_act_current}}\" readonly />\n            <label for=\"EV_SDM_actA\"> : A actual Current</label><br>\n        <input type=\"text\" id=\"EV_SDM_actW\" name=\"EV_SDM_actW\"              size=\"6\" style=\"text-align: right\" title=\"EV_SDM_actW\"       value=\"{{global[file].EV_act_power}}\"   readonly />\n            <label for=\"EV_SDM_actW\"> : W actual Power</label><br>\n        <input type=\"text\" id=\"EV_SDM_actV\" name=\"EV_SDM_actV\"              size=\"6\" style=\"text-align: right\" title=\"EV_SDM_actV\"       value=\"{{global[file].EV_act_voltage}}\" readonly />\n            <label for=\"EV_SDM_actV\"> : V actual Voltage</label><br>\n         <input type=\"text\" id=\"EV_SDM_YTDconsump\" name=\"EV_SDM_YTDconsump\" size=\"6\" style=\"text-align: right\" title=\"EV_SDM_YTDconsump\" value=\"{{global[file].EV_tot_energy}}\"  readonly />\n            <label for=\"EV_SDM_YTDconsump\"> : kWh total Energy</label><br>\n        <br>\n\n        <input type=\"text\"   id=\"EV_Mode\" name=\"EV_Mode\" size=\"4\" style=\"text-align: right\" title=\"EV_Mode\"   value=\"{{global[file].EV_Mode}}\" readonly />\n            <label for=\"EV_Mode\"> : Auto/OFF/Ext EV....... </label>\n        <input type=\"submit\" id=\"EV_Mode.update\" \n            onclick=\"input_update('EV_Mode', EV_Mode.value)\" value =\"Toggle\" /><br>\n\n        <input type=\"range\" id=\"rgEV_MPA\" name=\"rgEV_MPA\" min=\"500\" max=\"1000\" step=\"100\" value=\"{{global[file].EV_MPA }}\"\n            onchange=\"input_update('rgEV_MPA',this.value)\"> <br>\n        <input type=\"text\" id=\"EV_MPA\"   name=\"EV_MPA\"   size=\"4\" style=\"text-align: right\" title=\"EV_MPA\"     value=\"{{global[file].EV_MPA}}\"  readonly />\n            <label for=\"EV_MPA\"> :           on Auto...min Inj.-W req.</label><br>              \n        <br> \n\n        <input type=\"range\" id=\"rgEV_ModeTime\" name=\"rgEV_ModeTime\" min=\"1\" max=\"8\" step=\"1\" value=\"{{global[file].EV_ModeTime}}\" \n            onchange=\"input_update('rgEV_ModeTime',this.value)\"> <br>       \n        <input type=\"text\" id=\"EV_ModeTime\"                    size=\"4\" style=\"text-align: right\" title=\"EV_ModeTime\" value=\"{{global[file].EV_ModeTime}}\" readonly />\n            <label for=\"EV_ModeTime\"> : Hr(s) of extension</label><br>\n        <input type=\"text\" id=\"EV_ModeTimeT\" name=\"EV_ModeTimeT\" size=\"4\" style=\"text-align: right\" title=\"EV_ModeTimeT\" value=\"{{global[file].EV_ModeTimeT}}\" readonly />\n            <label for=\"EV_ModeTimeT\"> :           on Auto/Ext........ extended till</label><br>     \n        <br>\n\n</body>\n</html>",
        "output": "str",
        "x": 762.9332885742188,
        "y": 337.9333190917969,
        "wires": [
            [
                "8c6fdfbbfb4c5e14"
            ]
        ]
    },
    {
        "id": "8c6fdfbbfb4c5e14",
        "type": "http response",
        "z": "6d0b25e93ef1be89",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 982.9332885742188,
        "y": 337.9333190917969,
        "wires": []
    },
    {
        "id": "9ef298024a527257",
        "type": "comment",
        "z": "6d0b25e93ef1be89",
        "name": "Energy & Services",
        "info": "",
        "x": 602.9332885742188,
        "y": 317.9333190917969,
        "wires": []
    }
]

Ok...

So you are saying:

<!-- This link works -->
<a href="http://192.168.0.143/api/v1/telegram">Telegram (IP)</a></p>   
<!-- This link DOES NOT -->
<a href="http://p1meter-090bb6.local/api/v1/telegram">Telegram</a></p>

If that is the case, I think this is what ever device is handling that request - It's nothing to do with Node RED - the error your describe (Header fields are too long), seems like the device (whatever this is) is extremely strict on Request length.

The URI - makes up the total length

http referer -will also have an impact on this length limit

What are you trying to accomplish as you don't seem to make a request to the api here ?

1 Like

Ohh I missed that :smiley: (it's just a GET) - with no body

indeed, this is a web page.. say to debug.
There is also the scheduler that get & store the data :


And the "http request node" works also fine with the DeviceName-URL.

[
    {
        "id": "274464c5c274a09f",
        "type": "debug",
        "z": "f37cd7c9ed481cbb",
        "name": "P1 Data 1 s",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 160,
        "wires": []
    },
    {
        "id": "54b7fefc96d6abae",
        "type": "inject",
        "z": "f37cd7c9ed481cbb",
        "name": "1 s",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 90,
        "y": 180,
        "wires": [
            [
                "ce577c401c9f8570"
            ]
        ]
    },
    {
        "id": "9d547b75257c497e",
        "type": "function",
        "z": "f37cd7c9ed481cbb",
        "name": "extract Act",
        "func": "var pl = msg.payload;\n\nvar obj = pl.active_tariff;\nif (obj = 1) { global.set(\"P1_act_tariff\", \"D\", \"file\"); }\nelse         { global.set(\"P1_act_tariff\", \"N\", \"file\"); }\n\n// ACTIVE POWER W\nvar actPowerSmth = global.get(\"P1_act_powerSmth\", \"file\") ;\nvar obj = pl.active_power_w;\nvar objSmth  = Math.round((actPowerSmth * .75) + (obj * .25));\nglobal.set(\"P1_act_power\",     obj,     \"file\");\nglobal.set(\"P1_act_powerSmth\", objSmth, \"file\");\n\n// ACTIVE CURRENT L1 A\nvar obj = pl.active_current_l1_a;\nglobal.set(\"P1_act_current\", obj, \"file\");\n\n// ACTIVE VOLTAGE L1 V\nvar obj = pl.active_voltage_l1_v;\nglobal.set(\"P1_act_voltage\", obj, \"file\");\n\n// ACTIVE Monthly POWER PEAK W\nvar obj = pl.montly_power_peak_w;\nglobal.set(\"P1_mth_powerpeak\", obj, \"file\");\n\nreturn null;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 970,
        "y": 160,
        "wires": [
            [
                "274464c5c274a09f"
            ]
        ]
    },
    {
        "id": "edecbb5ccf7917e4",
        "type": "rbe",
        "z": "f37cd7c9ed481cbb",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "property": "payload",
        "x": 310,
        "y": 240,
        "wires": [
            [
                "ae82c6f686a174ed"
            ]
        ]
    },
    {
        "id": "ae82c6f686a174ed",
        "type": "http request",
        "z": "f37cd7c9ed481cbb",
        "name": "Data",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "body",
        "url": "http://p1meter-090bb6.local/api/v1/data",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 450,
        "y": 240,
        "wires": [
            [
                "44f168240a7538b1"
            ]
        ]
    },
    {
        "id": "1cbfbb7d9f5117d2",
        "type": "switch",
        "z": "f37cd7c9ed481cbb",
        "name": "Check Sts",
        "property": "statusCode",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "200",
                "vt": "num"
            },
            {
                "t": "neq",
                "v": "200",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 590,
        "y": 180,
        "wires": [
            [
                "e5bba4096ad71cb5"
            ],
            [
                "6810994ee7ee99b9"
            ]
        ]
    },
    {
        "id": "6810994ee7ee99b9",
        "type": "change",
        "z": "f37cd7c9ed481cbb",
        "name": "Status NOK",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::P1Status",
                "pt": "global",
                "to": "payload.response_status.error_code",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 200,
        "wires": [
            [
                "d8541562c276a83a"
            ]
        ]
    },
    {
        "id": "e5bba4096ad71cb5",
        "type": "change",
        "z": "f37cd7c9ed481cbb",
        "name": "Status OK",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::P1Status",
                "pt": "global",
                "to": "Success",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "#:(file)::P1LastFetch",
                "pt": "global",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 160,
        "wires": [
            [
                "9d547b75257c497e"
            ]
        ]
    },
    {
        "id": "367d81e471cdbc4a",
        "type": "inject",
        "z": "f37cd7c9ed481cbb",
        "name": "5 min",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "300",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 90,
        "y": 240,
        "wires": [
            [
                "edecbb5ccf7917e4"
            ]
        ]
    },
    {
        "id": "ce577c401c9f8570",
        "type": "http request",
        "z": "f37cd7c9ed481cbb",
        "name": "Data",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "body",
        "url": "http://p1meter-090bb6.local/api/v1/data",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 450,
        "y": 180,
        "wires": [
            [
                "1cbfbb7d9f5117d2"
            ]
        ]
    },
    {
        "id": "44f168240a7538b1",
        "type": "function",
        "z": "f37cd7c9ed481cbb",
        "name": "exact YTD",
        "func": "var pl = msg.payload;\n\nvar obj = pl.total_power_import_t1_kwh;   // IMPORT kWh D\nglobal.set(\"P1_tot_import_t1\", obj, \"file\");\nvar obj = pl.total_power_import_t2_kwh;   // IMPORT kWh N\nglobal.set(\"P1_tot_import_t2\", obj, \"file\");\nvar obj = pl.total_power_import_kwh;      // IMPORT kWh\nglobal.set(\"P1_tot_import\", obj, \"file\");\nvar obj = pl.total_power_export_kwh;      // EXPORT kWh\nglobal.set(\"P1_tot_export\", obj, \"file\");\n\nvar obj = pl.external[0].timestamp;       // Gas \nvar y = 2000 + parseInt(obj.toString().substring(0, 2));\nvar m = parseInt(obj.toString().substring(2, 4)) - 1;\nvar d = parseInt(obj.toString().substring(4, 6));\nvar h = parseInt(obj.toString().substring(6, 8));\nvar n = parseInt(obj.toString().substring(8, 10));\nvar date = new Date(y, m, d, h, n);\nvar ts = date.getTime();\nglobal.set(\"P1LastFetchGas\", ts, \"file\");\nvar obj = pl.external[0].value;\nglobal.set(\"P1_tot_gas\", obj, \"file\");      // M3\n\nreturn null;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 970,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "f323f0b8c32013e2",
        "type": "comment",
        "z": "f37cd7c9ed481cbb",
        "name": "TAB Scheduler :  every hour the total kWh are stored in dB as kWh/Hr",
        "info": "",
        "x": 360,
        "y": 280,
        "wires": []
    },
    {
        "id": "d8541562c276a83a",
        "type": "debug",
        "z": "f37cd7c9ed481cbb",
        "name": "P1 nok",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1120,
        "y": 200,
        "wires": []
    }
]

So it works (hostname) with

  • Direct navigate within Browser (No link)
  • HTTP Request Node

if, so - I still say there is every strict limit on the Request Header length at the device

Examples:
referer + host headers : 20 bytes (lets day)
host headers : 5 byes (lets day)

referer is a header of the Url that you was on, before navigating.

So your Node RED referer header (http://x.x.x.x:1880//wpES) + host header (p1meter-090bb6.local)

Does seem like its pushing the allowed limit (based on Header fields are too long)

Not sure what else I can see

You may be able to work around the issue.

Try setting the A href to a node-red get endpoint, collect the page with a http request node and feed that into the response node.

1 Like

Disgraceful @E1cid :joy: - but yes, indeed a solution

hmmm... disgraceful... while i like "elegant"... but still have a long way to go.
Fortunately the case is only an issue when TELENET changes the IP. Power loss should not be the reason as there is an EPS-functionality provided by the PV/BatteryManagementSystem.

I just learned that it is possible to pass the formatted mac with "arp -a/grep/awk" to the exec-node, and work with the returned ip.

Rather than setting a fixed IP in the router, can you set it in the device itself?

Alternatively, is there not an alternative ISP that gives you control of the network?

like i do with my RPI, ESP32,... ?
no, not that i am aware of. Which is strange as the device is ESP32 based.

Yeah, probably there are alternative ISP that give that control, but i have other services running with that ISP... that makes it hard to switch.
An private router is an alternative, but i try to set up the hardware as lean as possible.

I'll give the arp a try.

arp works to get the IP

Thanks for support.
T