Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Onkyo Reciver RS232 plugin

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Onkyo Reciver RS232 plugin

Post by Bartman »

I converted the plugin to the new eg.SerialThread. Still some questions though but I have to get some sleep now.
It does trigger events but I don't know how wait for the terminator symbol so most data is torn in two parts.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Onkyo Reciver RS232 plugin

Post by Bitmonster »

If the messages have a fixed length, you can simply do .Read(length, timeout) inside the callback. If you can only find the end by searching for the terminator, you better read the bytes one by one. The callback will be called again, if not all chars have been consumed. So for a newline terminated event it should look like this:

Code: Select all

def MyReceiveCallback(self, serial):
    buffer = ""
    while True:
        b = serial.Read(1, 0.1)
        if b == "\n":
            self.TriggerEvent(buffer)
            return
        elif b == "":
            # nothing received inside timeout, possibly indicates erroneous data
            return
        buffer += b
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Onkyo Reciver RS232 plugin

Post by Bartman »

I added a basic event evaluation and added some additional commands.

It seems that EG takes a few additional seconds to shutdown?!?!
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Onkyo Reciver RS232 plugin

Post by Bitmonster »

Bartman wrote:It seems that EG takes a few additional seconds to shutdown?!?!
Are you sure, no other plugin or program has tried to access the COM port?
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Onkyo Reciver RS232 plugin

Post by Bartman »

Bitmonster wrote:
Bartman wrote:It seems that EG takes a few additional seconds to shutdown?!?!
Are you sure, no other plugin or program has tried to access the COM port?
Isn't the access exclusiv by eg? At least I don't know of any programs.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Onkyo Reciver RS232 plugin

Post by Bitmonster »

Well, I'm not sure if the code handles errors right in the moment. They might be silently ignored and the thread might then get blocked.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Onkyo Reciver RS232 plugin

Post by Livin »

Bartman,
did you get it working with the 805?
Any mods required? If yes, can you please post?

thx!
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Onkyo Reciver RS232 plugin

Post by Livin »

I tried using this via a USB->serial adapter... does not seem to work?

Anyone try this?
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Onkyo Reciver RS232 plugin

Post by Bartman »

Livin wrote:I tried using this via a USB->serial adapter... does not seem to work?

Anyone try this?
I am using a adapter and it works flawlessly. In fact I never used a "real" serial port.
The adapter is transparent for the software.
Try if it works with other software like Hyperterminal.
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Onkyo Reciver RS232 plugin

Post by Livin »

Bartman wrote:
Livin wrote:I tried using this via a USB->serial adapter... does not seem to work?

Anyone try this?
I am using a adapter and it works flawlessly. In fact I never used a "real" serial port.
The adapter is transparent for the software.
Try if it works with other software like Hyperterminal.
I should have clarified... EG sees the COM3 (the port with the adapter) but the receiver does not do anything when EG sends the commands. I have specifically tried to turn on Zone2 and set the Zone2 Input. I'll try some other things.

Is there a way to ensure EG is communicating with the Onkyo (like a debug mode) before I spend a ton of time trying other things?
... and/or is there a way to quickly use hyperterminal to check the comms?

thx
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Onkyo Reciver RS232 plugin

Post by Bartman »

You can easily setup hypterterminal creating a new connection
Change the bitrate to 9600.
The turn the volume up or down and you should see some input.
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Onkyo Reciver RS232 plugin

Post by Livin »

not able to get it working... maybe it is the usb2serial adapter... I'll get a new one and try again.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Onkyo Reciver RS232 plugin

Post by Bartman »

wait.
There seems to be a bug in some of the plugins preventing the creation of new instances.

http://www.eventghost.org/forum/viewtop ... f=4&t=1185
do you get the same message?
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Onkyo Reciver RS232 plugin

Post by Livin »

I posted in the link you pasted in.

are you planning on putting out a new version that fixes the issues I posted?
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Onkyo Reciver RS232 plugin

Post by Livin »

Let me know when you put out a new build and I'll try it... thx
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Post Reply