tagyoureit / nodejs-poolController

An application to control pool equipment from various manufacturers.
GNU Affero General Public License v3.0
323 stars 94 forks source link

Acid Mixing: countdown timer bug? #311

Closed johnny2678 closed 3 years ago

johnny2678 commented 3 years ago

Describe the bug an (animated) picture is worth a 1000 words. Check out the mixing timer in this gif https://media.giphy.com/media/VKq3DtHdVJ9vFAzvFq/giphy.gif

To Reproduce Start a manual mix (i set for 60mins) watch the timer, it starts counting down from 60 minutes for 5-10 seconds, then starts bouncing back and forth between a 60 minute timer and a 5 minute timer coincidentally, 5 minutes is the mixing period I have set in chemistry settings after each acid dose

Packet Capture Follow the instructions to complete a packet capture and attach the resulting zip/log files.

replay (2).zip

Please let me know if I can provide anything else.

rstrouse commented 3 years ago

Would a QoS of 0 have avoided this problem?

In a word yes. But then njsPC would never know that somebody fat-fingered in a new number for alkalinity. Nixie handled it correctly in the beginning but was instructed later to abandon what she had already done which is the why of the problem. Don't overthink MQTT and its QoS. Frankly, MQTT is a tool that was developed for a purpose that got twisted into what it is being used for today. In my opinion it is a chat tool being used to send datagrams. This means that the act of publishing on the broker, regardless of the datagram content, resets the QoS.

The thing that made it insidious has more to do with a single line of code prior to Nixie starting up. this.length = 0 where this happened to be the list of chemControllers that Nixie was in charge of. That line simply cleared out the references so Nixie had to add it back in the spirit of robustness and constitution. I must have stared at that line a zillion times and didn't think anything of it until I saw that MQTT response.

Hope the project is better for it.

Yes the project is better for it. Something like that is one of those things that cause a project to have unexplainable behavior. That is the primary reason for such a dogged pursuit. As it turns out all Nixie equipment arrays were initialized in the same manner and in the spirit of defensive code that will be no more. Nixie is smart enough to know what she is in control of.

Only bourbon / tequila in my cabinets now. And a few drops from a bottle of Johnny Blue.

There is only one reason to keep Johnny Blue on hand and that is to keep laypersons out of your single malts. That my friend it defensive drinking.