AVR keeps turning on after turning off TV (when Apple TV 4k is connected)

I’ve got an assortment of S905/S905X boxes running CoreElec 9.2.2. Recently I bought an Apple TV 4k (5th generation) , and after I plugged in the Apple TV 4K into the AV receiver which also had the CoreElec box, I started experiencing a strange issue where my AVR would keep turning back on seconds after I turn off the TV. This appeared to be a classic CEC issue.
I set about investigating the issues Apple TVs online and came across the post below which mirrored my experience. https://forum.kodi.tv/showthread.php?tid=327971
I copied the following patch from OSMC https://github.com/osmc/osmc/blob/master/package/libcec-osmc/patches/all-005-fix-avr-turning-back-on.patch and compiled CoreElec from source.
This patch has solved my issue with no apparent side-effects.

I’m posting here to help those who have perhaps been suffering in silence or have had to resort to less than ideal methods to work round the issue. like turning CEC off.

Dear Devs, Can you please apply the patch future releases of CoreElec?

My hardware setup is listed below although other combinations my have the same issue.
TV: LG B7 OLED
AVR: Sony STR-DN1080
BluRay: Sony UBP-X700
Other: Apple TV 4K

1 Like

Thank you for reporting your findings.
Either Dev @Portisch @anon88919003 will respond regarding this issue.