18.03.2016, 12:04
Just finished successfully also the power-off control of another non-smart TV, through a Kodi media player (running in an RPi) connected to it via HDMI.
If anyone is interested, the code I used is the following:
Sends two CEC commands to the TV through HDMI. One is for swapping the TV source to the HDMI of KODI, and the second is for putting the TV to standby (the TV should be on this source in order for the standby command to work).
The KODI add-on used for the above script can be foundĀ here:
If anyone is interested, the code I used is the following:
Code:
require('socket.http')
socket.http.TIMEOUT = 5
data1 = socket.http.request('http://KODI-IP-ADDRESS/jsonrpc?request={"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"toggle"}},"id":1}')
socket.http.TIMEOUT = 5
data2 = socket.http.request('http://KODI-IP-ADDRESS/jsonrpc?request={"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"standby"}},"id":1}')
Sends two CEC commands to the TV through HDMI. One is for swapping the TV source to the HDMI of KODI, and the second is for putting the TV to standby (the TV should be on this source in order for the standby command to work).
The KODI add-on used for the above script can be foundĀ here: