libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Questions and comments specific to a particular plugin should go here.
seanwalter
Posts: 3
Joined: Sat Oct 28, 2017 8:30 am

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by seanwalter » Sat Oct 28, 2017 9:20 am

I really like the direction this plugin is headed. The UI and the action definitions are really fantastic vs. previous versions.

I have spent a while with the latest version of this plugin (1.2.3b) trying to get it to work, and have only been partially successful. I have a Sony Bravia TV, a Denon Amp, current firmware on my Pulse-Eight device, and the latest libCEC from kgschlosser's link above. I am running Windows 10 64-bit with an AMD Radeon HD series video card. I am running EG 0.5 rc4. Before testing, I did a clean EG install including deleting my EG %appdata% folder before reinstalling, and I am working from a clean tree.

I have tried setting the plugin to use HDMI ports 1 through 16, and get the same result every time...

EG can control the TV (power off, power toggle, etc), but EG does not receive most events from button presses on the remote control.

It receives only the following events:
  • Volume changes
  • Power On (though the event this triggers shows up as SonyTV.Source.Recording Device 1 -- in case it's not obvious, I have named my device SonyTV in the plugin configuration)
I have pressed most other buttons on the remote and these do not show up as events in EG -- left, right, up, down, select, the colored buttons, numbers, etc...

The button presses do get recorded in Pulse-Eight's CEC Test Client, and if I turn off the plugin within EG I can enable the CEC Adapter in my Kodi installation or I can open up the Pulse-Eight CEC Test Client, and it works fine in both of these. I also am able to capture most button presses in EG using older versions of the libCEC plugin -- each version has been slightly quirky, so I was hopeful this version would finally work out all the kinks.

In testing, I have noticed a couple of things, though I admit I do not understand CEC all that well so some of this may not matter:
  • CEC Test Client shows my TV as device 0, but I cannot select HDMI Port 0 in the config for this plugin
  • Configuring the plugin to use HDMI Port 8 causes the TV to be turned off and back on
    (A few other HDMI ports above 8 do this as well -- I forget which ones)
  • It doesn't seem to matter if I configure the plugin for AVR Volume Control or not
  • Randomly as I was typing this, three events showed up: SonyTV.AVR.Disconnected, SonyTV.AVR.Connected and SonyTV.AVR.Power.On -- might be a loose connection on my end, but in the last ~3 hours I have not seen any of these messages until now
I am also seeing Luca Brasi's issue that the dropdowns for various actions do not populate right away -- but if I open the action to configure it, close it, and reopen it, the dropdown will be populated.

Finally, the minimum polling speed of 0.1 seconds is still a little slow vs. the rate at which my signals are generated. If I press the volume button once, sometimes EG does not record it. Given this, with all my testing I have been holding the Left or Right buttons down for extended periods to ensure EG has time to capture a signal.

User avatar
kgschlosser
Site Admin
Posts: 4245
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by kgschlosser » Sat Oct 28, 2017 3:04 pm

ok let me start off by saying TY for trying the plugin. and TY for the very detailed bug report. This is going to help me quite a bit.


The HDMI port setting in the config panel for a specific CEC adapter is the port number it is plugged into on a device. so if you have it plugged into your Bravia TV. it would be the port number on the TV that the CEC is plugged into.

The polling loop I have set up is to add some events. for things like powering off and on a device and volume changes. how this works is every x seconds it asks for the volume. and if the volume has changed from a cached value then it triggers an event, As i am sure that the CEC adapter can only do one thing at a time. there could be a clash between receiving various information from the CEC. I am making an attempt to try and get information from the CEC that to extend it's functionality. You may want to try and slow the polling speed down and see if that has an affect on things reporting back properly. The default setting of 0.1 might be to fast and there could be a collision somewhere.

I am going to have to add a pretty indepth debugger to really see what is transpiring. I am also going to have to dig out my Samsung TV and fire it up to test this thing because my projector does not allow for anything besides some very basic functionality.

It is going to be a little while before I can get the time to set up a proper test setup so if ya hang in there for a little while I will get this going properly. I feel the plugin is a good step in the right direction we just have some kinks to iron out of it.
If you like the work I have been doing then feel free to Image

User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by Luca Brasi » Sun Oct 29, 2017 1:03 pm

kgschlosser wrote:
Fri Oct 27, 2017 11:56 am
I am in the process of upgrading a section of my media room when the electronics are installed I will be able to test the CEC adapter again. You will have to give me about a week to be able to get to the point with the remodel where all the electronics are working again.
Allright. Ready when you are Sir
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi

User avatar
kgschlosser
Site Admin
Posts: 4245
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by kgschlosser » Sun Oct 29, 2017 3:45 pm

I am going to be working on getting the Media room back together later today. I have to go to a buddy's house and hook up a furnace and do up the exhaust pipe for it. then i will be headed home.. I do have to take an hour or 2 in the evening to carve up some pumpkins with the wife. It's her favorite holiday.

I hope to get some time in to work on it. The guy i am doing up the furnace for has the "Gift of gab" which makes things take a really long time to do.
If you like the work I have been doing then feel free to Image

seanwalter
Posts: 3
Joined: Sat Oct 28, 2017 8:30 am

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by seanwalter » Mon Oct 30, 2017 1:30 am

Thank you for your replies.
You may want to try and slow the polling speed down and see if that has an affect on things reporting back properly. The default setting of 0.1 might be to fast and there could be a collision somewhere.
I just tried 0.5s and 0.8s with the effect that the plugin does not capture as many volume change events as when it is set for 0.1s. No additional events are captured.
The HDMI port setting in the config panel for a specific CEC adapter is the port number it is plugged into on a device. so if you have it plugged into your Bravia TV. it would be the port number on the TV that the CEC is plugged into.
I did some testing using Kodi's CEC input capability and confirmed HDMI port 4. I will use this port going forward. Note that explicitly setting port 4 in the EG plugin had no effect on detecting events.
I feel the plugin is a good step in the right direction we just have some kinks to iron out of it.
I completely agree, and appreciate you taking this on. The prior versions from Pulse-Eight have mostly worked, though each has had its own limitations as well -- one of them was not capturing power on/off events, one did not report presses of the Stop button on the remote, etc. So I'm a bit used to finding workarounds, though since this version is reporting very few events there's only so much I can do with it :wink: . If I knew how to code in modern languages I'd offer to help more...

User avatar
kgschlosser
Site Admin
Posts: 4245
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by kgschlosser » Mon Oct 30, 2017 2:37 am

OK I want to explain CEC.

It does not provide any events except for button presses on the remote. and the remote events are supported by very few devices. and of those very few devices hardly any if not all of them do not support all of the buttons.

So when you see the events for things like the device power and the volume the only way I am able to achieve this is because I have the plugin asking for this information every 0.1 seconds or whatever it is you decide to set the value to. Now I have heard reports of CEC not working like it is supposed to. and it may give an answer whenever it feels like and not necessarily in the order in which it was asked if it even replies at all. Because of this very annoying issue there is no way for me to guarantee 100% on events for power volume mute.. so on and so forth. There is also one other issue with CEC. it uses such a horribly low voltage and has such a tight margin for variation in the voltage if you have extended distances I believe they say > 10ft you can have problems. well I will specifically tell you of one. and you probably know of this issue because it also exists on the EDID wire of HDMI. Samsung TV's have this issue as well as my Epson projector. when the device powers up you will get a Power On Message. then when it turns the lamp on or the Screen on a samsung. You will get a Disconnect message. then a Connect message. this is because of the initial inrush needed by the device to "turn the lights on" causes the voltage to dip on the EDID and CEC wires and if your distance is > 10ft the voltage seen at the CEC adapter is to low and it cannot read it and there for thinks the device has disconnected.

This is what causes Windows to go all crazy with your icons and moving crap all around if you have a TV plugged in to your PC in multi monitor. it is because it cannot see the EDID data and assumes your monitor got disconnected and shifts you back to a 1 monitor setup. messing up your whole desktop. and then it reconnects it and a lot of times it ends up making a whole new device for the TV because the data received was corrupted because the voltage wasn't up all the way and changes the primary monitor and make a complete mess of everything.
If you like the work I have been doing then feel free to Image

seanwalter
Posts: 3
Joined: Sat Oct 28, 2017 8:30 am

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by seanwalter » Wed Nov 01, 2017 4:55 am

Thanks. I get that CEC is a messy protocol. I don't think I have voltage issues on my hdmi cable, because the prior versions of this plugin from Pulse-Eight captured 99%+ of events, and both Kodi and the Pulse-Eight CEC Test Client seem to capture 100% of button presses on the remote. Kodi seems to pick them up as well.

If more manageable, the very first Pulse-Eight plugin was just reporting the CEC hex codes as events, without trying to make them human readable. Personally, I would be as happy with that as with human readable events coming through -- once I know what an event looks like for a particular button press, I can set it up as a trigger whether it says something like "LeftButton" or something like "0F:2A".

Anyway, if nothing else this has forced me to create a clean install and a clean new tree for testing, which means I might also go back to the old plugins and decide which has the fewest limitations and start on some workarounds.

I'll continue watching this space for further news.

User avatar
kgschlosser
Site Admin
Posts: 4245
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by kgschlosser » Wed Nov 01, 2017 2:25 pm

Once I get a proper test setup in place I will start work again. I was using my projector up until now. but the projector doesn't have/support most of the feature/functions of CEC.

I am going to add some debugging to spit out the backend protocol garbage so i can see what is and is not being responded to which will also help me to evaluate what is going on with the thing.
If you like the work I have been doing then feel free to Image

arabesc
Posts: 5
Joined: Sun Jan 14, 2018 12:52 pm

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by arabesc » Sun Jan 14, 2018 1:06 pm

Win10 x64, libCEC 4.0.2, fresh install of EG + plugin from that post (v1.2.3b).
The first attempt:

Code: Select all

Traceback (most recent call last) (0.5.0-rc4):
  File "wx\_core.pyc", line 16766, in <lambda>
  File "C:\ProgramData\EventGhost\plugins\PulseEight\controls.py", line 168, in add_cec_item
    increment=0.1
  File "C:\Program Files (x86)\EventGhost\eg\Classes\SpinNumCtrl.py", line 88, in __init__
    numCtrl.SetParameters(**kwargs)  # To avoid bug in NumCtrl
  File "wx\lib\masked\numctrl.pyc", line 875, in SetParameters
  File "wx\lib\masked\numctrl.pyc", line 1604, in _toGUI
ValueError: value 0 is below minimum value of control
The second plugin invocation:

Code: Select all

Error loading plugin file: C:\ProgramData\EventGhost\plugins\PulseEight
Traceback (most recent call last) (0.5.0-rc4):
  File "C:\ProgramData\EventGhost\plugins\PulseEight\__init__.py", line 82, in <module>
    from . import cec # NOQA
ImportError: cannot import name cec
It doesn't work :(

User avatar
kgschlosser
Site Admin
Posts: 4245
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by kgschlosser » Mon Jan 15, 2018 12:39 am

ok The first error is fixed via this PATCH

The second error is caused by an installation issue.

You may have upgraded the plugin. but you need to download and install the Pulse Eight CEC drivers that have been patched to work properly with python 2.7. This release of libCEC is not an official release tho it has been built by the makers of the pulse eight devices. If you need support with the drivers themselves you need to come to me about it and not pulse eight (because officially this release does not exist).
If you like the work I have been doing then feel free to Image

arabesc
Posts: 5
Joined: Sun Jan 14, 2018 12:52 pm

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by arabesc » Sat Jan 20, 2018 4:31 pm

I've applied the patch and installed the CEC drivers, I've managed to access CEC plugin.

Here is an output of the Pulse-Eight CEC Adapter: Restart Adapter: Adapter: Pioneer TV on COM3 action:

Code: Select all

   Error in Action: "Pulse-Eight CEC Adapter: Restart Adapter: Adapter: Pioneer TV on COM3"
   Traceback (most recent call last) (0.5.0-rc4):
     File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
       return self(*args)
     File "C:\ProgramData\EventGhost\plugins\PulseEight\__init__.py", line 479, in __call__
       adapter.restart()
     File "C:\ProgramData\EventGhost\plugins\PulseEight\cec_classes.py", line 662, in restart
       return CECAdapter(*self._restart_params)
   TypeError: __init__() takes exactly 6 arguments (5 given)
Last edited by arabesc on Sun Jan 21, 2018 11:49 am, edited 1 time in total.

arabesc
Posts: 5
Joined: Sun Jan 14, 2018 12:52 pm

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by arabesc » Sat Jan 20, 2018 4:34 pm

I have an issue with CEC plugin after system suspend.

E.g., here is a macro:
Image
It doesn't work as expected, the Pulse-Eight CEC Adapter: Power On TV: Adapter: Pioneer TV on COM3 action does nothing after suspend.

Here is a startup log:

Code: Select all

---> Welcome to EventGhost <---
Autostart
   Plugin: Pulse-Eight CEC Adapter
System.Monitor.On
Main.OnInit
   Resume
      Pulse-Eight CEC Adapter: Power On TV: Adapter: Pioneer TV on COM3
         CEC: connection opened on COM3
Main.OnInitAfterBoot
System.PowerSource.Line
System.PowerSaving.Off
System.PowerProfile.Balanced
Pioneer TV.TV.Power.On
System.DeviceRemoved [u'\\\\?\\DISPLAY#PIO00C4#4&60756d9&0&UID198171#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}']
System.DeviceAttached [u'\\\\?\\DISPLAY#Default_Monitor#4&60756d9&0&UID200747#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}']
System.DeviceRemoved [u'\\\\?\\DISPLAY#Default_Monitor#4&60756d9&0&UID200747#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}']
System.DeviceAttached [u'\\\\?\\DISPLAY#PIO00C4#4&60756d9&0&UID198171#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}']
Pioneer TV.TV.MenuLanguage.eng
Pioneer TV.Source.TV
It works, CEC plugin turns TV on on startup.

Here is a suspend log:

Code: Select all

System.Suspend
   Suspend
      Pulse-Eight CEC Adapter: Standby TV: Adapter: Pioneer TV on COM3
System.Monitor.Off
The first attempt to suspend works too, CEC plugin successfully turns TV off.

And here is a resume log:

Code: Select all

System.Resume
System.ResumeAutomatic
   Resume
      Pulse-Eight CEC Adapter: Power On TV: Adapter: Pioneer TV on COM3
System.Monitor.On
Pioneer TV.TV.Disconnected
From this point and further CEC plugin doesn't work, it doesn't turn TV on or off.

User avatar
kgschlosser
Site Admin
Posts: 4245
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by kgschlosser » Thu Jan 25, 2018 1:34 am

I created a new topic for the new CEC plugin with instructions.

viewtopic.php?f=9&t=10018
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4245
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: libCEC plugin for Pulse Eight HDMI-CEC usb adapter

Post by kgschlosser » Thu Jan 25, 2018 1:35 am

as far as the system suspend and system resume I am going to have to disconnect and then reconnect. give me a few days to hammer that out.
If you like the work I have been doing then feel free to Image

Post Reply