CEC issue with Kodi on NUC and Samsung TV

I have a problem where CEC is partly working but unable to (stable) select the HDMI source where Kodi is connected.

What happens: running hdmi_cec.select_device for (HDMI port 3 is where Kodi is connected, running on Intel NUC). The TV briefly switches to HDMI 3 but after 1-3 seconds switches to HDMI2 (= the port with the RaspberryPi / HASSIO).

I don’t know how to fix this. Anyone have a clue?

What I know:

  • Selecting other HDMI ports works correctly.
  • The HDMI port with Kodi does not show up in the CEC Scanner, the other ones do.
  • The problem is not the cable or the HDMI port (switching them out doesn’t help).
  • It sounds similar to Hdmi cec issue
  • Deleting entity_registry.yaml didn’t help.
  • Error log shows:

Error doing job: Task exception was never retrieved

Traceback (most recent call last):
File “/usr/lib/python3.6/asyncio/tasks.py”, line 180, in _step
result = coro.send(None)
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 260, in _async_add_entity
homeassistant.exceptions.HomeAssistantError: Entity id already exists: switch.hdmi_3

I hope you guys have an idea?