Ankündigung

Einklappen
Keine Ankündigung bisher.

KNX node for node-red

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

    Hello TheMax,

    can you provide a option to set the topic (I hope this is the right word for it).
    At the moment if I send a value from KNX I have it as payload.

    For the hue node for example I need a function to set the topic to e.g. brightness.

    code of the function I use:

    return {payload: {brightness: msg.payload}}

    code of the function for homekit

    msg.topic = "0/TargetPosition";
    return msg;

    one of these two functions I have included in almost all flows and if it was included in your node would be clearer in the display.
    Zuletzt geändert von jumper79; 04.03.2020, 10:09.
    Gruß
    Thorsten

    Meine Installation: EFH mit EIB und Powernet; BJ Triton RTR 5fach; BJ Triton 3/5fach; BJ Wave Fenstermelder; Gira HS; Gira SmartSensor; Gira TK mit Fingerprint und TK-Gateway, Agfeo AS30 mit ST40IP; Dialogic Touch 15" mit Homecockpit und Schnittstelle zur Gira TK-Anlage; ipod Touch 1G und iphone 3G mit WHD iphone Docking-Station; Dreambox 7000; Kathrein UFS 910; Beleuchtung über DALI gesteuert

    Kommentar


      Maexle
      Hello,
      ok, this is an IP interface.
      Your reference wiki page for knx-ultimate gateway is this
      https://github.com/Supergiovane/node...-configuration

      In the HOST field, put the IP address of your MDT device (for example 192.168.1.6)
      Leave all other fields as default
      Then save and deploy.
      Please take a look at the wiki, containing Troubleshoots, FAQ and samples.
      https://github.com/Supergiovane/node...-ultimate/wiki

      Cheers!

      Kommentar


        Zitat von jumper79 Beitrag anzeigen
        Hello TheMax,

        can you provide a option to set the topic (I hope this is the right word for it).
        At the moment if I send a value from KNX I have it as payload.

        For the hue node for example I need a function to set the topic to e.g. brightness.

        code of the function I use:

        return {payload: {brightness: msg.payload}}

        code of the function for homekit

        msg.topic = "0/TargetPosition";
        return msg;

        one of these two functions I have included in almost all flows and if it was included in your node would be clearer in the display.
        Hello Jumper
        maybe i've not correctly understood, but you can already set a topic for the knx-ultimate node.
        https://github.com/Supergiovane/node...-Configuration

        Kommentar


          thanks for the fast answer.

          for the "msg.topic"- function you are right.

          but for the payload its doesn't work.

          i attached a screenshot how the result should work. thanks
          Angehängte Dateien
          Gruß
          Thorsten

          Meine Installation: EFH mit EIB und Powernet; BJ Triton RTR 5fach; BJ Triton 3/5fach; BJ Wave Fenstermelder; Gira HS; Gira SmartSensor; Gira TK mit Fingerprint und TK-Gateway, Agfeo AS30 mit ST40IP; Dialogic Touch 15" mit Homecockpit und Schnittstelle zur Gira TK-Anlage; ipod Touch 1G und iphone 3G mit WHD iphone Docking-Station; Dreambox 7000; Kathrein UFS 910; Beleuchtung über DALI gesteuert

          Kommentar


            Hello Jumper
            at this time, i cannot unfortunately add the payload modification you requested. I've had many request about adding things here ant there, that can be done with a simple function or a "change" node, but if i add all these requested things, the knx-ultimate will become a bloodware of function that maybe only you use, while for other users, they make the use of the node overcomplicated.
            I understand your point of view, because i also wish to have the flow as cleaner as possible, but node-red it's mean to be flexible and full of nodes ;-)
            Imagine if you or another user, tomorrow, need another function embedded in the knx-ultimate, just to get rid of another function node. I must "code" everyday.
            Hope you understand.
            ;-)

            Kommentar


              Zitat von TheMax74 Beitrag anzeigen
              V. 1.1.38 is out with changed behaviour in importing CSV file. A fake Datapoint 1.001 will now be set for GA with unset datapoint.
              Thank you very much! Much appreciated feature!
              Reason: many people use a block structure for GA, e. g. reserving 10 GA for each device of a type even though only 7 are needed. So there are 3 unused GA which may not have been deleted by the user. Hence the lot of undefined data types.

              Kommentar


                Hello TheMax

                is this the right way?

                The Port ist set by default to - 3671 --- or should i type in the port shown by ETS?


                Unbenannt 1.pdf
                Angehängte Dateien
                Zuletzt geändert von Maexle; 04.03.2020, 21:37.

                Kommentar


                  Hi
                  The port should be the same you set in ETS
                  Please be sure, that the maximum number of tunnels, that your MDT can accept, is not already reached.
                  Every device you connect to it (ETS, node-red, etc) takes 1 tunnel.
                  Cannot open the link you posted.

                  Kommentar


                    Hi,

                    im too stupid to insert a screenshot


                    The Interface could handle 4 devices (i'm not 100% sure)
                    So Raspi 1
                    ETS 2
                    NodeRed 3
                    Number 4 empty - so it should be fine.


                    Unbenannt 1.png
                    Zuletzt geändert von Maexle; 04.03.2020, 21:38. Grund: Screenshot Size fitted

                    Kommentar


                      Yes it should be fine. I’m lost. I don’t remember what is your issue! Can you receive the telegrams? What’s your issue?

                      Kommentar


                        Hi,
                        I am using the openweathermap.org api to get some weather data.
                        Beside the current data, there is a forecast.
                        The forecast is offered in an array of objects - offical api doc can be found at: https://openweathermap.org/forecast5
                        Code:
                        [{"dt":1583593200,"main":{"temp":8.19,"feels_like":3.2,"temp_min":8.02,"temp_max":8.19,"pressure":1017,"sea_level":1017,"grnd_level":1004,"humidity":59,"temp_kf":0.17},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":4.43,"deg":268},"sys":{"pod":"d"},"dt_txt":"2020-03-07 15:00:00"},{"dt":1583604000,"main":{"temp":5.04,"feels_like":1.39,"temp_min":4.91,"temp_max":5.04,"pressure":1018,"sea_level":1018,"grnd_level":1005,"humidity":78,"temp_kf":0.13},"weather":[{"id":803,"main":"Clouds","description":"Überwiegend bewölkt","icon":"04n"}],"clouds":{"all":61},"wind":{"speed":2.71,"deg":218},"sys":{"pod":"n"},"dt_txt":"2020-03-07 18:00:00"},{"dt":1583614800,"main":{"temp":3.91,"feels_like":-0.8,"temp_min":3.83,"temp_max":3.91,"pressure":1019,"sea_level":1019,"grnd_level":1005,"humidity":79,"temp_kf":0.08},"weather":[{"id":800,"main":"Clear","description":"Klarer Himmel","icon":"01n"}],"clouds":{"all":3},"wind":{"speed":4.02,"deg":196},"sys":{"pod":"n"},"dt_txt":"2020-03-07 21:00:00"},{"dt":1583625600,"main":{"temp":5.52,"feels_like":0,"temp_min":5.48,"temp_max":5.52,"pressure":1018,"sea_level":1018,"grnd_level":1004,"humidity":75,"temp_kf":0.04},"weather":[{"id":802,"main":"Clouds","description":"Mäßig bewölkt","icon":"03n"}],"clouds":{"all":35},"wind":{"speed":5.37,"deg":207},"sys":{"pod":"n"},"dt_txt":"2020-03-08 00:00:00"},{"dt":1583636400,"main":{"temp":4.97,"feels_like":0.42,"temp_min":4.97,"temp_max":4.97,"pressure":1016,"sea_level":1016,"grnd_level":1002,"humidity":85,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04n"}],"clouds":{"all":100},"wind":{"speed":4.27,"deg":197},"sys":{"pod":"n"},"dt_txt":"2020-03-08 03:00:00"},{"dt":1583647200,"main":{"temp":5.42,"feels_like":-0.06,"temp_min":5.42,"temp_max":5.42,"pressure":1015,"sea_level":1015,"grnd_level":1001,"humidity":83,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04d"}],"clouds":{"all":100},"wind":{"speed":5.62,"deg":202},"sys":{"pod":"d"},"dt_txt":"2020-03-08 06:00:00"},{"dt":1583658000,"main":{"temp":8.37,"feels_like":1.7,"temp_min":8.37,"temp_max":8.37,"pressure":1014,"sea_level":1014,"grnd_level":1000,"humidity":73,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04d"}],"clouds":{"all":100},"wind":{"speed":7.59,"deg":212},"sys":{"pod":"d"},"dt_txt":"2020-03-08 09:00:00"},{"dt":1583668800,"main":{"temp":11.1,"feels_like":4.46,"temp_min":11.1,"temp_max":11.1,"pressure":1013,"sea_level":1013,"grnd_level":999,"humidity":64,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04d"}],"clouds":{"all":100},"wind":{"speed":7.75,"deg":209},"sys":{"pod":"d"},"dt_txt":"2020-03-08 12:00:00"},{"dt":1583679600,"main":{"temp":9.37,"feels_like":4.33,"temp_min":9.37,"temp_max":9.37,"pressure":1011,"sea_level":1011,"grnd_level":997,"humidity":72,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04d"}],"clouds":{"all":100},"wind":{"speed":5.47,"deg":218},"sys":{"pod":"d"},"dt_txt":"2020-03-08 15:00:00"},{"dt":1583690400,"main":{"temp":7.72,"feels_like":2.61,"temp_min":7.72,"temp_max":7.72,"pressure":1010,"sea_level":1010,"grnd_level":997,"humidity":86,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":100},"wind":{"speed":5.85,"deg":202},"rain":{"3h":0.69},"sys":{"pod":"n"},"dt_txt":"2020-03-08 18:00:00"},{"dt":1583701200,"main":{"temp":7.81,"feels_like":3.25,"temp_min":7.81,"temp_max":7.81,"pressure":1009,"sea_level":1009,"grnd_level":995,"humidity":85,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":100},"wind":{"speed":5.04,"deg":213},"rain":{"3h":0.63},"sys":{"pod":"n"},"dt_txt":"2020-03-08 21:00:00"},{"dt":1583712000,"main":{"temp":7.3,"feels_like":3.3,"temp_min":7.3,"temp_max":7.3,"pressure":1008,"sea_level":1008,"grnd_level":994,"humidity":91,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":100},"wind":{"speed":4.38,"deg":215},"rain":{"3h":2.31},"sys":{"pod":"n"},"dt_txt":"2020-03-09 00:00:00"},{"dt":1583722800,"main":{"temp":5.41,"feels_like":1.43,"temp_min":5.41,"temp_max":5.41,"pressure":1008,"sea_level":1008,"grnd_level":995,"humidity":93,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04n"}],"clouds":{"all":100},"wind":{"speed":3.9,"deg":224},"sys":{"pod":"n"},"dt_txt":"2020-03-09 03:00:00"},{"dt":1583733600,"main":{"temp":5.7,"feels_like":1.13,"temp_min":5.7,"temp_max":5.7,"pressure":1009,"sea_level":1009,"grnd_level":996,"humidity":90,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04d"}],"clouds":{"all":99},"wind":{"speed":4.7,"deg":241},"sys":{"pod":"d"},"dt_txt":"2020-03-09 06:00:00"},{"dt":1583744400,"main":{"temp":6.29,"feels_like":1.11,"temp_min":6.29,"temp_max":6.29,"pressure":1012,"sea_level":1012,"grnd_level":998,"humidity":83,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":5.41,"deg":245},"rain":{"3h":0.13},"sys":{"pod":"d"},"dt_txt":"2020-03-09 09:00:00"},{"dt":1583755200,"main":{"temp":7.77,"feels_like":1.94,"temp_min":7.77,"temp_max":7.77,"pressure":1013,"sea_level":1013,"grnd_level":1000,"humidity":69,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":96},"wind":{"speed":6.04,"deg":252},"rain":{"3h":0.31},"sys":{"pod":"d"},"dt_txt":"2020-03-09 12:00:00"},{"dt":1583766000,"main":{"temp":8.55,"feels_like":2.19,"temp_min":8.55,"temp_max":8.55,"pressure":1014,"sea_level":1014,"grnd_level":1001,"humidity":64,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":75},"wind":{"speed":6.72,"deg":244},"rain":{"3h":0.44},"sys":{"pod":"d"},"dt_txt":"2020-03-09 15:00:00"},{"dt":1583776800,"main":{"temp":5.55,"feels_like":1,"temp_min":5.55,"temp_max":5.55,"pressure":1016,"sea_level":1016,"grnd_level":1002,"humidity":82,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":79},"wind":{"speed":4.29,"deg":234},"rain":{"3h":0.37},"sys":{"pod":"n"},"dt_txt":"2020-03-09 18:00:00"},{"dt":1583787600,"main":{"temp":4.35,"feels_like":0,"temp_min":4.35,"temp_max":4.35,"pressure":1018,"sea_level":1018,"grnd_level":1004,"humidity":88,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":53},"wind":{"speed":3.96,"deg":235},"rain":{"3h":0.13},"sys":{"pod":"n"},"dt_txt":"2020-03-09 21:00:00"},{"dt":1583798400,"main":{"temp":4.05,"feels_like":-0.73,"temp_min":4.05,"temp_max":4.05,"pressure":1018,"sea_level":1018,"grnd_level":1004,"humidity":87,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"Überwiegend bewölkt","icon":"04n"}],"clouds":{"all":60},"wind":{"speed":4.46,"deg":215},"sys":{"pod":"n"},"dt_txt":"2020-03-10 00:00:00"},{"dt":1583809200,"main":{"temp":4.38,"feels_like":-1.23,"temp_min":4.38,"temp_max":4.38,"pressure":1016,"sea_level":1016,"grnd_level":1003,"humidity":86,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04n"}],"clouds":{"all":100},"wind":{"speed":5.69,"deg":215},"sys":{"pod":"n"},"dt_txt":"2020-03-10 03:00:00"},{"dt":1583820000,"main":{"temp":4.55,"feels_like":-2.02,"temp_min":4.55,"temp_max":4.55,"pressure":1015,"sea_level":1015,"grnd_level":1001,"humidity":83,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":6.98,"deg":204},"rain":{"3h":0.25},"sys":{"pod":"d"},"dt_txt":"2020-03-10 06:00:00"},{"dt":1583830800,"main":{"temp":6.25,"feels_like":-0.04,"temp_min":6.25,"temp_max":6.25,"pressure":1013,"sea_level":1013,"grnd_level":1000,"humidity":86,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":7.13,"deg":211},"rain":{"3h":0.75},"sys":{"pod":"d"},"dt_txt":"2020-03-10 09:00:00"},{"dt":1583841600,"main":{"temp":7.85,"feels_like":1.12,"temp_min":7.85,"temp_max":7.85,"pressure":1013,"sea_level":1013,"grnd_level":999,"humidity":90,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":8.4,"deg":219},"rain":{"3h":1.06},"sys":{"pod":"d"},"dt_txt":"2020-03-10 12:00:00"},{"dt":1583852400,"main":{"temp":9.21,"feels_like":3.12,"temp_min":9.21,"temp_max":9.21,"pressure":1012,"sea_level":1012,"grnd_level":999,"humidity":90,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":7.92,"deg":229},"rain":{"3h":1.25},"sys":{"pod":"d"},"dt_txt":"2020-03-10 15:00:00"},{"dt":1583863200,"main":{"temp":10.47,"feels_like":5.24,"temp_min":10.47,"temp_max":10.47,"pressure":1013,"sea_level":1013,"grnd_level":999,"humidity":91,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":100},"wind":{"speed":7.18,"deg":237},"rain":{"3h":0.13},"sys":{"pod":"n"},"dt_txt":"2020-03-10 18:00:00"},{"dt":1583874000,"main":{"temp":10.97,"feels_like":5.48,"temp_min":10.97,"temp_max":10.97,"pressure":1013,"sea_level":1013,"grnd_level":1000,"humidity":90,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04n"}],"clouds":{"all":100},"wind":{"speed":7.68,"deg":238},"sys":{"pod":"n"},"dt_txt":"2020-03-10 21:00:00"},{"dt":1583884800,"main":{"temp":11.34,"feels_like":5.51,"temp_min":11.34,"temp_max":11.34,"pressure":1013,"sea_level":1013,"grnd_level":1000,"humidity":88,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04n"}],"clouds":{"all":100},"wind":{"speed":8.17,"deg":238},"sys":{"pod":"n"},"dt_txt":"2020-03-11 00:00:00"},{"dt":1583895600,"main":{"temp":11.55,"feels_like":5.75,"temp_min":11.55,"temp_max":11.55,"pressure":1013,"sea_level":1013,"grnd_level":1000,"humidity":87,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"Bedeckt","icon":"04n"}],"clouds":{"all":100},"wind":{"speed":8.14,"deg":242},"sys":{"pod":"n"},"dt_txt":"2020-03-11 03:00:00"},{"dt":1583906400,"main":{"temp":11.43,"feels_like":6.39,"temp_min":11.43,"temp_max":11.43,"pressure":1015,"sea_level":1015,"grnd_level":1001,"humidity":89,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":99},"wind":{"speed":7.14,"deg":243},"rain":{"3h":0.13},"sys":{"pod":"d"},"dt_txt":"2020-03-11 06:00:00"},{"dt":1583917200,"main":{"temp":12.23,"feels_like":6.93,"temp_min":12.23,"temp_max":12.23,"pressure":1016,"sea_level":1016,"grnd_level":1003,"humidity":84,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":7.49,"deg":243},"rain":{"3h":0.25},"sys":{"pod":"d"},"dt_txt":"2020-03-11 09:00:00"},{"dt":1583928000,"main":{"temp":13.34,"feels_like":8.23,"temp_min":13.34,"temp_max":13.34,"pressure":1017,"sea_level":1017,"grnd_level":1003,"humidity":77,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":7.14,"deg":246},"rain":{"3h":0.31},"sys":{"pod":"d"},"dt_txt":"2020-03-11 12:00:00"},{"dt":1583938800,"main":{"temp":13.85,"feels_like":10.92,"temp_min":13.85,"temp_max":13.85,"pressure":1016,"sea_level":1016,"grnd_level":1002,"humidity":77,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":96},"wind":{"speed":4.2,"deg":235},"rain":{"3h":0.25},"sys":{"pod":"d"},"dt_txt":"2020-03-11 15:00:00"},{"dt":1583949600,"main":{"temp":12.15,"feels_like":7.57,"temp_min":12.15,"temp_max":12.15,"pressure":1015,"sea_level":1015,"grnd_level":1001,"humidity":80,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":85},"wind":{"speed":6.16,"deg":222},"rain":{"3h":0.19},"sys":{"pod":"n"},"dt_txt":"2020-03-11 18:00:00"},{"dt":1583960400,"main":{"temp":11.05,"feels_like":7.27,"temp_min":11.05,"temp_max":11.05,"pressure":1015,"sea_level":1015,"grnd_level":1001,"humidity":90,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":18},"wind":{"speed":5.27,"deg":215},"rain":{"3h":0.13},"sys":{"pod":"n"},"dt_txt":"2020-03-11 21:00:00"},{"dt":1583971200,"main":{"temp":11.84,"feels_like":7.48,"temp_min":11.84,"temp_max":11.84,"pressure":1012,"sea_level":1012,"grnd_level":999,"humidity":87,"temp_kf":0},"weather":[{"id":802,"main":"Clouds","description":"Mäßig bewölkt","icon":"03n"}],"clouds":{"all":44},"wind":{"speed":6.19,"deg":214},"sys":{"pod":"n"},"dt_txt":"2020-03-12 00:00:00"},{"dt":1583982000,"main":{"temp":12.43,"feels_like":7.68,"temp_min":12.43,"temp_max":12.43,"pressure":1010,"sea_level":1010,"grnd_level":996,"humidity":89,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":100},"wind":{"speed":7.11,"deg":231},"rain":{"3h":0.75},"sys":{"pod":"n"},"dt_txt":"2020-03-12 03:00:00"},{"dt":1583992800,"main":{"temp":11.82,"feels_like":5.36,"temp_min":11.82,"temp_max":11.82,"pressure":1009,"sea_level":1009,"grnd_level":996,"humidity":84,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":90},"wind":{"speed":9,"deg":237},"rain":{"3h":1.06},"sys":{"pod":"d"},"dt_txt":"2020-03-12 06:00:00"},{"dt":1584003600,"main":{"temp":10.05,"feels_like":4.15,"temp_min":10.05,"temp_max":10.05,"pressure":1011,"sea_level":1011,"grnd_level":997,"humidity":85,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"Mäßiger Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":7.65,"deg":272},"rain":{"3h":3.44},"sys":{"pod":"d"},"dt_txt":"2020-03-12 09:00:00"},{"dt":1584014400,"main":{"temp":9.59,"feels_like":1.21,"temp_min":9.59,"temp_max":9.59,"pressure":1013,"sea_level":1013,"grnd_level":1000,"humidity":62,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10d"}],"clouds":{"all":100},"wind":{"speed":9.75,"deg":253},"rain":{"3h":0.69},"sys":{"pod":"d"},"dt_txt":"2020-03-12 12:00:00"}]

                        I am interested in the total rain for the next 24h.
                        As long as it will not rain, the object "rain" is not included in array element.
                        If it will rain in the next 3h, then I am able to get that value via this:
                        Code:
                        var rain = { payload:msg.payload[0].rain["3h"] };
                        I would like now to loop at that array, for the next 24 h (means for i = 0; i < 8; i++ ) - if the element "rain" is available I would like to sum up the found values.
                        How can I check, if an element is available within a for loop? I found the function array.some() - but I am not able to use it properly.

                        Kind regards for any suggestions
                        Alex
                        Gruß
                        alexbeer

                        Kommentar


                          Alex,
                          can you paste your flow please? I've trouble copying/pasting the code. Thank you.

                          Kommentar


                            Nevermind. Was a typo error. Solved.
                            Please wait a moment, i'll do the trick for you.

                            Kommentar


                              Hi Alex

                              Copy this in your function node.
                              Code:
                              var total = 0;
                              for (var i = 0; i < msg.payload.length; i++) {
                              if (msg.payload[i].hasOwnProperty("rain")){
                              total += msg.payload[i].rain["3h"];
                              }
                              }
                              return {payload:total};
                              Hope you appreciate my help.
                              Ciao.

                              Kommentar


                                Hi,
                                appreciate ... it is just awesome and working like a a charme.
                                Adjustment as follows to cope only the data for the next 24h.
                                Code:
                                var rainTotal = 0;
                                for (var i = 0; i < msg.payload.length; i++) {
                                // i= 8 = 24h)
                                if (i < 8 && msg.payload[i].hasOwnProperty("rain")) {
                                rainTotal += msg.payload[i].rain["3h"];
                                }
                                }
                                return {payload:rainTotal};
                                Many thanks!
                                Alex
                                Zuletzt geändert von alexbeer; 07.03.2020, 20:27.
                                Gruß
                                alexbeer

                                Kommentar

                                Lädt...
                                X