Hey ,
I am an experienced software developer , with specializing in IOT systems.
I totally understand your use-case and what is that you want to achieve also I can understand the issue you are facing because I designed something exactly similar for my other project and went through the same issue.
I can totally help you out in this regard , and I am pretty sure that it won't take more than an hour to fix and test it, also you need not to worry regarding the reliability and it's been more than 1.5 years when I did this in my project and the project is still live and running without any issues.
So , Let's connect for further conversation and get done with it ASAP.
Thanks