Responding to myself
To be able to use above the addon jscon-cec needs to be installed:
Why it was working day 1 must have been that I accidantally must have been invoking this ssh command instead of the kodi addon: /usr/bin/ssh [email protected] "systemctl restart kodi"
I can’t explain it in any other way.
Hope this helps others starting with home-assistant and libreelec
I have noticed that the android remote control app for kodi (libreelec) called yatse is able to switch on the TV by using CEC activate found on the apps power menu.
This works very smooth and no need to restart kodi like the ssh commands
I can’t work out what command yatse is sending to kodi but I suspect it is the JSON-CEC Activate so I tried this using the same yaml as the original post and getting the same error in the logs.
I am fairly certain that JSON-CEC is installed as you can send other commands to kodi from the browser to look at the media library, etc
The error in the log is suggesting that the format of the command is wrong but the yaml matches the documentation as far as I can tell.
Does anyone have an idea how to edit the code to get it to accept the format?
the error I am getting is
Run API method media_player.kodi.Addons.ExecuteAddon({'addonid': 'script.json-cec', 'params': {'command': 'activate'}}) error: {'code': -32602, 'message': 'Invalid params.'}
I installed the network tool add-on and captured a tcpdump… it is not a HTTP request to the jsonrpc at all. Yatse sends some form of UDP packet which I’m not sure how to interpret
See CECActivateSource() from my phone clicking “CEC Activate” below
# lg 55la6620 tv
media_player:
- platform: lg_netcast
host: 192.168.1.230
name: LG Living Room TV
access_token: 412205
turn_on_action:
service: shell_command.kodi_cecactivate_for_tv
data_template:
kodi_ip: 192.168.1.44
command: "CECActivateSource()"
Hopefully hijacking this old thread will be useful for someone else one day