UltraPro WFD4001 ADC filter?

The UltraPro WFD4001 switches are UL listed, have screw terminals, and work in a 3-way setup using simple “non-smart” switches on the opposite side. Ohh, and they are fairly inexpensive when buying in a 4 pack - Amazon.com: UltraPro Smart Switch, 2.4GHz Wi-Fi Smart Light Switch, QuickFit & SimpleWire, 3 Way Switch, Works with Alexa, Google Assistant, No Hub Needed, UL Certified, Needs Neutral Wire, White, 4 Pack, 51408 : Industrial & Scientific

The big problem is the way the manufacturer implements the 3-way sense. They used an ADC to read line voltage from the second switch. This results in a fluctuating reading so you can’t simply say an ADC value of x = on, and an ADC value of Y = off.

The folks in the OpenBeken forums have figured out a nice work around in this post: https://www.elektroda.com/rtvforum/topic3953644.html In short, they wrote a driver that seems to “smooth” out the fluctuations of the ADC output to determine when the 2nd switch is on or off. The code for the “smoother” is here: OpenBK7231T_App/src/driver/drv_adcSmoother.c at 5eaf5c79264c372c47a2cc80247ce2653a22b2a6 · openshwprojects/OpenBK7231T_App · GitHub

I THINK the ESPHome sensor filters: Sensor Component — ESPHome are what’s needed in order to make this switch work with ESPHome. But I can’t get my head wrapped around which filter or how to implement it with an ADC input.

I have the switch working very well using OpenBeken using the forum post listed above, but cannot get the 3-way operation working using ESPHome.

Any thoughts? More info needed?