I see. So the only constant state here is the break, and the duration for highs and lows but the entire transmission could take any # of seconds.
Here’s what you can do. You can attempt to look for that 4-sec break. THat’s only indicator you are on a fresh state since the your code could basically start listening at the middle of the message. Also, you have to ensure from the specs/docs that every message must NOT end with a low, since the 4-sec break will account for that too.
Can you give/provide the table? Does your table account for lows also, or just highs? For example, in Morse code, both shorts and longs have different meanings. But if your table only account for total # of highs, and not a combination of high-low sequence, then this is just a matter of counting it per the 4-sec break cycle.
For the Honeywell water heater I monitor. It’s just the total # of highs so it was easy.
Give me the table and I’ll cook something for you