Yale YRD240 lock won't stay locked

Lock is very close to the hub. I can literally touch both of them if I stretch my arms out.

I’ve noticed as well that the factory supplied batteries are not optimal, but I haven’t yet tried swapping them.

What ended up working for me is switching to this custom Device Handler:

As described here:

Not sure exactly why I’m having this problem and most others aren’t. I have another YRD240 coming this week and I’m curious to see if the default DH works with it or if I have to switch to this custom one as well.