The log tells me that an action has been fired: “[homeassistant.components.kodi.media_player] Firing event to turn on device” and “[homeassistant.components.kodi.media_player] Firing event to turn off device”.
The actions to ‘turn-on’ and ‘turn-off’ are defined in configuration.yaml and working by themself.
Where can I find a stable ‘device-id’?
Do I have to go via an Automation, instead of a ‘shell_command’ or ‘rest_command’-action?
Any idea what I am doing wrong?
Use the UI to build your automation. Go to the device page for your Kodi instance (btw, if you want to stay with YAML, the address on that device page will give you the device id), and lick the + button in the “Automations” section, and choose “Use device as trigger” from the pop-up.