msvargas / node-logix

Node.js package to read/write data from Allen Bradley Compact/Control Logix PLC's
MIT License
13 stars 3 forks source link

Usage question: Tag change event #20

Open intensite opened 11 months ago

intensite commented 11 months ago

Not an issue per say, more a usage question.

Is it feasible/possible to code an event to trap when a PLC tag value changes? Some kind of a subscription system. I would like to publish to a MQTT topic, but only if the tag value has changed.

If no built-in feature allows for this, I was planning to implement an array of "tag objects" that would hold something like ( tagName, lastValue, currentValue ) and then regularly poll & compare the currentValue with the lastValue for each tags to be monitored.

Not the most elegant. Do you have a better solution?