When my latch broke, I ordered a replacement from rvupgrades.com . To do the repair, I had to drill out the latch in order to retract the bolt, which took a 20v power head and a good steel metal bit. Once drilled out, the replacement is pretty straight forward.
On my rig, the sensor for the steps in on the screen door. This sounds to me like it could be an intermittent short, or the sensor might have crud on it. Either way, steps are often an easy fix. I keep dry silicon lubricant for both the steps and the leveler struts, and spray them down before I retract struts when breaking camp.
HTH,