CEC adapter is set to not do anything but stop playing when TV is turned off. However my TV turns back on after a few seconds. This doesn’t always seem to happen. But it happens quite often.
You would need to give a precise time when this happened otherwise no way to find any relevant area in the logs.
Also may need to enable component specific logs (for CEC).
Have you tried a different HDMI cable? Also, in Kodi’s CEC settings you have “switch sources to this device on startup” disabled?
No. I don’t have another hdmi to micro hdmi just laying around. Only hdmi to hdmi ones.
I do have one connected to another pi4 but it faces the same issues.
I do have that set to disabled, although it seems to be ignored. When i switch the source and reboot the pi it switches back.
I think that would be the RPi telling the TV to turn on before Kodi ever loads. You can try adding the following to config-user.txt to see if it stops that…
hdmi_ignore_cec_init=1
You might also try clicking the default settings in the CEC settings dialog and see if that does something to help. Just make sure you press the OK button and not hit back/exit on the remote as that will not save the change.
Seems to be working. At least for now.
Could this in theory also fix the TV randomly turning back on after being turned off?
It didn’t turn back on this time but like I said before it doesn’t always happen.
I’ve tried this before and didn’t help.
I honestly don’t know. I think there is something a bit odd with LG TV’s in this regard. One of my TV’s is an LG and it will turn my AVR on after a few seconds of everything being turned off with the remote and then the AVR will turn off again after 20 seconds or so. Oddly enough it only seems to do it in the afternoon when i’m done for the day. Normally if I turn it off to try to test it any other time of the day it doesn’t do it. It does it currently with only a Vero plugged in, and it did it previously with only a RPi plugged in. My best guess (and really that is all that it is) is that the TV it turning itself back on partially probably to check for updates and that is where the problem comes from.
My TV never turns back off, though. Odd.
I’ve never had this issue with an RPI3 and the same setup.
Usually I switch sources and then turn it off. When I do that it never happens.
Sometimes I forget to do so.
Can you share the content of your ~/.kodi/userdata/peripheral_data/cec_CEC_Adapter.xml
file (it is not one of the things we parse in our log uploader).
I had this exact problem some time ago, my abject apologies that I cannot remember the exact resolution. I can, however, tell you what I found.
We would stop playing a video on OSMC.
Turn off the TV (a Sony Bravia).
The TV would turn back on.
After some digging and trial-and-error, at least in our case, the TV was turning back on after the OSMC timeout period when the display was set to go to dim. If I extended that time it extended the time before the TV came back on.
Sorry I can’t remember what CEC settings I changed (or even if it was on OSMC or the TV), but I did get it resolved. Hope this helps as a possible place to look.
<settings>
<setting id="activate_source" value="0" />
<setting id="button_release_delay_ms" value="0" />
<setting id="button_repeat_rate_ms" value="0" />
<setting id="cec_hdmi_port" value="1" />
<setting id="cec_standby_screensaver" value="0" />
<setting id="cec_wake_screensaver" value="1" />
<setting id="connected_device" value="36037" />
<setting id="device_name" value="Kodi" />
<setting id="device_type" value="1" />
<setting id="double_tap_timeout_ms" value="50" />
<setting id="enabled" value="1" />
<setting id="pause_or_stop_playback_on_deactivate" value="36044" />
<setting id="pause_playback_on_deactivate" value="0" />
<setting id="physical_address" value="2100" />
<setting id="power_avr_on_as" value="0" />
<setting id="send_inactive_source" value="1" />
<setting id="standby_devices" value="231" />
<setting id="standby_devices_advanced" value="" />
<setting id="standby_pc_on_tv_standby" value="36044" />
<setting id="standby_tv_on_pc_standby" value="1" />
<setting id="tv_vendor" value="0" />
<setting id="use_tv_menu_language" value="1" />
<setting id="wake_devices" value="231" />
<setting id="wake_devices_advanced" value="" />
</settings>
The display settings in kodi? I have those set to none so it should never dim whatsoever.
I’m pretty sure that not only is that not a default value, but it is not even a valid one. If the defaults button is not working for you then I would stop mediacenter, delete that file and then start mediacenter again which will make sure you have clean CEC settings. Also be aware that there may be some instances with sleep and wakeup settings where they will send a toggle state command and not an explicit on/off. This can lead to behavior such that one device turns off which causes a trigger on a second cec device that sees the power state change and due to a setting for syncing power state or similar it sends a power command to toggle power state causing a device to power back on. CEC can be a bit of a mess and sometimes settings you think will do one task don’t quite work out as expected.
As for that physical address you set, that should have stayed at 0. If you were trying to get your device to be recognized as something other than recorder 1 to work around some bug then you would need to stop mediacenter and manually edit the file above so <setting id="device_type" value="1" />
got changed to <setting id="device_type" value="4" />
which would make it player 1 instead.
Ok so everything was off (TV and AVR).
I went and stopped mediacenter and removed the file.
Once I started mediacenter again everything just turned on (TV normally triggers my AVR which is intended, but the TV turning on isn’t).
I made sure the file wasn’t there once restarted. After another restart of mediacenter the content is as follows:
<settings>
<setting id="activate_source" value="1" />
<setting id="button_release_delay_ms" value="0" />
<setting id="button_repeat_rate_ms" value="0" />
<setting id="cec_hdmi_port" value="1" />
<setting id="cec_standby_screensaver" value="0" />
<setting id="cec_wake_screensaver" value="1" />
<setting id="connected_device" value="36037" />
<setting id="device_name" value="Kodi" />
<setting id="device_type" value="1" />
<setting id="double_tap_timeout_ms" value="300" />
<setting id="enabled" value="1" />
<setting id="pause_or_stop_playback_on_deactivate" value="36045" />
<setting id="pause_playback_on_deactivate" value="0" />
<setting id="physical_address" value="2100" />
<setting id="power_avr_on_as" value="0" />
<setting id="send_inactive_source" value="1" />
<setting id="standby_devices" value="231" />
<setting id="standby_devices_advanced" value="" />
<setting id="standby_pc_on_tv_standby" value="13011" />
<setting id="standby_tv_on_pc_standby" value="1" />
<setting id="tv_vendor" value="0" />
<setting id="use_tv_menu_language" value="1" />
<setting id="wake_devices" value="36037" />
<setting id="wake_devices_advanced" value="" />
</settings>
That value strange enough comes back as 2100
Since my TV turns on whenever mediacenter boots I changed it to:
<settings>
<setting id="activate_source" value="0" />
<setting id="button_release_delay_ms" value="0" />
<setting id="button_repeat_rate_ms" value="0" />
<setting id="cec_hdmi_port" value="1" />
<setting id="cec_standby_screensaver" value="0" />
<setting id="cec_wake_screensaver" value="1" />
<setting id="connected_device" value="36038" />
<setting id="device_name" value="Kodi" />
<setting id="device_type" value="1" />
<setting id="double_tap_timeout_ms" value="50" />
<setting id="enabled" value="1" />
<setting id="pause_or_stop_playback_on_deactivate" value="36044" />
<setting id="pause_playback_on_deactivate" value="0" />
<setting id="physical_address" value="2100" />
<setting id="power_avr_on_as" value="0" />
<setting id="send_inactive_source" value="1" />
<setting id="standby_devices" value="231" />
<setting id="standby_devices_advanced" value="" />
<setting id="standby_pc_on_tv_standby" value="36044" />
<setting id="standby_tv_on_pc_standby" value="1" />
<setting id="tv_vendor" value="0" />
<setting id="use_tv_menu_language" value="1" />
<setting id="wake_devices" value="231" />
<setting id="wake_devices_advanced" value="" />
</settings>`
Actually it turns out that was correct after all. I didn’t remember that getting set in previous versions of OSMC and in a bit of a brain fart the file I pulled up to compare against was on my one machine that has the CEC pin physically disconnected. I just checked my other four boxes and sure enough they actually have this set and “2100” is a valid setting. Mea culpa.
For now I’ve come to the following conclusion:
- I need to set
hdmi_ignore_cec_init=1
in/boot/config-user.txt
for the RPI not to turn on my TV while booting - I need to set
<setting id="wake_devices" value="231" />
in~/.kodi/userdata/peripheral_data/cec_CEC_Adapter.xml
for kodi not to turn my TV on while restarting mediacenter
I’ve used this before except for the first one so I doubt this really changes anything, but we’ll see. It just happens every so often so usually debug mode is disabled because of the text in the upper left corner so it’s kind of difficult to get logs out of it.
I’m also surprised I have to set the first one since I never had to using an RPI3.
That setting was present with the previous version of OSMC. I don’t know why it was removed.
I have the same problem with a Samsung TV, some similar issue is here: https://discourse.osmc.tv/t/tv-gets-turned-on-via-cec-command-after-upgrade-to-2021-08-1
I already tried all posible solutions from both threads.
I need to disable CEC in the TV or reboot OSMC to avoid the TV to turn on after the video stopped.
Can you elaborate a bit on what exactly you mean by this. If you reboot Kodi before shutting down it doesn’t turn right back on, randomly turn back on, ???. After the video stopped means after your done watching TV or are you playing a video with the TV off to just hear the sound?