Is there a way to pass the last updated info to NodeRED?

Is there a way to provide the last updated data (Seconds) to NodeRED?


Dave - can you be a little more specific? Are you looking for a data input on the emonPi (for example: power1, or power2, or vrms)? Or for the feed data? or??

If you’re looking for power1 on the Input page, you can subscribe to MQTT like this:

1 Like

Sorry its difficult to explain, I’ve taken a screenshot below.

Dave - send a screen shot of the entire screen. The small part you sent won’t help with your questions.

Sure Jon, please see below.

That helps!

Now expand theby clicking on the plus sign. And then send another screenshot. Circle the Key or Value you want to pass to NodeRED.

Do you really want to send those times to NodeRED? To the best of my knowledge, those are when the screen is refreshed and indicate the time elapsed between processing the input and redrawing the screen. I think (but I’m not absolutely certain) that the data will be forwarded immediately as the input/feed is processed, i.e. when that time was zero.

I don’t think there is a way to do this. There is not API to access last updated.

I think I understand what you are saying - he wants to know how many seconds ago the node emonCMS was updated (in his pic 4 seconds ago). I took it to mean he was looking for the last data value. Good save!

@Dave - what is it you are looking for?

Ahh thanks Glyn, I think that answers the question.
Jon yeh I was trying to implement a watchdog type system that checks to see if emonhub had crashed so I could issue a restart command.


search for watchdog or watchdog nodered on the old forum:

There is a nodered based watchdog for monitoring something similar. I’m not able to locate it at the moment but I’ll take a look later today.

Found it → Feeds stop updating

Look for the alert.txt file and import it into node-red. That should get you started with creating a watchdog type system.

Thanks @Jon and @Paul that’s perfect!
I know its not a fix but a good workaround, I modified the script to restart emonhub if no updates after 60 seconds.

Thank you very much


I’ve further modded the node-red flow to create a logfile of every occurrence that the reset script is run, and saves it to /home/pi/watchdog.txt.
I’ve attached it below.
Out of interest, my reset script has been called 162 times since April

.watchdog.txt (2.5 KB)


Thanks Paul, I noticed you posted that flow in the old forum, which I used, the main difference for me was issuing a sudo service emonhub restart
I seem to have a crash every 3 or so days, I’ve been trying to stop emonCMS precesses and nodeRED posting to MQTT to see if that makes a difference.