So my Philips TV (2010) has limited interaction possibilities, I use a few via the Jointspace binding. I cannot switch on the TV as Jointspace is only capable of sending commands when the TV is on. However the TV supports the CEC protocol via HDMI (more info: wiki).
My Media/TV setup: RPi 3 with LibreElec installed running kodi v16.x. The RPi and Kodi support sending CEC commands to the TV. I use the XBMC binding to interact with Kodi, which all works well. The 1.x XBMC binding supports Input.ExecuteAction, but cannot execute built-in Kodi functions as far as I understand.
I made it work by using the exec binding:
rule "Switch the TV on via CEC/Kodi"
when
Item TVOn received update ON
then {
logInfo("RULE", "TV is switched on")
val String FeedbackScript = executeCommandLine('ssh@@root@192.168.xx.xx@@`echo@@"on@@0"@@|@@cec-client@@-s`', 10000)
logInfo("RULE", FeedbackScript)
}
end
A prerequisite is that you don’t need a password when using the ssh
command, by shared keys. Also you need to add ssh
to visudo
.
But to me this looks like a suboptimal solution and I would like to understand the following:
- Is there a smarter way to execute a
Kodi built-in function
likeCECActivateSource
? Kodi wiki.
Thanks.
Btw, this is a good post to sort out any troubles with the exec binding, it helped me a lot.
https://community.openhab.org/t/how-to-solve-exec-binding-problems/18131
EDIT: Updated by removing the script I used to circumvent the non-functioning of the exec binding directly from openHAB.