iAnish / openhab

Automatically exported from code.google.com/p/openhab
GNU General Public License v3.0
0 stars 0 forks source link

Implement Onkyo Binding for AV-Receivers #216

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be great to power on/off Onkyos AV-Receivers.

Original issue reported on code.google.com by christop...@gmail.com on 23 Mar 2013 at 5:00

GoogleCodeExporter commented 9 years ago
I am not sure if it is the same problem, but I got some errors and lost the 
connection to my avr while I tried to recreate the situation. :)

I just opened "My Favorites" within the Onkyo-Android-App.

http://pastebin.com/Rt39NMLj

Original comment by christop...@gmail.com on 11 Jul 2013 at 5:41

GoogleCodeExporter commented 9 years ago
Ones again and hopefully the last time. Whole receiving part it now rewritten 
and for me it work like a charm. I tested with onkyo spotify client and 
simultaneously used iPhone and iPad onkyo applications without any problems.

Original comment by pauli.an...@gmail.com on 12 Jul 2013 at 11:27

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by pauli.an...@gmail.com on 12 Jul 2013 at 1:26

Attachments:

GoogleCodeExporter commented 9 years ago
Still got some errors after the start.
http://pastebin.com/Wd39n696

But I think the binding is still connected.

I will test more later, when I am home. ;)

Original comment by christop...@gmail.com on 12 Jul 2013 at 3:04

GoogleCodeExporter commented 9 years ago
Errors are related to data conversion...

Example:

16:55:09.400 DEBUG o.o.b.o.internal.OnkyoBinding[:361]- Received status update 
'ZVLN/A' from device 192.168.1.18
16:55:09.408 ERROR o.o.b.o.internal.eiscp.Eiscp[:482]- Event listener invoking 
error
java.lang.NumberFormatException: For input string: "N/"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:492)
        at org.openhab.binding.onkyo.internal.OnkyoBinding.convertDeviceValueToOpenHabState(OnkyoBinding.java:428)
        at org.openhab.binding.onkyo.internal.OnkyoBinding.statusUpdateReceived(OnkyoBinding.java:406)
        at org.openhab.binding.onkyo.internal.eiscp.Eiscp.waitStateMessages(Eiscp.java:477)
        at org.openhab.binding.onkyo.internal.eiscp.Eiscp.access$1(Eiscp.java:349)
        at org.openhab.binding.onkyo.internal.eiscp.Eiscp$DataListener.run(Eiscp.java:513)

AVR inform that zone volume is not available. "N/A" value obviously cause 
problem to data conversion. 

Original comment by pauli.an...@gmail.com on 12 Jul 2013 at 3:38

GoogleCodeExporter commented 9 years ago
And some Titleinformation seem to be an issue also.

16:58:05.056 DEBUG o.o.b.o.internal.OnkyoBinding[:361]- Received status update 
'NTR----/----' from device 192.168.1.18
16:58:05.056 ERROR o.o.b.o.internal.eiscp.Eiscp[:482]- Event listener invoking 
error
java.lang.NumberFormatException: For input string: "--"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.convertDeviceValueToOpenHabState(OnkyoBinding.java:428)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.statusUpdateReceived(OnkyoBinding.java:406)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.waitStateMessages(Eiscp.java:477)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.access$1(Eiscp.java:349)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp$DataListener.run(Eiscp.java:513)
16:58:05.071 TRACE o.o.b.o.internal.eiscp.Eiscp[:373]- Header size: 16
16:58:05.072 TRACE o.o.b.o.internal.eiscp.Eiscp[:386]- Data size: 46
16:58:05.073 TRACE o.o.b.o.internal.eiscp.Eiscp[:405]- Received 46 bytes: 
21314E4154314C495645202D20446173206A756E676520526164696F20646573205744522E203130
322E341A0D0A
16:58:05.073 DEBUG o.o.b.o.internal.OnkyoBinding[:361]- Received status update 
'NAT1LIVE - Das junge Radio des WDR. 102.4' from device 192.168.1.18
16:58:05.074 ERROR o.o.b.o.internal.eiscp.Eiscp[:482]- Event listener invoking 
error
java.lang.NumberFormatException: For input string: "1L"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.convertDeviceValueToOpenHabState(OnkyoBinding.java:428)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.statusUpdateReceived(OnkyoBinding.java:406)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.waitStateMessages(Eiscp.java:477)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.access$1(Eiscp.java:349)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp$DataListener.run(Eiscp.java:513)
16:58:05.090 TRACE o.o.b.o.internal.eiscp.Eiscp[:373]- Header size: 16
16:58:05.091 TRACE o.o.b.o.internal.eiscp.Eiscp[:386]- Data size: 20
16:58:05.091 TRACE o.o.b.o.internal.eiscp.Eiscp[:405]- Received 20 bytes: 
21314E414C4765726D616E204D757369631A0D0A
16:58:05.092 DEBUG o.o.b.o.internal.OnkyoBinding[:361]- Received status update 
'NALGerman Music' from device 192.168.1.18
16:58:05.092 ERROR o.o.b.o.internal.eiscp.Eiscp[:482]- Event listener invoking 
error
java.lang.NumberFormatException: For input string: "Ge"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.convertDeviceValueToOpenHabState(OnkyoBinding.java:428)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.statusUpdateReceived(OnkyoBinding.java:406)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.waitStateMessages(Eiscp.java:477)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.access$1(Eiscp.java:349)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp$DataListener.run(Eiscp.java:513)
16:58:05.093 TRACE o.o.b.o.internal.eiscp.Eiscp[:373]- Header size: 16
16:58:05.094 TRACE o.o.b.o.internal.eiscp.Eiscp[:386]- Data size: 41
16:58:05.094 TRACE o.o.b.o.internal.eiscp.Eiscp[:405]- Received 41 bytes: 
21314E5449314C495645206D697420546572686F6576656E20756E642064656D20446965747A1A0D
0A
16:58:05.094 DEBUG o.o.b.o.internal.OnkyoBinding[:361]- Received status update 
'NTI1LIVE mit Terhoeven und dem Dietz' from device 192.168.1.18
16:58:05.095 ERROR o.o.b.o.internal.eiscp.Eiscp[:482]- Event listener invoking 
error
java.lang.NumberFormatException: For input string: "1L"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.convertDeviceValueToOpenHabState(OnkyoBinding.java:428)
    at org.openhab.binding.onkyo.internal.OnkyoBinding.statusUpdateReceived(OnkyoBinding.java:406)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.waitStateMessages(Eiscp.java:477)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp.access$1(Eiscp.java:349)
    at org.openhab.binding.onkyo.internal.eiscp.Eiscp$DataListener.run(Eiscp.java:513)

Original comment by christop...@gmail.com on 12 Jul 2013 at 3:46

GoogleCodeExporter commented 9 years ago
btw: I found a newer version of the ISCP-Commands. (v1.24; June 8th 2012 )
http://blog.siewert.net/?cat=18

But maybe someone can find the 2013-edition. :)

Original comment by christop...@gmail.com on 12 Jul 2013 at 4:05

GoogleCodeExporter commented 9 years ago
The binding still works.
So far ~5 hours.

But I got another question. (Better discuss this in Google Groups?)

How can I store NetTime, Totle, etc. as Items?

I tried:
String   onkyoNETTime   "NET Time Info [%s]"    {onkyo="INIT:avr:#NTMQSTN"}
String   onkyoNETTitle  "NET Title Info [%s]"   {onkyo="INIT:avr:#NTIQSTN"}
String   onkyoNETArtist "NET Artist Info [%s]"  {onkyo="INIT:avr:#NATQSTN"}

But I have no clue if this is the right way.
But it does not work. :(

And I think this is strange, too:
22:41:46.788 TRACE o.o.b.o.internal.eiscp.Eiscp[:373] - Header size: 16
22:41:46.788 TRACE o.o.b.o.internal.eiscp.Eiscp[:386] - Data size: 19
22:41:46.788 TRACE o.o.b.o.internal.eiscp.Eiscp[:405] - Received 19 bytes: 
21314E544D34373A35392F2D2D3A2D2D1A0D0A
22:41:46.788 DEBUG o.o.b.o.internal.OnkyoBinding[:361] - Received status update 
'NTM47:59/--:--' from device 192.168.1.18
22:41:46.789 INFO  runtime.busevents[:46] - onkyoNETTitle state updated to 71

1. Why is "NTMxx" saved as onkyoNETTitle instead of onkyoNETTime?
2. Why is the runtime (47min) decoded from HEX to the Number 71?
3. How can I store the timecode?

Original comment by christop...@gmail.com on 12 Jul 2013 at 8:51

GoogleCodeExporter commented 9 years ago
I regard of the upcomming release 1.3 of openHAB I just want to let you know I 
had no issues with the binding in the last days. :)

But I get this error every time I want to listen to web radio:
00:02:43.020 TRACE o.o.b.o.internal.eiscp.Eiscp[:405]- Received 17 bytes: 
21314E54522D2D2D2D2F2D2D2D2D1A0D0A
00:02:43.020 DEBUG o.o.b.o.internal.OnkyoBinding[:361]- Received status update 
'NTR----/----' from device 192.168.1.18
00:02:43.020 ERROR o.o.b.o.internal.eiscp.Eiscp[:482]- Event listener invoking 
error
java.lang.NumberFormatException: For input string: "--"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:492)
        at org.openhab.binding.onkyo.internal.OnkyoBinding.convertDeviceValueToOpenHabState(OnkyoBinding.java:428)
        at org.openhab.binding.onkyo.internal.OnkyoBinding.statusUpdateReceived(OnkyoBinding.java:406)
        at org.openhab.binding.onkyo.internal.eiscp.Eiscp.waitStateMessages(Eiscp.java:477)
        at org.openhab.binding.onkyo.internal.eiscp.Eiscp.access$1(Eiscp.java:349)
        at org.openhab.binding.onkyo.internal.eiscp.Eiscp$DataListener.run(Eiscp.java:513)

And I can't figure out how to get Title and other information about the current 
playing track/station.

Original comment by christop...@gmail.com on 23 Jul 2013 at 10:22

GoogleCodeExporter commented 9 years ago
New try ;)

"1. Why is "NTMxx" saved as onkyoNETTitle instead of onkyoNETTime?"
There was still a bug in response recognition. Binding only checked two first 
characters on response rather than three, like it should.  

"3. How can I store the timecode?"
Whole response is copied to item when item type is string, so now title and 
time should work.

String   onkyoNETTime   "NET Time Info [%s]"    {onkyo="INIT:avr:#NTMQSTN"}
String   onkyoNETTitle  "NET Title Info [%s]"   {onkyo="INIT:avr:#NTIQSTN"}
String   onkyoNETArtist "NET Artist Info [%s]"  {onkyo="INIT:avr:#NATQSTN"}

Could you Christoph test again and give feedback?

Original comment by pauli.an...@gmail.com on 24 Jul 2013 at 8:38

Attachments:

GoogleCodeExporter commented 9 years ago
Looks great!! (see screenshot)

Original comment by christop...@gmail.com on 24 Jul 2013 at 7:27

Attachments:

GoogleCodeExporter commented 9 years ago
merged the current state to main repo (see 
http://code.google.com/p/openhab/source/detail?r=28c09f41da3f1a23b0392fcc9aaec6d
56de1fb80). Would be great if someone could confirm the next snapshot build 
works as expected.

Original comment by teichsta on 5 Aug 2013 at 2:12

GoogleCodeExporter commented 9 years ago
A little feedback:
I had no problems in the last days/weeks.
(I did not test all available functions!)
Today I installed the 1.3.0-snapshot and everything still works fine.

The only issue I have is that it takes some time to initiate some items.
If the avr is already on and openhab gets started some onkyo requests (like 
"NTRQSTN") get no answer from the avr. But sometimes they do and others don't.
So I think this is an issue on onkyos site.

Original comment by christop...@gmail.com on 10 Aug 2013 at 9:27

GoogleCodeExporter commented 9 years ago
If I am correct the avr sends a command like "***N/A" back if a unsupported 
command is sent to the device.

Like this:
Send command: DIM03
21:24:02.001 DEBUG o.o.b.o.internal.OnkyoBinding[:354]- Received status update 
'DIMN/A' from device 192.168.1.18
21:24:02.003 DEBUG o.o.b.o.internal.OnkyoBinding[:433]- Cannot convert value 
'DIMN/A' to data type class org.openhab.core.library.items.NumberItem

I think the binding should recognize the "N/A" value and not try to convert it.
Instead it it would be better if this produces a WARN-Log.
The average user should see this Message without changing the logback.xml.
That's my opinion. :)

Original comment by christop...@gmail.com on 13 Aug 2013 at 7:29

GoogleCodeExporter commented 9 years ago
N/A (not available) is returned also when command is supported, but value is 
not currently available. Currently, when conversion error occurs, conversion 
set item to  "UnDefType.UNDEF" state and also log error on debug. N/A is easy 
to recognise, but what then we should do?  What should be done when real 
conversion problem occurs? 

My opinion is that when n/a is returned, binding should silently set item to 
undef state (we don't know is command unsupported or value is not available) 
and when real conversion problem occurs, binding should also give a warning, 
but should item value be untouched or set to undef state?

Original comment by pauli.an...@gmail.com on 13 Aug 2013 at 8:16

GoogleCodeExporter commented 9 years ago
Ok. That makes sense.

Original comment by christop...@gmail.com on 13 Aug 2013 at 8:27