Ankündigung

Einklappen
Keine Ankündigung bisher.

Hot to send Date and Time ciclycally with Node-Red

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

    Hot to send Date and Time ciclycally with Node-Red

    I'm sharing how to send to the KNX bus the Date and Time ciclically, using Node-Red with realKNX

    Open the web interface of realKnx and start the Node-Red editor by selecting the gear (little red circle)

    1.jpg


    Open the Hamburger Menu on top right (the hamburger menu is the menu with three lines) and select "Manage Palette"
    A tab will open (like below). Click "install" and search for "knxjs" and install it.


    3.jpg

    Select from the left pane the "inject" ribbon and drop it into the center editor area.
    Then drag a "function" ribbon and a "knxjs Device" into the center editor area.
    Link all toghether as you can see below.
    Make this two times, 1 for date (Data) and 1 for time (Ora), as below:


    2.jpg

    Then open the green KNX ribbon (double click) and set the GA and the IP of your Router/IP Interface. Please see the documentation on how to do that, but it's very simple. One GA is for the date (Data) and one is for the time (Ora)
    Double click on the function ribbon Data (orange ribbon) and insert this code in the "function" area for the DATE: return {payload:{"value":new Date()}}
    Double click on the other function ribbon "Ora" (orange ribbon) and insert this code in the "function" area for the TIME (Uebersetzung: Ora): return {payload:{"value":new Date()}}
    Both codes "return {payload:{"value":new Date()}}" are identical. The knxjs Palette will separate the time and hour itself.

    5.jpg


    Double click on the "inject" ribbon (blue ribbon) and do like this, for both blue Ribbons. The "Payload" text can be anithing you want, for example "italy is not in the 2018 world Cup":

    4.jpg

    That's all.
    I'm sorry for this long post.
    In the newest version of Node-Red, you can simply copy your nodes (the ribbons) and paste it as plain Json text. Then you can import it by simply copy/paste the json text.
    In the current version you can only export the entire project and i do not want to do that, because there are private things that i do not intend to share.
    Please feel free to ask any question.
    Angehängte Dateien

    #2
    Thanks for sharing!
    BTW are you sure it is not possible to export JSON? One has to select at least one element before the export appears in the menu (a bit weird..)
    For the payload, "Sweden is in" works fine too
    Jens
    You do not have permission to view this gallery.
    This gallery has 1 photos.

    Kommentar


      #3
      seems to be a bug in the export procedure. It exports all. If you select only some nodes, it exports all anyway.

      Kommentar


        #4
        OK, will look into that, which OS and browser are you using?

        Kommentar


          #5
          Hello, tried with Win10 + Chrome and macOs with Chrome and Safari.

          Kommentar


            #6
            I retested and recorded my steps in an animated gif, see the last item here:
            https://proknx.com/en/automation-node-red/
            Can you confirm that these steps doesn't work on your side? (the animated gif doesn't display in the forum, so follow the link)

            How-to: export and import flows and nodes


            click the image to start the animation of these steps:
            1. select some nodes
            2. export the selected nodes to clipboard
            3. import the selected nodes from clipboard into a new flow

            Kommentar


              #7
              Hello
              sorry, maybe my mistake. It works, but i cannot paste the code in forum because knxjs nodes retains a CVS payload with all my group addresses.
              This because knxjs "device" node can use the exported GA list from ETS to help you to select the right device.
              Sorry if you've lost your time on that.

              Kommentar


                #8
                Hello, and now worries what so ever!

                Kommentar


                  #9
                  Here's the flow:
                  [{"id":"ef8f9496.bd4638","type":"inject","z":"2a265 09b.73d31","name":"Date","topic":"","payload":""," payloadType":"date","repeat":"36000","crontab":"", "once":true,"x":290,"y":320,"wires":[["28193ab1.098d46"]]},{"id":"28193ab1.098d46","type":"function","z":"2 a26509b.73d31","name":"Date","func":"return { payload:{"value": new Date() } };","outputs":1,"noerr":0,"x":470,"y":320,"wires ":[["b98441b0.ec4af"]]},{"id":"b98441b0.ec4af","type":"knx-device","z":"2a26509b.73d31","controller":"","mode ":"manual","groupaddresses":"","name":"Date","grou paddress":"","statusga":"","dpt":"DPT1","x":650,"y ":320,"wires":[[]]},{"id":"e5985bb4.161f08","type":"comment","z":"2a 26509b.73d31","name":"Set KNX Date & Time periodically","info":"","x":350,"y":280,"wires":[]},{"id":"84c2b339.ef65b","type":"inject","z":"2a26 509b.73d31","name":"Hour","topic":"","payload":"", "payloadType":"date","repeat":"36000","crontab":"" ,"once":true,"x":290,"y":360,"wires":[["492dbf98.b7cde"]]},{"id":"492dbf98.b7cde","type":"function","z":"2a 26509b.73d31","name":"Hour","func":"return { payload:{"value": new Date() } };","outputs":1,"noerr":0,"x":470,"y":360,"wires ":[["f1b71c6c.a5099"]]},{"id":"f1b71c6c.a5099","type":"knx-device","z":"2a26509b.73d31","controller":"","mode ":"manual","groupaddresses":"","name":"Hour","grou paddress":"","statusga":"","dpt":"DPT1","x":650,"y ":360,"wires":[[]]}]

                  Kommentar


                    #10
                    Hi,

                    I have configured the flow above some days ago, but it doesn't work as expected.

                    First it seems to work without any problem, I was able to see the messages in the group monitor. Since yesterday the knx out node shows the update is sent (currently every 10 minutes), but packets can be seen in the group monitor only sporadically. Since today 0:00 I can see one packet send an 00:05 only. Same behaviour, when I trigger the flow manually in Node Red. Nothing happens, even if the node shows the green square and shows "sent" when I trigger the flow.

                    I had rebooted Node Red and the realKNX-Server, but that didn't help.

                    After that I deleted the whole flow and created it new. Now it's working again. I'm really unsure now. if I can trust that flow/KNX-node to update the time over a longer time span.

                    Another issues:

                    - When the time is updated between 00:00 und 00:59, the node doesn't send for example 00:34, but sends 24:34, what ist shown as "ungültiger Wert/invalid value" in the group monitor. Nevertheless my Zenio ZAS seem to accept the update and show 24:34 in the display
                    - This morning I was wondering why my Zennio ZAS showed a wrong time (GMT / CET-time -1). Looking to the knxjs-node, it shows time "07:40 CET (+1)". But what is received by KNX seems to be "06:40"

                    Does somebody has any idea why the issues occure and how to solve them?

                    Kommentar


                      #11
                      Hello Neelex.
                      That's strange. Mine is working.
                      You can do one of this:

                      1) Instead of an interval, you can choose to send the time once a day. So you don't have to worry about 24:34.
                      Senza_nome.png


                      or
                      2) use a function node to replace the "24:" with "00" in the string.

                      The solution 1 seems the samplest for you.

                      Kommentar


                        #12
                        Hi Massimo,

                        thanks for your suggestions!

                        Yesterday around midnight I had a look to the Zennio ZAS to check what happens, when a time update is sent. The time is still sent every 10 Minutes. This time it worked as expected, 00:xx was shown. And generally I can see the packets every 10 minutes in the group monitor. Don't ask me why this is working at the moment. Maybe hard-resetting NodeRed or reinstallig the knxjs packets did the trick. I will keep an eye on that for the next days. Otherwise I will test your suggestions. For the moment a short update intervall would be good as I make a lot of configuration changes to devices.

                        Kommentar

                        Lädt...
                        X