Binding Request: Sharp Aquos TV

Ok. Here’s a link to the jar file(s), along with a (very) brief README.

https://github.com/mhilbush/org.openhab.binding.sharptv

Hi,

I’ll definitely take a look at trying this out! Can’t remember my model number off the top of my head so I’ll check it when I get back home in the morning.

Ok, So binding installed, Paper UI found TV within seconds… :+1:

Created the items… :+1:

Pressed Power… Nothing… :confused:

Increase Volume… Nothing… :confused:

Trying to update software on TV now as typing… Will Update later hopefully… Time for bed… :sleeping:

That’s encouraging, at least…

Ugh.

FWIW, my TV is running the latest firmware available for it, v3.6.9, dated 1/30/2016.

A couple basic questions…

Did you confirm that the port in the binding config matches the port in the TV setup? The binding defaults to 10002. I have yet to find a way to get the port from the upnp discovery packet, so this needs to be set manually if your TV is set up on a different port. :frowning:

Do you have authentication enabled on the TV (i.e. you’ve entered something in the username and password fields in the setup)? If so, try it without authentication. To do that, reinitialize IP control on the TV, and don’t set a user name & password.

A debug level log file would help, as it will show what’s being sent back and forth between the binding and the TV.

Ack! I just realized I was logging the password. I just uploaded another jar that doesn’t log the password. Sorry 'bout that.

Mark: No, but you did. :slight_smile:

I read the code, and it was fairly simple, so I had the same idea as you - to convert it to OH2 myself. But luckily (for me) you beat me to it. I’ll try your version.

Lewis: The Jar you tried is made for OH1, not OH2 - so it will never end up in PaperUI. You have to configure it the OH1 way, using items files. And besides - the binding doesn’t seem to work in OH2, because it is not able to find its config file. I would suggest trying Marks version instead.

@mhilbush

Mark,

Bad news I’m afraid, following some extensive research it turns out my particular model of Aquos is not compatible with IP Control… This is unfortunate as I was very much looking forward to controlling it via the openHAB system.

Thanks for your time

Mark,

The binding seems to be working with my TV (LC-60LE755U), though I can only seem to send commands to it at a rate of about once per minute. I believe that problem is with the TV and not the binding.

Interesting. What happens when you try to send commands more frequently than that? Are you using authentication or no authentication.

You could try putting the binding into DEBUG or TRACE mode to see where the time is being spent.

I’m able to send commands about as rapidly as I can press the buttons on the UI.

Nothing happens.
I’m not using authentication, and I’m using the default port.
I did just run a test using socat to send the raw commands to the TV, which worked well after sending RSPW2 to put the TV into IP mode.
I was able to send power on and off commands as well as mute, as fast as I could hit enter and the TV responded.
I then tried the binding again, The TV came on with power on, however after that it stopped responding.
It also stopped responding to raw commands send from my terminal window.
After waiting a minute, the TV responed to the terminal commands again as if there was no issue.
I have not had a chance to turn on DEBUG mode in the binding yet, but based on the above description, any ideas?

Thanks!

It’s hard to tell what’s going on without seeing the debug and/or trace log. The logic for sending commands is very simple. Try it in DEBUG mode first. If that doesn’t provide anything useful, we’ll need to try TRACE level logging.

The binding tries to send the RSPW2 at startup time. While unlikely, it’s possible that that might be causing a problem.

Here’s the output from DEBUG:

2017-05-09 19:41:36.705 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command ON on sharptv:sharptv:95835ed6:mute channel
2017-05-09 19:41:36.706 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-09 19:41:36.766 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE1 '
2017-05-09 19:41:36.767 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-09 19:41:41.707 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.ThingManager@146f7b5’ takes more than 5000ms.
2017-05-09 19:41:41.710 [WARN ] [ome.core.thing.internal.ThingManager] - Handler for thing ‘sharptv:sharptv:95835ed6’ takes more than 5000ms for processing event
2017-05-09 19:41:49.231 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:mute channel
2017-05-09 19:41:49.232 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-09 19:41:49.233 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE2 '
2017-05-09 19:41:49.234 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-09 19:41:49.234 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-09 19:42:25.005 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command ON on sharptv:sharptv:95835ed6:power channel
2017-05-09 19:42:25.005 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handling power command: ON
2017-05-09 19:42:25.005 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-09 19:42:25.010 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'POWR1 '
2017-05-09 19:42:25.011 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-09 19:42:25.012 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-09 19:42:28.573 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:power channel
2017-05-09 19:42:28.574 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handling power command: OFF
2017-05-09 19:42:28.574 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-09 19:42:28.574 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'POWR0 '
2017-05-09 19:42:28.575 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-09 19:42:28.576 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket

The first Mute command worked, but everything after just seemed to go into the ether.

I see where the binding sends the mute command (MUTE1), but it looks like either the TV didn’t respond, or that the TV responded with something the binding didn’t expect, which caused the framework to timeout after 5 seconds. I noticed in the code that this condition can occur, but I didn’t put in a fix yet.

Can you put the binding into TRACE mode? That will show what is being sent to and received from the TV.

log:set TRACE org.openhab.binding.sharptv

Here’s the TRACE output:

2017-05-10 07:09:45.144 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command ON on sharptv:sharptv:95835ed6:power channel
2017-05-10 07:09:45.146 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handling power command: ON
2017-05-10 07:09:45.146 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 07:09:45.216 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'POWR1 '
2017-05-10 07:09:45.217 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 07:09:46.665 [DEBUG] [iscovery.SharpTVDiscoveryParticipant] - Discovered AQUOS LE755U at http://192.168.150.71:12345/mrd/
2017-05-10 07:09:50.147 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.ThingManager@146f7b5’ takes more than 5000ms.
2017-05-10 07:09:50.147 [WARN ] [ome.core.thing.internal.ThingManager] - Handler for thing ‘sharptv:sharptv:95835ed6’ takes more than 5000ms for processing event
2017-05-10 07:09:55.612 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:power channel
2017-05-10 07:09:55.613 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handling power command: OFF
2017-05-10 07:09:55.615 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 07:09:55.615 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'POWR0 '
2017-05-10 07:09:55.616 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 07:09:55.617 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 07:10:03.925 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command ON on sharptv:sharptv:95835ed6:power channel
2017-05-10 07:10:03.925 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handling power command: ON
2017-05-10 07:10:03.925 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 07:10:03.926 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'POWR1 '
2017-05-10 07:10:03.926 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 07:10:03.926 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 07:10:07.755 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:mute channel
2017-05-10 07:10:07.756 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 07:10:07.756 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE2 '
2017-05-10 07:10:07.757 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 07:10:07.758 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 07:10:10.621 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command ON on sharptv:sharptv:95835ed6:mute channel
2017-05-10 07:10:10.621 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 07:10:10.622 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE1 '
2017-05-10 07:10:10.622 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 07:10:10.623 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 07:10:13.794 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:mute channel
2017-05-10 07:10:13.795 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 07:10:13.796 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE2 '
2017-05-10 07:10:13.796 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 07:10:13.797 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 07:10:15.442 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:power channel
2017-05-10 07:10:15.442 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handling power command: OFF
2017-05-10 07:10:15.443 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 07:10:15.446 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'POWR0 '
2017-05-10 07:10:15.447 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 07:10:15.447 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 07:12:50.263 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket

Looks about the same as the DEBUG output, but log:list does show it set to TRACE.
I did try a test, and if I wait for the last closing socket, the TV becomes active again. If I had to guess, I say the binding is holding open the connection for some reason, and as only one at a time is allowed on the TV, that’s preventing it from accepting any commands.

Yeah, when the framework times out after 5 sec, the socket is left open. That bit of code might’ve worked ok in OH1, but it won’t work in OH2. I need to timeout before the 5 sec and close the socket. More importantly, I need to find out why there’s no response to the POWR1 command.

I made a small change to the code, and added some additional debugging. There’s a new jar here

Log from the new jar:

2017-05-10 20:06:31.234 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command ON on sharptv:sharptv:95835ed6:mute channel
2017-05-10 20:06:31.235 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 20:06:31.296 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE1 '
2017-05-10 20:06:31.296 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 20:06:31.299 [TRACE] [arptv.internal.hardware.SharpTVProxy] - Read a character from the input stream: 69
2017-05-10 20:06:31.299 [TRACE] [arptv.internal.hardware.SharpTVProxy] - Read a character from the input stream: 82
2017-05-10 20:06:31.300 [TRACE] [arptv.internal.hardware.SharpTVProxy] - Read a character from the input stream: 82
2017-05-10 20:06:31.300 [TRACE] [arptv.internal.hardware.SharpTVProxy] - Read a character from the input stream: 13
2017-05-10 20:06:31.300 [TRACE] [arptv.internal.hardware.SharpTVProxy] - Read a character from the input stream: 79
2017-05-10 20:06:31.300 [TRACE] [arptv.internal.hardware.SharpTVProxy] - Read a character from the input stream: 75
2017-05-10 20:06:31.301 [TRACE] [arptv.internal.hardware.SharpTVProxy] - Read a character from the input stream: 13
2017-05-10 20:06:36.236 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber ‘org.eclipse.smarthome.core.thing.internal.ThingManager@146f7b5’ takes more than 5000ms.
2017-05-10 20:06:36.236 [WARN ] [ome.core.thing.internal.ThingManager] - Handler for thing ‘sharptv:sharptv:95835ed6’ takes more than 5000ms for processing event
2017-05-10 20:06:36.237 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:mute channel
2017-05-10 20:06:36.237 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 20:06:36.238 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE2 '
2017-05-10 20:06:36.238 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 20:06:36.241 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 20:07:42.632 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:mute channel
2017-05-10 20:07:42.632 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 20:07:42.636 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE2 '
2017-05-10 20:07:42.636 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 20:07:42.637 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 20:07:49.576 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command ON on sharptv:sharptv:95835ed6:mute channel
2017-05-10 20:07:49.576 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 20:07:49.577 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE1 '
2017-05-10 20:07:49.577 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 20:07:49.580 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket
2017-05-10 20:07:55.523 [DEBUG] [nding.sharptv.handler.SharpTVHandler] - Handle command OFF on sharptv:sharptv:95835ed6:mute channel
2017-05-10 20:07:55.525 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Opening socket to sharptv-fr:10002 with timeout 1500
2017-05-10 20:07:55.525 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Writing command: 'MUTE2 '
2017-05-10 20:07:55.526 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Waiting for command response
2017-05-10 20:07:55.527 [DEBUG] [arptv.internal.hardware.SharpTVProxy] - Closing socket

I also ran tcpdump during both a telnet session with the TV, and against the binding. During telnet, the TV is responding with ERR in the first reply packet to a command, but then in the next reply packet with OK. I only ever saw the OK on the screen in telnet.
The same thing is happening with the first command sent from the binding, but subsuquent commands do not get a response. I also noticed a few packets of exchanged between the binding sending the command and the TV sending a response code that I did not see with telnet.

Thanks Pal - I have added Mark’s Jar into the addons and it appears under the bindings now. Thank you

Thanks for testing this out @jspeckman

This is a little strange. The old OH1 code is expecting a line feed as the line terminator, and that’s what my TV is sending in response to a command. The log above shows that your TV is responding with a carriage return as the end of line terminator. Would you mind posting what version of firmware your TV is running?

I built a version of the binding that:

  • expects a carriage return as the end of line terminator;
  • removes the RSPW2 that is sent when the binding starts, just to get that out of the mix; and
  • times out on socket reads if no (or an unexpected) response is received from the TV

If this resolves the problem you’re having, I’ll need to rework the code that communicates with the TV.

New jar was just posted to my github repo.

I’ll give the new binding a try and let you know.
My firmware should be:153U1312121 Released on 02/06/2014
I say should be, because this is the last firmware released for my TV and when I try to update the TV claims I am on the latest.

@jspeckman It also looks like your TV announces itself a bit differently in the uPnP discovery packet. My TV claims to be a SHARP LC-43LE653U in the discovery packet. Yours announces itself as shown below. Right now I’m only matching on the word SHARP. Based on that, I assume auto-discovery didn’t work for you?

2017-05-10 07:09:46.665 [DEBUG] [iscovery.SharpTVDiscoveryParticipant] - Discovered AQUOS LE755U

I’ll modify the binding to also match on AQUOS.

Thank you Mark - the latest version now works with my Sharp AQUOS. Model: LC-60LE951X

  • I can confirm Power on / Off works
  • Input selection works (Would be great if we could have this as a drop down/ text name of inputs? )
  • Volume works
  • Mute works

Unable to test Channel.

I have this also on username / password verification which works as well.

Can I provide any further information to help you with the testing / features ?

Much appreciated Mark.

Lewis