I’m working on a binding that has a significant amount of data pulled back through an API. My problem right now is that I’m flooding the bus updating all of the channels when I get a JSON back through the API (which is every x seconds as configured on the thing). I don’t really have a particular need to store all of the data in variables as it’s not really relevant to anything minus updating the channels. I’ve used getState() in rules before to pull the current state of an item, but I’ve never used it inside of a binding to pull the current value of a channel. What I’d like to do is write a pass through function that checks the current value of the channel and if it doesn’t match, then and only then send an update. I did a few greps through the current code base and didn’t see anything that caught my eye. Can anyone point me in the right direction?
EDIT: To note, yes I’ve considered doing a Map of some sort to track the current state in the binding, just trying to not duplicate the wheel if a function already exists. If it doesn’t, I’ll setup a Map and just track that way.