Saving your context data in Node-Red

Поделиться
HTML-код
  • Опубликовано: 28 окт 2024
  • This is a very useful, addition to Node-Red (probably already about 6 months old) that you can define multiple storage option for context data, once could be filesystem storage. Node-Red will save your context data for you and make is available after Node-Red restarts. Without any additional coding.
    nodered.org/do...

Комментарии • 25

  • @astrogerard
    @astrogerard 3 года назад +2

    Thanks for the useful info and good to see I'm not the only one using the mc-editor.

  • @hsmptg
    @hsmptg 3 года назад +1

    Spooky!
    Yesterday I was seeing your other method to save global variables in a file and some hours later you came with this!?!
    Are you entering my PC???
    Congratulations for your videos!

    • @csongorvarga
      @csongorvarga  3 года назад

      Time flies and Node-Red is getting better :)

  • @soovui
    @soovui 3 года назад +3

    U r more than superb bro... Thank you so much for sharing another fantastic knowledge... Really learn so much from u... Can't wait to see another innovative and creative nodered details tutorials... Stay healthy and happy always...

  • @rosaldanha
    @rosaldanha 2 года назад +1

    Very well explained and very useful, thanks!!

  • @weatecnologia8858
    @weatecnologia8858 3 года назад +1

    I consider your videos to be among the best on RUclips. Can you do one explaining how to calculate hourly average sensor data?

    • @csongorvarga
      @csongorvarga  2 года назад

      I used to create a function node and some javacript code for that, but you can use the smooth node to calculate a rolling average of the last n data. So if your data comes every minute, just set it to last 60 messages.

  • @thierry3610
    @thierry3610 3 года назад +1

    Informative content as usual. Thank you

  • @kobedde
    @kobedde 2 года назад +1

    Thanks for this very useful video. Just what I needed 👍

    • @csongorvarga
      @csongorvarga  2 года назад +1

      This is a very old video. Now there is a filesystem storage option which takes care of this.

    • @kobedde
      @kobedde 2 года назад

      @@csongorvarga Hi, thanks for your reply. Is there an instruction video on that?

    • @csongorvarga
      @csongorvarga  2 года назад +1

      @@kobedde There is this article on this which explains it very well: nodered.org/docs/user-guide/context

  • @dano4700
    @dano4700 3 года назад +1

    Great info. Please keep doing these.
    Cheers 👍🇦🇺

  • @jdabramson
    @jdabramson 3 года назад +1

    Thank you for the video

  • @sidharthbajaj9237
    @sidharthbajaj9237 3 года назад +1

    Hi, Thanks for the videos
    Can you kindly show how to show the current variable values below the function node in the flow as shown in your video

    • @csongorvarga
      @csongorvarga  3 года назад +1

      Check this article, it explains it all: nodered.org/docs/creating-nodes/status

    • @sidharthbajaj9237
      @sidharthbajaj9237 3 года назад

      @@csongorvarga thank you for the quick answer :)
      However, my MQTT nodes are showing the status but the function nodes do not display the current variable values
      I guess I am doing something wrong.
      Kindly guide me

    • @csongorvarga
      @csongorvarga  3 года назад +1

      @@sidharthbajaj9237 What did you do? What code did you put in? You need to add that this.node = {....} line in your function code to do that.

    • @sidharthbajaj9237
      @sidharthbajaj9237 3 года назад +1

      @@csongorvarga thanks it worked :)

  • @giulianobardecio7248
    @giulianobardecio7248 2 года назад

    I have set up node-red in a heroku server is it possible to store this variable in localfilesystem?
    Using part of the code you writed for the access managment system I have not configured what you show here specifying localfilesystem but it seems to be working anyway.
    Also currently I'm changing values from UI dashboard but what if I want to change the context data manually or add new objects like Users ? How could I do this?

    • @csongorvarga
      @csongorvarga  2 года назад

      A lot of time has passed since this video, and Node-Red implemented this standard. Please look at this: nodered.org/docs/user-guide/context. You can add filesystem as a storage option in the settings.js and from that point you can set the context to be stored in the file system. And Node-Red does it automatically.
      I don't understand your question on new object. What are you trying to do?

    • @giulianobardecio7248
      @giulianobardecio7248 2 года назад

      Yes I added that line to store on local storage by default and it says that the variables are being stored there but it gets lost after some time, may be it’s related to the server being deployed on heroku?

    • @csongorvarga
      @csongorvarga  2 года назад

      @@giulianobardecio7248 well, that is strange. I have no issues...

    • @giulianobardecio7248
      @giulianobardecio7248 2 года назад

      Have you ever tried deploying on heroku? or what do you use to host the server?

    • @csongorvarga
      @csongorvarga  2 года назад

      @@giulianobardecio7248 I have my own server, I am not hosting it on anything. Maybe node red does not have access to write to the filesystem.