Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information not saved when refreshing browser #13

Open
moryoav opened this issue Feb 16, 2020 · 3 comments
Open

Information not saved when refreshing browser #13

moryoav opened this issue Feb 16, 2020 · 3 comments

Comments

@moryoav
Copy link

moryoav commented Feb 16, 2020

The module works great and displayed temperature and humidity. However, the information does not survive a browser refresh, when the browser is refreshed the information is lost, it'll display "Loading ..." instead of the last known info. Can that be avoided? anyway to store the information somehow? (Since it's only a browser refresh, not a service restart)

@balassy
Copy link
Owner

balassy commented Feb 16, 2020

Hello @moryoav,
Thank you for trying this module and thanks for your feedback! You are correct, this module does not save any information in the browser, and the other modules I've seen so far work similarly. When the page and the module is loaded, it displays the loading message until the remote thermometer sends the current temperature and humidity data the next time.
However the message should be "Waiting for temperature data..." if you are using the MagicMirror in English or in Hungarian, which I believe is less confusing than "Loading...". In what language do you use your mirror?

@moryoav
Copy link
Author

moryoav commented Feb 17, 2020

I use it in English and the text is "Loading ...". Not the issue that troubled me though... I'll see if I can figure out a workaround to the refresh in Node-Red.

@sisimomo
Copy link

sisimomo commented Aug 13, 2021

You could use the same principle that is found in this module. They use "fs" in Node.js to read/write a file in the root directory of the module called "logs.json". In this file is stored all the previous message receive. In our situation, it will be a list of all the last state of each sensor.

something like:

{
  sensors: {
    "1": {
      "temp": 27,
      "humidity": 30.4,
      "battery": 100,
    },
    "2": {
      "temp": 28,
      "humidity": 30.2,
      "battery": 59,
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants