Stale / Old Data

I have Signal K working and have built a SensESP to monitor AC voltage and current, all works well and data shows in Signal K. But when AC voltage is removed the power to the SenseESP is removed so the data just remains in databroswer (and on dashboard) with the old values... how do i set data (all data really) to show as stale and dissapear when its over a certain age?
12 Replies
gregy
gregy2w ago
@MattNJ i have just been thru this same process. I solved it using nodered - i will post my flow as an example . however i also solved a similar problem with sensESP using a Last gasp” circuit “ (supercap powered) the sensESP is powered for a short period (eg 15 seconds) via a suppercap - after its power is removed - during this period it continues to report the updated value , eg 0 volts after the power is removed https://github.com/gregsyoung/ESP32-sensESP-Last-Gasp-Circuit so the data still goes stale - but with 0volts as the last recorded value
gregy
gregy2w ago
No description
gregy
gregy2w ago
the trigger node is setup to - send nothing but wait for 20seconds - then send a zero - it has "extend delay if new msg arrives " enabled hence the trigger is continually reset (doesnt trigger) when periodic updates recieved - if the path stops updating, after 20s it will send a 0 value out to the path Note: there will be two entries in sk data browser (original source plus a second one from nodered source) provided your dashboard does NOT have a source selected .. it will just update its value from the more recent source - which will be the one triggered after the 20s and eg set to zero the data in both paths will still go stale, but the more recent path will be updated to zero, and in my experience (im using wsk for dashboard display etc ) the data (eg 0) from the more recent path will be shown (not sure about other display apps etc) note that in both examples - the data remains stale - none of above "deletes" removes stale data ... not sure if there is a way for nodered to actually delete? remove" the skpaths altogether?
Teppo Kurki
Teppo Kurki2w ago
When data times out you should send null not zero, the sk method for indicating ”no data available” …and we really really should add this to the server, observing a per path timeout
MattNJ
MattNJ2w ago
i agree, all data should time out are we saying no data ever times out? position/SOG etc is all considered "valid" forever? I cant think of any boat instruments that keep old data forever.... so its looks like I need to Node-Red every single value? Thanks, so if i understand this correctly, then no data ever goes stale and i need to node-Red every value? wow that seems rubbish?!
gregy
gregy2w ago
@Teppo Kurki many thanks, updated to null, making a lot more “sense” now when using it in displays and wsk
MattNJ
MattNJ2w ago
Thanks, im struggling to set this up in Node-Red (newbie) any change of the screenshots for eah of those blocks?
gregy
gregy2w ago
i will send you the flow - which tou can import into nodered and then modify to your reqts… working on best way to get it to you hmm my flow is too big to post here … working to cut it down ..
gregy
gregy2w ago
snapshots of individual nodes in below will follow
No description
gregy
gregy2w ago
No description
gregy
gregy2w ago
No description
gregy
gregy2w ago
im assuming you know how to setup the skpath subscribe and send path value nodes… (the actual output path is setup with the change node ) .. i can post these also if you dont have experience with these the trigger node is the key .. thats the one that detects that incoming data is “stale” (in my example 20seconds) and then sends a “null” to skpath the trigger node is repeatedly “reset” when new data arrives from subscribe node … after no update for 20 seconds, it then send the null. @MattNJ let me know how you go
Want results from more Discord servers?
Add your server