Binding Request: Sharp Aquos TV

Installing it in OH2 is easy - just put it into openhab-folder/addons - and it seems to start up just fine.

But I can’t get it to find its config though. Tried using a openhab-folder/services/sharptv.cfg using the new syntax (removing the “sharptv:” at the beginning of each line) and also tried putting it in openhab-folder/services/openhab.cfg using the old syntax. In both cases it will say “received a command for an unknown UID” when I try to use the items. Looking at the source code, that error message means that it didn’t find any config.

So anybody know how to get those config lines in a place where the binding will find them?

+		if (config == null) {
+			logger.error(BINDING_NAME + " received command for unknown item '"
+					+ itemName + "'");
+			return;
+		}

@Pal Did you ever get a resolution on this?

Hi Pal,

I am still working my way around Openhab2 so please excuse if this is a rather obvious question.

I have installed Openhabian on my Rp3, copied the .jar file to /usr/share/openhab2/addons folder. Do I now run this file through a command or expect to now find it within the addons on my Paperui?

  • I have searched the forums as extensively as I can before asking - can not seem to find an answer on how to run or have this show up as a binding / addon at all.

Thank you kindly for any help

I emailed him the other day. He doesn’t plan to submit the OH1 binding (and even if he wanted to, I think new contributions to OH1 are closed). He also doesn’t plan to submit an OH2 version. He did tell me I could use his code as the starting point for an OH2 binding. So…

I developed a prototype OH2 binding for the Sharp Aquos TV.

The binding auto discovers my TV correctly (model LC-43LE653U), and prepopulates the IP address in the thing config. The uPnP discovery information is quite sparse for my model.

  • I haven’t figured out where to get the port number – not sure that will be possible. Right now it defaults to port 10002, which the the default port for my model TV.
  • It also doesn’t provide a valid serial number. I doubt my TV is serial number 0000001. :open_mouth:

Edit: I replaced the serial number with the UUID returned in the uPnP response. The Thing UID now should be unique.

The IP address, port, username, and password can be edited using PaperUI. If you leave username and password blank, the binding will not attempt to authenticate with the TV. If username and password are not blank, it will authenticate with the TV.

I can send some basic commands (power on/off, volume, volume up/down, channel, channel up/down, input selection.

But, my model is a bit squirrelly. If I set up my TV with no authentication, everything works fine. However, if I set it up with authentication, the TV accepts the commands, but the commands seem to have no effect.

I’m not sure I’m going to convert the prototype into a production binding. I’m worried that many of the models will have peculiarities, similar to what I’m running into with my TV.

If anyone wants to try this out, we might be able to tell how well, or poorly, it works across multiple models. Let me know, and I’ll post the jar. Installation is easy – you just drop it in the addons folder and it should/might auto discover your TV(s).

Here’s a pic of the thing. It’s still a bit rough, but then again, that’s why it’s a prototype. :wink:

I would be interested in trying it out.

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.