Today my team discovered a weird error when polling data from M-bus. The values didn't change, and apparently haven't changed in weeks. No errors or warnings. Most likely a physical device frozen / locked up. After a restart, updated values came in. So we did a lot of testing, including shutting down the gateway. And in fact mbus node continued to post data as if it was still connected! Turns out there are multiple time stamps in the data returned. One called lastUpdateTime
which shows current query time. But each value object also has a Timestamp
property, and this indicated why values weren't updated, as it was weeks old.
So effectively M-bus node caches values and returns latest even if disconnected! So to fix this, we calculated 5-min diff time between current time and record timestamp and handle errors from there.
Every time I work on a protocol in Node Red, we face weird details like these. Might be useful for someone else working with M-bus in node red.