Open natterstefan opened 6 years ago
Hm. I guess it is something you are not able to fix, are you? Because I just saw this: https://github.com/joshjowen/script.json-cec/issues/1
Unfortunately, I don't think that there is much I can do about it as you have already noticed. I'll leave this issue open but if you take a look at the source code you will see that the script really does very little itself, it just passes through the commands to KODI's built in functions
@joshjowen Yeah, I read through your code and got that you are not responsible. Must be somewhere else, maybe also my TV does not support it (only turn on but not turn off via CEC). Another reason to buy a new TV ^^ Thanks though.
@natterstefan my old Samsung series 5 LCD could only turn on, and not off via CEC.
You should be able to confirm this just using the cec-client commands over SSH first.
Confirm that ON/OFF works with cec-client first, and then we can try narrow down what the problem is. Of course restart Kodi or your raspberry pi after using cec-client given it kills the libcec functionality within Kodi.
Personally I've found the 3rd kodi cec function toggle not to do anything super useful.
I think given you've confirmed that JSON-cec is correctly sending the commands, and Kodi seems to be doing some form of action on it, we can rule these variables out.
Thanks,
Matt
@natterstefan @joshjowen
I found this code whilst implementing Kodi/Alexa and I thought "Hey!" what an excellent idea. Now - I did get the same response as you did in that the script successfully completes but nothing happens. But - I remembered a code snippet I used a few weeks back in relation to Kodi and CEC and there seem to be an issue with how you are calling the internal CEC function within Python.
I updated as follows:
if command and command[0] == 'activate':
#xbmc.executebuiltin('CECActivateSource')
xbmc.executebuiltin('CECActivateSource()')
elif command and command[0] == 'toggle':
#xbmc.executebuiltin('CECToggleState')
xbmc.executebuiltin('CECToggleState()')
elif command and command[0] == 'standby':
#xbmc.executebuiltin('CECStandby')
xbmc.executebuiltin('CECStandby()')
What I achieved was to atleast power ON my tv - but neither toggle nor standby works. Maybe this is something we can look into? :)
I just found this as well but cannot test before I get home:
https://forum.kodi.tv/showthread.php?tid=149356&pid=2253184#pid2253184
Basically it states:
Change:
<setting id="standby_devices" value="231" />
to
<setting id="standby_devices" value="36037" />
in
~/.kodi/userdata/peripheral_data/rpi_2708_1001.xml
(or equivalent)
@pittbull this sounds indeed promising. I am curious what you will tell us later.
Hopefully I can tell you that it works because yesterday the WAF hit an all time high when I introduced Alexa controlled KODI - with automatic tv power on. ;)
@natterstefan
I have now tested and achieved 100% success! 💃
This is what I did:
<setting id="standby_devices" value="231" />
to
<setting id="standby_devices" value="36037" />
in
~/.kodi/userdata/peripheral_data/rpi_2708_1001.xml
(or equivalent)Before changing the above file execute: "systemctl stop kodi" If this is not done the change will be reverted by Kodi.
Happy testing. :)
Hi @pittbull, sounds really promising. I have some questions:
Question 1
Question 2
Before changing the above file execute: "systemctl stop kodi"
Question 3
I also changed the commands in the script.py for the addon as stated in my earlier post but I will retest this weekend if these can be reverted after the other changes.
@pittbull Thanks for posting above.
I just did a fresh install of osmc on my Rpi3 today, and struck the same problem as you and @natterstefan where standby would not do anything.
Making the above change you suggested has fixed the problem.
I haven't done a diff of upstream, but I suspect
<setting id="standby_devices" value="231" />
is a somewhat recent change as my previous install had the correct value of "36037"
@natterstefan Q1:
osmc@osmc:~$ sudo systemctl stop mediacenter
or
osmc@osmc:~$ sudo systemctl stop kodi
Then change ~/.kodi/userdata/peripheral_data/rpi_XXXX_XXXX.xml with the following:
-<setting id="standby_devices" value="231" />
+<setting id="standby_devices" value="36037" />
Q2:
I get the vibe no. I suspect it shouldn't get touched unless it's a fresh install of kodi. Changes to this have persisted for me with reboots etc.
I have the same problem but using a Vero 4K (OSMC)... i can't find the file you guys are talking about.. the peripheral_data folder is just empty
@danmed Did you manage to figure out your problem?
I can't imagine the Vero4k OSMC differing too much from the RaspberryPi image.
@mattie47 The problem is that in the peripherals settings in OSMC, the standby device is set to none.. if you change it in there it fixes the problem.. The onyl issue i have now is that it only responds if the Tv is on the OSMC source.. if i'm on another source nothing happens :'(
The onyl issue i have now is that it only responds if the Tv is on the OSMC source.. if i'm on another source nothing happens :'(
I think for me I solve this by sending "on" and then "off". Sending on (at least with whatever I have configured) forces it to change source to Kodi, and then send off to turn off.
There should be some workaround for you, it's just a case of spending time figuring out how/what it is.
Thanks,
Matt
That's an interesting idea... i'll give that a go
I've encountered this (what @natterstefan had) with my new Samsung TV. When I get a chance, possibly this weekend, I'll try some of the tips above, but any chance of someone either merging into this code or forking their solution so a semi-luddite like me doesn't need to download, edit, install via zip, and can instead just not worry about me messing anything up? :D
I can't turn off my TV, too. Turning it on works...
The entry
<setting id="standby_devices" value="36037" />
is in the file rpi_2708_1001.xml
But I'm not sure, if there are other entries in this CEC settings file, which could cause this problem. Could someone, who successfully managed to turn the TV on and off, please post the complete content of the file here for comparison? Thank you!
With a fresh install of OSMC on a Raspberry Pi 3, connected to a 10 year old Sony, I got this to work after going into System > Input > Peripherals > CEC Adapter > "Devices to power off during shutdown". I also took additional steps (see #11 ) but I believe this one was the kicker.
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:
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:
But nothing happened... Even though I see:
13:08:06.350 T:1958453248 DEBUG: ToggleDeviceState - putting CEC device on standby...
.Any clues?