How to use the API to learn if a data source or point is communicating or not
-
I'm trying to use the API to learn if a data source or data point is currently communicating. I've been looking at events and I can see that it logs when there are errors reading points, but I'm not sure if that's the same thing as not communicating. I also saw that realtime data GET says it "checks the status member to ensure the point is OK not DISABLED or UNRELIABLE," but again I'm not sure if that's the same thing. Can someone point me in the right direction as to what call actually deals with communicating vs not communicating? Thanks
-
Hi hrivers,
The most consistent sense of if a data source is working will be its data source events. The "unreliable" flag isn't implemented in all data sources (but it is in Modbus) so its use is limited as a general thing. We do intend to improve on that eventually. It's useful if you have many devices on the same data source where one device's points may have failed to read while overall the data source did perform a poll successfully.
Whatever you saw in the events table should have given more information as to the cause of the failure. In modbus, for instance, if it is a timeout you could conclude it is definitely not communicating. On the other hand, "Invalid checksum" very definitely means they're attempting to communicate, with one probably on the wrong baud or parity or other such serial setting. And, "Illegal data address" means they're definitely communicating, but one or more of the requested registers in the range read did not have permissions to be read.
Then you have something like a serial data source, which is so general purpose that the question can only be contextualized to a protocol for it to make sense what 'communicating' means to that setup. If it only spontaneously receives a message every 12 to 24 hours, is it communicating?
So, knowledge the data source type and the error message can often shed light on if it's a physical bus / client problem (timeouts), a configuration problem (funky results, error codes and serial errors), or a spontaneous error and all is actually well.
Edit: And that was not considering security. I have seen modbus devices that won't respond to any of your requests unless you've written the right value into the right register within the last X hours.
-
That makes sense, thank you!