Refresh UI avoiding msg loops

Use an inject node configured to inject on startup to inject initial values into the join node. You may not need to initialise both topics though, it depends on the answers to my previous post, which you haven't answered.

  1. What do you want to do on startup if an AI message is received before the first UI message?
  2. What do you want to do on startup if a UI message is received before the first AI message.?

For both questions the answer is wait till schedulled trigger comes in .

I would like to save the last UI and AI settings and on startup recover them inmediatelly before first run.

In that case put them into retained topics in MQTT.

I go one step beyond, I save values into a centralized database, for critical stuff, and query the database on flow initial start. This is just another type of persistent storage of course... but the one advantage is that I have a historical reference, of all changes and when, that I can track or trend against. So when someone in the house claims they are NOT changing the thermostat several times a day? I have PROOF they did just that. LOL!

I use influxdb and grafana to log stuff such as setpoints, so if someone is fiddling with the thermostats that is obvious from the charts, so no need for a separate database.
Using retained topics in mqtt can be simpler that using a database or context as there is no need to add nodes to initialise the data on startup, it happens automatically as the flows are already subscribed to the topics. As always of course there are multiple ways of solving problems and there is no 'best' solution to the general problem.

Yeah, if I did not already have the database, and SQL DB was not second nature to my past IT experience, I likely would have done something different. As I start using more ESP modules for some planned projects, I figure I will look at different ideas, methods. If you have a 'personal' server room, that provides different options. :slight_smile: I always have a NAS up, and SQL trans-log shipping running for the SQL DB and its alternate.

Hi ,

Actually I use influxdb to log sensor data at a Raspi Gateway , never used the db for config changes or status , will think about it .

Thank you !

El dg., 25 d’oct. 2020, 20:38, Nodi.Rubrum via Node-RED Forum <nodered@discoursemail.com> va escriure:

DB is overkill... I used it because I had it available. If I was going to capture state from scratch, I like what @Colin suggested, and it is similar to what you did or have done.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.