Ankündigung

Einklappen
Keine Ankündigung bisher.

KNX node for node-red

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Hi,
    the formatting works Only for telegram sent from the bus to the flow, not vice versa.
    i suggest you to put a simple function node with a multiplicator/divider in front of the knx-ultimate node, to transform the fritz payload.
    If you need me to do that, please paste your flow here. Thanks.

    Kommentar


      TheMax74
      Ok, good to know that it's working only KNX => Flow not the other way round.

      I surely can add the multipication as a function, but I am currently thinking about changing the DPT to 14.056 as I don't like to handle so small values (also later in KNX)... I don't understand, why there is no DPT for Watt with only 2 Byte length...

      Kommentar


        Hello TheMax74,

        many thanks for this awesome node.


        Zitat von TheMax74 Beitrag anzeigen
        no, sorry. You need to live with that :-)
        Setting the right datapoint is essential in any installation. Yes, this is a bit annoying, but indispensable.
        I'm sending floating point values from the smartmeter node to the bus and there is no valid datapoint for "kWh". Therefore I set DPT14 in ETS.
        Yes, I'm aware of 13.013 but that's an integer. And 29.010 is Wh. I do not want to multiply with 1000 and later divide by 1000 in the VISU. That seems ridiculous to me ;-).
        BTW: 29.x is missing in the Datapoint dropdown.


        Please take a look here: KNX - Group Addresses & Datapoint Types

        Group Object 'configuration'

        As such a Datapoint Type is a defined as being part of the Group Object configuration.

        HOWEVER, the actual Datapoint Type information:
        • is not stored in device memory
        • is never included in a telegram
        • is only stored in the ETS project

        Datapoint Types are especially important for diagnostics, i.e. to enable ETS monitor interpreting data associated with Group Objects, e.g. instead of 'data = 85 A8', 'data = -6 °C' is shown.
        The subtype is just to display the unit in the group monitor. If there is no matching unit you will set the base type. I do not want to set 14.001 and then see my smartmeter count as an "angular acceleration" with "61234,567 rad/s²" ;-)

        There are more missing units in ETS, e.g. Becquerel (Bq) (I don't need that, but it was the first thing that came to my mind to search for a data type that might be missing)....

        BTW: All datapoint definitions for the supported languages are in "c:\Program Files (x86)\ETS5\knx_master.xml"


        regards
        Carsten
        Gruß, Carsten

        Kommentar


          Hello Carsten
          yes, there are tons of datapoints that aren't taken under consideration and needs to be added step by step, when necessary.
          Which datapoint do you precisely need?

          Kommentar


            And now for something completly different:

            At first I was wondering how to send multiple telegrams with different group addresses and values to one KNXU-Node at once. I found the "Messages to the node" article in the wiki, but that is for single messages only.

            I want to implement a "Leaving home" function and this is my solution (proof of concept, ATM):

            NodeRed_LeavingHome.png
            The function code:
            Code:
            var messages = [
                     {destination: "1/0/20", payload: 1, event: "GroupValue_Write", dpt: "1.001"},
                     {destination: "1/0/20", payload: 0, event: "GroupValue_Write", dpt: "1.001"},
                ];
            var i;
            if (msg.payload === true) {
                i = 0;
            } else if (msg.payload >=0 && msg.payload < messages.length) {
                i = msg.payload;
            } else {
                return
            }
            
            return [
                        messages[i] ,
                        {payload: i + 1}
                    ];
            The function starts with an incoming TRUE and then sends the first the array element to the first output and the next array index to the second output which will be delayed for 500msec. So will every array element be send to the KNX node without flooding the bus.


            Flow without the KNX-Node (as it would be 70kb of data containing all GAs...)
            Code:
            [{"id":"b6fe6959.a178b8","type":"tab","label":"KNX dev","disabled":false,"info":""},{"id":"eef36dc0.94cdb","type":"inject","z":"b6fe6959.a178b8","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":90,"wires":[["2cd158ce.244658"]]},{"id":"2cd158ce.244658","type":"function","z":"b6fe6959.a178b8","name":"Leaving Home","func":"var messages = [\n         {destination: \"1/0/20\", payload: 1, event: \"GroupValue_Write\", dpt: \"1.001\"},\n         {destination: \"1/0/20\", payload: 0, event: \"GroupValue_Write\", dpt: \"1.001\"},\n    ];\nvar i;\nif (msg.payload === true) {\n    i = 0;\n} else if (msg.payload >=0 && msg.payload < messages.length) {\n    i = msg.payload;\n} else {\n    return\n}\n\nreturn [\n            messages[i] ,\n            {payload: i + 1}\n        ];","outputs":2,"noerr":0,"x":340,"y":90,"wires":[["295b3f96.b6bd8"],["b101eb2b.f0df5","9c3b7f04.435b08"]]},{"id":"9c3b7f04.435b08","type":"delay","z":"b6fe6959.a178b8","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":340,"y":160,"wires":[["2cd158ce.244658"]]},{"id":"295b3f96.b6bd8","type":"debug","z":"b6fe6959.a178b8","name":"LH1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":620,"y":130,"wires":[]},{"id":"b101eb2b.f0df5","type":"debug","z":"b6fe6959.a178b8","name":"LH2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":620,"y":170,"wires":[]}]

            Maybe this is usefull for some other users.

            BTW: I'm using Node-Red since a month or so. If there are better, already existing or even built-in solutions: give me a hint :-)

            Maybe this also works with the nodes "file in" and "csv". The file can be changed without modifying the flow... I will try that later.


            regards
            Carsten
            Gruß, Carsten

            Kommentar


              ..and last but not least, i wish to add some helper for VISU, directly in the knx-ultimate node.
              Can you paste here parts of your relevant flow, where you use knx-ultimate with a VISU, so i can see what do you rellay do and what do you maybe really need, apart from datapoints? What VISU do you use?
              Thanks.

              Kommentar


                Zitat von Northman Beitrag anzeigen
                And now for something completly different:

                At first I was wondering how to send multiple telegrams with different group addresses and values to one KNXU-Node at once. I found the "Messages to the node" article in the wiki, but that is for single messages only.

                I want to implement a "Leaving home" function and this is my solution (proof of concept, ATM):

                NodeRed_LeavingHome.png
                The function code:
                Code:
                var messages = [
                {destination: "1/0/20", payload: 1, event: "GroupValue_Write", dpt: "1.001"},
                {destination: "1/0/20", payload: 0, event: "GroupValue_Write", dpt: "1.001"},
                ];
                var i;
                if (msg.payload === true) {
                i = 0;
                } else if (msg.payload >=0 && msg.payload < messages.length) {
                i = msg.payload;
                } else {
                return
                }
                
                return [
                messages[i] ,
                {payload: i + 1}
                ];
                The function starts with an incoming TRUE and then sends the first the array element to the first output and the next array index to the second output which will be delayed for 500msec. So will every array element be send to the KNX node without flooding the bus.
                Thanks.
                For your reference, you can directly return an array of messages.
                You can see how, here https://nodered.org/docs/user-guide/writing-functions
                This is a matter of javascript, not of knx-ultimate or other nodes.
                You'll find out, that node-red will be your definitive choice for logic programming!

                Kommentar


                  Hello
                  Zitat von TheMax74 Beitrag anzeigen
                  Hello Carsten
                  yes, there are tons of datapoints that aren't taken under consideration and needs to be added step by step, when necessary.
                  Which datapoint do you precisely need?
                  I'm not really missing some datapoints. I just recognized the missing 29.x as I tried that in KNX-Ultimate.

                  Today I was curious where the ETS stores the datapoint names and found the XML. That should be a good base to create the ...\dptlib\dptX.js files via script. I will check that later (in days) and try to provide you the js-files with all datapoint definitions. Maybe even in different languages. But I have to check the XML first.


                  Zitat von TheMax74 Beitrag anzeigen
                  ..and last but not least, i wish to add some helper for VISU, directly in the knx-ultimate node.
                  Can you paste here parts of your relevant flow, where you use knx-ultimate with a VISU, so i can see what do you rellay do and what do you maybe really need, apart from datapoints? What VISU do you use?
                  I'm using Cometvisu. For now the smartmeter values are not in the visu. I'm glad to see them on the bus.
                  I also write the actual power consumption to an InfluxDB (and the counter values at midnight -> Grafana -> kwh per day).
                  The values are also in a node-red dashboard as PoC.

                  I receive a notification in Telegram if the actual consumption of the heatpump is above 4000W.

                  I'm totally fine with the current state of KNX-Ultimate. I get my values on the bus in a format that the visu can display. Cometvisu has options to manipulate or transform values.
                  But the visu has a low priority for me at the moment.

                  What kind of helpers are you thinking of?


                  Here is one part of the flow (I removed the GA import, work in progress & proof of concept...):
                  Code:
                  [{"id":"922b3422.5cd548","type":"smartmeter","z":"82410013.cd18a8","name":"StromNormal","datasource":"6243c89c.1ee54","protocol":"SmlProtocol","transport":"SerialResponseTransport","requestInterval":"5","d0WakeupCharacter":"","x":80,"y":600,"wires":[["c118e04.8103ba"]]},{"id":"c118e04.8103ba","type":"function","z":"82410013.cd18a8","name":"SplitStromNormal","func":"var Zaehler  = msg.payload[\"1-0:1.8.0*255\" ].values[0].value; // Zählerstand\nvar Leistung = msg.payload[\"1-0:15.7.0*255\"].values[0].value; // Leistung\nflow.set(\"StromNormalZaehler\" , Zaehler);\nflow.set(\"StromNormalLeistung\", Leistung);\n\nreturn [\n        {payload: Zaehler},\n        {payload: Leistung}\n];","outputs":2,"noerr":0,"x":140,"y":670,"wires":[["f8f23c51.41c768","f64f2480.91b14","cb02518b.8966f","d70dd7ce.46c51"],["7dc87e4f.c3c258","2c03e8ad.fcf25","daab4ae4.4b8fd8","a8b27449.da0c1","16e35c39.ee75c4"]],"inputLabels":["SML"],"outputLabels":["Zähler","Leistung"]},{"id":"8a0039ee.baa318","type":"influxdb batch","z":"82410013.cd18a8","influxdb":"77568d23.b9b9e4","precision":"","retentionPolicy":"","name":"InfluxStromNormal","x":670,"y":660,"wires":[]},{"id":"7dc87e4f.c3c258","type":"ui_text","z":"82410013.cd18a8","group":"eeb36db4.f6d23","order":2,"width":0,"height":0,"name":"Strom Normal Leistung","label":"Normal Leistung","format":"{{msg.payload | number:1}} W","layout":"row-spread","x":420,"y":720,"wires":[]},{"id":"f8f23c51.41c768","type":"ui_text","z":"82410013.cd18a8","group":"eeb36db4.f6d23","order":1,"width":0,"height":0,"name":"Strom Normal Zähler","label":"Zähler","format":"{{msg.payload | number:2}} kWh","layout":"row-spread","x":420,"y":620,"wires":[]},{"id":"2c03e8ad.fcf25","type":"ui_chart","z":"82410013.cd18a8","name":"Chart Strom Normal Leistung","group":"eeb36db4.f6d23","order":3,"width":0,"height":0,"label":"Leistung","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"4000","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":440,"y":760,"wires":[[]]},{"id":"daab4ae4.4b8fd8","type":"ui_chart","z":"82410013.cd18a8","name":"Chart Strom Normal Leistung 24h","group":"7d131907.560c8","order":3,"width":"24","height":"6","label":"Normal","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"4000","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":460,"y":800,"wires":[[]]},{"id":"f64f2480.91b14","type":"function","z":"82410013.cd18a8","name":"Strom Normal to Influx","func":"var Zaehler  = flow.get(\"StromNormalZaehler\");\nvar Leistung = flow.get(\"StromNormalLeistung\");\nvar timestamp = new Date()\nreturn [{payload: [\n            {\n                measurement: \"Normal\",\n                fields: {\n                    Zaehler: Zaehler,\n                    Leistung: Leistung\n                },\n                timestamp: timestamp\n            },\n        ]\n    }\n];\n\n","outputs":1,"noerr":0,"x":420,"y":660,"wires":[["8a0039ee.baa318"]]},{"id":"cb02518b.8966f","type":"knxUltimate","z":"82410013.cd18a8","server":"7fe9eb23.568cac","topic":"14/3/1","outputtopic":"","dpt":"14.007","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":false,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"KNX Strom Normal Zähler","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":"1","formatnegativevalue":"leave","formatdecimalsvalue":999,"x":450,"y":560,"wires":[[]]},{"id":"16e35c39.ee75c4","type":"debug","z":"82410013.cd18a8","name":"dbgNormal","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":390,"y":900,"wires":[]},{"id":"d70dd7ce.46c51","type":"debug","z":"82410013.cd18a8","name":"dpgNormalZähler","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":410,"y":500,"wires":[]},{"id":"a8b27449.da0c1","type":"knxUltimate","z":"82410013.cd18a8","server":"7fe9eb23.568cac","topic":"14/3/0","outputtopic":"","dpt":"14.007","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"KNX Strom Normal Leistung","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"x":460,"y":840,"wires":[[]]},{"id":"6243c89c.1ee54","type":"smartmeter-connection","z":"","sourcetype":"serial","serialport":"/dev/stromzaehler_normal","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","httphost":"localhost","httpport":"80","filepath":"/dev/null"},{"id":"77568d23.b9b9e4","type":"influxdb","z":"","hostname":"influxdb","port":"8086","protocol":"http","database":"Strom","name":"","usetls":false,"tls":""},{"id":"eeb36db4.f6d23","type":"ui_group","z":"","name":"Normal","tab":"d775d24f.fba5e","disp":true,"width":"10","collapse":false},{"id":"7d131907.560c8","type":"ui_group","z":"","name":"Strom 24h","tab":"33545db.d7614a2","disp":true,"width":"24","collapse":false},{"id":"7fe9eb23.568cac","type":"knxUltimate-config","z":"","host":"172.0.0.0","port":"3671","physAddr":"1.1.241","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false,"stopETSImportIfNoDatapoint":"skip","loglevel":"error","name":"Raspi4","localEchoInTunneling":false},{"id":"d775d24f.fba5e","type":"ui_tab","z":"","name":"Strom","icon":"","disabled":false,"hidden":false},{"id":"33545db.d7614a2","type":"ui_tab","z":"","name":"Strom 24h","icon":"dashboard","disabled":false,"hidden":false}]

                  regards
                  Carsten
                  Gruß, Carsten

                  Kommentar


                    Hi Carsten
                    i have all dpts on pdf, but the real challenge is to decode the value given a datapoint.
                    The enhancement whould be, for example, set a text output based on the payload. For example, if payload is true, the output text should be “Eingeschaltet”. So you can use the knx-ultimate without any further change. But i’m still thinking if it’s useful or not.

                    Kommentar


                      Zitat von TheMax74 Beitrag anzeigen
                      For your reference, you can directly return an array of messages.
                      You can see how, here https://nodered.org/docs/user-guide/writing-functions
                      This is a matter of javascript, not of knx-ultimate or other nodes.
                      I know that, but does your node can handle the array? It's not the documentation (at least not in "4.-Messages-to-the-node").
                      Or is that a basic concept of Node-Red that I'm not aware of, yet?


                      You'll find out, that node-red will be your definitive choice for logic programming!
                      That's wrong. I will not, I already have ;-)

                      The only thing, that really annoys me is the clipboard issue with Firefox. He copies only the first TWO lines of marked code. I have to use another browser to copy longer scripts....
                      Gruß, Carsten

                      Kommentar


                        Hi Carsten
                        When you return an array in such way, the function node doesn’t output an array of messages, instead it outputs each message in the array.

                        Kommentar


                          Zitat von TheMax74 Beitrag anzeigen
                          i have all dpts on pdf, but the real challenge is to decode the value given a datapoint.
                          The enhancement whould be, for example, set a text output based on the payload. For example, if payload is true, the output text should be “Eingeschaltet”. So you can use the knx-ultimate without any further change. But i’m still thinking if it’s useful or not.
                          dpt14.js
                          Code:
                          // DPT14 subtypes info
                          exports.subtypes = {
                            // TODO
                            "007" : {
                              "name" : "DPT_Value_AngleDeg°",
                              "desc" : "angle, degree",
                              "unit" : "°"
                            },
                            "019" : {
                              "name" : "DPT_Value_Electric_Current",
                              "desc" : "electric current",
                              "unit" : "A"
                            },
                          The ETS file contains nearly the same plus all the other definitions:
                          Code:
                          <DatapointSubtype Id="DPST-14-7" Number="7" Name="DPT_Value_AngleDeg" Text="angle (degree)">
                          <Format>
                            <Float Id="DPST-14-7_F-1" Width="32" Name="angle, degree" Unit="°" />
                          </Format>
                          </DatapointSubtype>
                          <DatapointSubtype Id="DPST-14-19" Number="19" Name="DPT_Value_Electric_Current" Text="electric current (A)">
                          <Format>
                            <Float Id="DPST-14-19_F-1" Width="32" Name="electric current" Unit="A" />
                          </Format>
                          </DatapointSubtype>
                          <DatapointSubtype Id="DPST-14-20" Number="20" Name="DPT_Value_Electric_CurrentDensity" Text="electric current density (A/m²)">
                          <Format>
                            <Float Id="DPST-14-20_F-1" Width="32" Name="electric current density" Unit="A/m²" />
                          </Format>
                          </DatapointSubtype>
                          I think it would be a good start to have at least all the correct names for the sub types.
                          I'll try to extend the existing files with the missing sub types.
                          Gruß, Carsten

                          Kommentar


                            Zitat von TheMax74 Beitrag anzeigen
                            ... The enhancement whould be, for example, set a text output based on the payload. For example, if payload is true, the output text should be “Eingeschaltet”. So you can use the knx-ultimate without any further change. But i’m still thinking if it’s useful or not.
                            IMHO you shouldn’t do this. People will be unhappy no matter what you put in there and will request changes. Different languages, dialects etc.

                            E.G. take the day/night object. The is no DPT for it an no definition if 0 is day or night.
                            Zuletzt geändert von MGK; 06.04.2020, 17:52.

                            Kommentar


                              Hello
                              i need some help in translating the wiki auf Deutsch.
                              All nodes are translated to ENG, DEU, ITA, as well as the wiki in ENG and ITA but DEU wiki pages is missing.
                              Is there someone that can translate all the files beginning with "de-", from english to deutsch?
                              The git link to download the wiki is this: https://github.com/Supergiovane/node...imate.wiki.git
                              Thank you

                              Kommentar


                                Zitat von TheMax74 Beitrag anzeigen
                                Hello
                                i need some help in translating the wiki auf Deutsch.
                                OK, I managed to download the repo (my first steps with Git..). Now I'm searching for a good editor for Windows (WYSIWIG preferred) and found Typora. Hmmm..., not very impressive when it shows single "</details>" after each paragraph. They aren't visible in the preview in VS Code with "Markdown All in One" extension.


                                Let's wait and see if I manage to translate a few pages.


                                regards
                                Carsten


                                Gruß, Carsten

                                Kommentar

                                Lädt...
                                X