Adjustable Bed control -Leggett & Platt

Looking for ideas...

I have an adjustable bed. The remote is wired.
I was thinking that I could splice into the cable,
Identify the wires (there's only an up and a down button for the head),
Connect those to a relay such as a Zooz-Zen16,
Write a routine for up/down, keep up with current position.
Wish I could find an iOT inclinometer.
Has anyone done this or the like?