Giter Club home page Giter Club logo

script.json-cec's Introduction

Send HDMI CEC commands through Kodi's JSON-RPC.

Kodi addon allowing HDMI-CEC control via Kodi's JSON-RPC.

Requires at least XBMC v13 Gotham and currently supports latest version Kodi v17 Krypton.

Installation

Zip

Download the project as Zip and rename it as script.json-cec.zip. Use the GUI interface to install it in Kodi.

Copying

Clone the project and copy it to Kodi's addons directory, example: ~/.kodi/addons/

Accepted commands

  • 'activate' - Wake up playing device via a CEC peripheral
  • 'standby' - Put playing device on standby via a CEC peripheral
  • 'toggle' - Toggle state of playing device via a CEC peripheral
  • 'stop_and_standby' - Stop any playback and place the CEC peripheral on standby

Example JSON request:

http://localhost:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"activate"}},"id":1}

Example Curl Request

curl --header 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"activate"}},"id":1}' http://kodi/jsonrpc

script.json-cec's People

Contributors

joshjowen avatar mattie47 avatar peci1 avatar yankeegreggo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

script.json-cec's Issues

Get current TV state

Hi

I've been researching the possibility of determining the status of the connected TV and I know this can be done via cecclient however this makes Kodi lose control of the TV which I heavily use to control with the remote.

I was wondering if you could implement a feature in this plugin to retrieve the current device status so that I can query this via Kodi via Home Assistant and have a more reliable way of determining whether the TV is on (it's an old non-smart TV that doesn't even react to CEC standby command well, but it responds and reports its status well).

Thanks
Matt

Github release?

I was wondering if you could create an official github release.

Typo in json example with in the README.txt file.

Love the plugin, and works amazing with an house fulls of Pi's Kodo and a handfull of crontab + magic other fu.

Its looks like the example json called in the readme.txt dosent work if you coppy and past, in the latest few verson of Kodio and XBMC.

http://localhost:8080/jsonrpc?request={“jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec”,”params":{"command":"activate"}},"id":1}

But if you rewrite it from scratch it dose. like:

http://localhost:8080/jsonrpc?{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"activate"}},"id":1}

After some hair pulling i noticed that the top staments contains two diffrent types of speech marks ” ", witch seems to calues an (00:05:33 T:1351996480 ERROR: JSONRPC: Failed to parse '{“jsonrpc":"2.0","method":"addons.ExecuteAddon","params":{"addonid":"script.json-cec”,”params":{"command":"activate"}},"id":0}').

Thank to the magic of Notepad++ and a few online json validator.Ive attached a screen dump that higlate the issue.
json bug

DEBUG: ToggleDeviceState - putting CEC device on standby... - but nothing happenes

Hello,

first of all - thanks for making such a great script. It looks very promising. But I am not able to make it work. The following issue occurs (originally posted here):

(...) The Pi answers (get the following response) but the TV doesn't act (eg. turn on).

My Request and the Response:

  • /jsonrpc?request={"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"standby"}},"id":1}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "OK"
}

Am I missing any setting (firewall) or something? Or should it work kind of out of the box?

Edit: Taking a look into the kodi.log reveals the following:

13:08:05.720 T:1491071984   DEBUG: CWebServer[80]: request received for /jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.json-cec%22,%22params%22:{%22command%22:%22standby%22}},%22id%22:1}
13:08:05.736 T:1305474032   DEBUG: Thread LanguageInvoker start, auto delete: false
13:08:05.737 T:1305474032    INFO: initializing python engine.
13:08:05.737 T:1305474032   DEBUG: CPythonInvoker(29, /home/osmc/.kodi/addons/script.json-cec/script.py): start processing
13:08:06.222 T:1305474032   DEBUG: -->Python Interpreter Initialized<--
13:08:06.223 T:1305474032   DEBUG: CPythonInvoker(29, /home/osmc/.kodi/addons/script.json-cec/script.py): the source file to load is "/home/osmc/.kodi/addons/script.json-cec/script.py"
13:08:06.224 T:1305474032   DEBUG: CPythonInvoker(29, /home/osmc/.kodi/addons/script.json-cec/script.py): setting the Python path to /home/osmc/.kodi/addons/script.json-cec:/usr/lib/python2.7:/usr/lib/python2.7/plat-arm-linux-gnueabihf:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0
13:08:06.224 T:1305474032   DEBUG: CPythonInvoker(29, /home/osmc/.kodi/addons/script.json-cec/script.py): entering source directory /home/osmc/.kodi/addons/script.json-cec
13:08:06.225 T:1305474032   DEBUG: CPythonInvoker(29, /home/osmc/.kodi/addons/script.json-cec/script.py): instantiating addon using automatically obtained id of "script.json-cec" dependent on version 2.1.0 of the xbmc.python api
13:08:06.336 T:1305474032    INFO: CPythonInvoker(29, /home/osmc/.kodi/addons/script.json-cec/script.py): script successfully run
13:08:06.344 T:1305474032    INFO: Python script stopped
13:08:06.344 T:1305474032   DEBUG: Thread LanguageInvoker 1305474032 terminating
13:08:06.350 T:1958453248   DEBUG: ToggleDeviceState - putting CEC device on standby...

But nothing happened... Even though I see: 13:08:06.350 T:1958453248 DEBUG: ToggleDeviceState - putting CEC device on standby....

Any clues?

CEC issues with Jarvis

Since upgrading to Kodi 16 (Jarvis), I've been unable to pass commands. Both standby and activate look like they are accepted, but my TV is no longer affected.

This may be a difference in how Jarvis handles CEC as my cronjobs using cron-XBMC to pass CECStandby and CECActivateSource are not functioning either.

I'm running OSMC on a Raspberry Pi 2. The TV is turned off and on when kodi is shutdown and restarted, so the functionality remains.

Is this just me or are others seeing similar results?
Thanks!

Does not work with Apple TV

I've installed the add-on on kodi on my Apple TV and it seems to be running but my Samsung TV does not respond to its commands. I've tried several methods, including direct URL, a python script, and an Indigo plug-in with no success. No errors, but no TV control. Should this work with the Apple TV? Thanks.

Not working on Kodi Matrix

Impossible to install on Kodi Matrix 19 (maybe due to python 3 vs phyton 2?)
Is there a version working with Kodi 19?

Kodi 18.6 Leia

Hi. Are there any plans to make it compatible with version 18.6 Leia?
Thanks and kind regards!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.