I finally have my Onkyo controller sending CEC button presses but how to block power off

I found out how to make my Onkyo Receiver send button presses to my PI and it is nice, not even just the unused buttons like I hear is the normal. I found a remote code for CEC to make the BD/DVD source send all the buttons.

Now my problem is when in that mode it also sends the shut down command when hitting the power button which is understandable and correct but I don’t want that and always forget to change to the Receiver or TV source buttons first (thanks to CEC both of them have linked power buttons)

I just want my Pi on 24/7 and need to block my accidentally shutting it off.

This power off is not the easy one from the peripherals setup in Kodi I have that set to ignore fine and when I shut off the TV and Receiver the Pi stays on.

This shut down is only the Pi going off and it leaves the TV and Receiver on.

I was successful, I had thought of this but thought it might break stuff like shutting down from a phone app but I tested anyway and it is good enough and didn’t break anything.

in remote.xml I just changed the from shutdown() to something else.

I still hate hitting the button but at least it is now a minor inconvenience instead of a big problem. Since the Receiver and TV still react like it was shutting down. The TV shows a message that it is disconnecting the Anynet+ device for a couple seconds then the Receiver auto changes sources to the TV input. But when I just change back to the Pi’s source it is still running fine.

@shadow

Would you mind sharing your full configuration file and any other methods you used for this as there are others, myself included, having difficulties with Onkyo amps/remotes and CEC. I’m sure we would all appreciate it, very much, thank you.

Duke

Not much for configuration changes to stop the shutdown just edit remote.xml and fair close to the start at the line replace shutdown() with another command I chose Pause so if I accidentally hit it, it would pause my show will the TV freaks out and changes inputs.

For anyone that has not found the universal remote CEC codes for a Onkyo receiver here is some info I found.
Only the BD/DVD and TV can use them and have different codes. So you have to have your Pi on the BD/DVD input for the code that has been successfully tested.

To program a code hold the BD/DVD and Display buttons for 3 seconds until the light goes solid.
Type in 32910 then the light should blink a couple times and go out.
That is all
Here is a list of other codes note I did this on a TX-SR606 even though this manual is for a different model it worked so they’re generic Onkyo codes TX-NR636

I did have one issue after waking up where it was not working. My setup is Pi plugged into Onkyo Receiver then A Samsung TV.
When I woke up the button presses had stopped working strangely because my TV lost the connection to the receiver which is not even between them. As soon as I set the speakers back from TV speakers to Receiver the button presses started working on the Pi again. I have had that issue rarely before so it was not caused by setting up the button passthrough.

If anyone has similar problems I found my problem with stuff not working all the time.

I did have a good High Speed HDMI Cable between the Pi and my Receiver but I had a very old 1.3a cable between the Receiver and TV which apparently even though it was not between the two devices still messed up the whole CEC network. I swapped it out for a newer one and everything works perfect now.

I guess when it comes to CEC having a weak link in the chain no matter where can be a problem.