BiancoRoyal / node-red-contrib-iiot-opcua

deprecated - very new developed by PLUS for Node-RED - https://plus4nodered.com
https://www.npmjs.com/package/node-red-contrib-iiot-opcua
BSD 3-Clause "New" or "Revised" License
34 stars 9 forks source link

History Read improvements #54

Closed csmale closed 6 years ago

csmale commented 6 years ago

Hi, Please excuse any form errors - I'm new here and new to OPC UA!

In opcua-iiot-read.js the code which handles a history-read request, starting from "case 130:" at line 88, apparently tries to set the "history start" to "yesterday" - at least that is my guess. However the calculation of node.historyStart produces a value which represents a few milliseconds after the epoch, so the request is basically "give me all the data since the beginning of time" which causes our server and the 4G connection to glow red hot for a while and then explode...

        case 130:
          let historyDate = new Date()
          node.historyStart = new Date(historyDate.getDate() - 1)
          node.historyEnd = historyDate

I have "hacked" a temporary solution into my installation which now gives all the data from the past 24 hours (this is good enough for my current use case):

                    case 130:
                        var o = new Date;
                        var o2 = new Date;
                        o2.setDate(o2.getDate()-1);

It doesn't look like there is any way at all of influencing the start/end timestamps in the current version. A quick fix might be to use the "Max Age" parameter to create the historyEnd value.

I hope you can do something with this input. I'm sorry I don't feel confident to push the fix up to you myself, but I am still learning this game...

Kind Regards, Colin

biancode commented 6 years ago
grafik

... next version get this

biancode commented 6 years ago

and it becomes possible to control the start and end of the history points via msg objects

csmale commented 6 years ago

Klaus, that sounds wonderful, thank you so much! I look forward to the new version.

biancode commented 6 years ago

comes with v3.0.0