Sony Devices Binding for OH3

Just to note that the binding can now be directly installed from the community marketplace (requires OH 3.2M3 or higher).

This will be the prefered and potentially single supported release channel for this binding in the future.

Please post any issues with this release in the Sony Binding marketplace topic

2 Likes

@andan

I removed the jar from the addons folder and installed it from the marketplace - all works great. Thank you.

Works good for me - Thank you.

One question: is it possible to Pause/Play Netflix etc?
I can start and close Netflix with ā€œApp Netflix Statusā€

Hello,

if Iā€™m not mistaken, I do this on my Sony Bravia tv using the button codes (AAAAAgAAAJcAAAAaAw== for play and pause). The channel is called IRCC channel.

Oh yes and I have now also switched to the marketplace and there seems to be no problems. Thanks!

have looked again, there is still a better variant, there went with me last time not yet, but now already. avContent#pl_cmd-main, here you get even a selection back like play, pause, etcā€¦

once we are there :smiley:
is there actually a nicer variant to start an app than with the respective channel of the app? if I do not want to make a separate button for each app, I always have to go through a dummy and a rule. But the problem is that I never see which app is currently open when I work with the original remote control. Does anyone here have a tip on how I can improve this?

I guess what you are asking for is the ability to identify the status of an app through a channel (i.e. whether it is active or not). According to the original author (see README) this is not possible. So it seems that you need to implement your own logic to keep track of the state.

Unfortunately it is true, that this is not possible through the sony rest api anymore.
This function used to report the active application, but this stopped a few years ago and never came back. In the documentation i also do not find another rest api call that could do the job or be the successor of the above.

However there is at least one way, but i am sure you wonā€™t like: I installed Automagic (a tool that is like tasker) on my Android Bravia TV. Automagic development is stopped, but because of that it is free and of course still works. There you can create a flow that triggers on startup of certain apps that you can choose (even the start page, which was afaik not possible through the sony rest api in the past) and sends the active app via http request to an openhab item. From there i have OH rules that react on the changes.

But please beware that Automagic was never made for Android TV, so expect glitches in the UI and the permission management that can be a job stopper. However i succeeded somehow a few months ago :slight_smile:

Maybe another possiblity is to use ADB. Looking at the ADB Binding documentation it supports:

|start-package |String |Run application by package name|
|stop-package |String |Stop application by package name|
|current-package |String |Package name of the top application in screen|

Maybe I try it out when i find some timeā€¦

1 Like

ok, thank you! I had also searched around in the Sony API list yesterday, but couldnā€™t find anything either. Had also searched for a way to use the google search via an OH input, but again no luck.

Hello,

I installed the addon according your documentation. Unfortunatelly, after installation I get the following error message:

2021-11-17 22:08:49.625 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.sony-3.1.3.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.sony [271]

  Unresolved requirement: Import-Package: javax.measure; version="[2.1.0,3.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]

	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

Any idea what is going wrong? I have installed OH3.1.

Kay

Hello,

This error can occur for OH versions less than 3.1 stable (e.g. 3.1 milestone builds). So please check your installed version and upgrade if necessary.

If this doesnā€™t help, you could try a previous binding version from Release openhab-addons-sony-3.1.0_20210518 Ā· andan67/openhab-addons (github.com)

Andreas

Thank you. That solved the problem.

Hi! I just installed the binding from community marketplace and set up simpleIP. It works great when the TV is ON, but when I turn it OFF the log starts to be filled up with the following:

"2022-01-17 22:10:58.384 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:tv' changed from OFFLINE (COMMUNICATION_ERROR): Error connecting to device: not reachable to UNKNOWN: Initializing ...

2022-01-17 22:10:58.886 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:tv' changed from UNKNOWN: Initializing ... to OFFLINE (COMMUNICATION_ERROR): Error connecting to device: not reachable"

I tried the edit /srv/openhab-userdata/etc/log4j2.xml as stated on the OP (the file path is not correct in the OP I guess), and restarted OH but no effect, I get those errors in every 10 s. Could you please help me? What did I wrong?

It depends on Retry Polling parameter set up. See the first posts from the Aug 21 above in this thread

Iā€™ve read it but maybe I donā€™t understand it correctly. I understand that the bindigs tries to connect every X sec. and gives an error if the TV is swiched off. There is no way the set up the bindig not to fill the log with unnecessary errors? (In other bindigs it is solved somehow that there is no error in log if the device is offline.)

Yes, if you have Retry Polling set to X sec. If you set Retry pooling= -1 there are no errors in logs (which in fact are messages that connection is not avaiable) but if you switch your TV from Remote Control it will not update states in openHAB :frowning: (you need to switch your TV in Openhab to control it from openhab).

I understand (hope) it`s not binding itself but the Sony protocol seems challanging while comparing to protocols used in other bindings (ex epson-serial protocol) ? Question to Andreas image
I think some sort of ā€œmaskingā€ (changing from errors to messages/trace events) shall be possible :slight_smile:

The log entries are caused be the fact that the binding updates the thing status on each retry/reconnect attempt. So what you have identified as binding error logs are in fact event logs from the thing status update event. You can get rid of these (and of course other status update event logs) by setting

<Logger level="WARN" name="openhab.event.ThingStatusInfoEvent"/>

in the log4j2.xml config file.

I will also reconsider the implemention, but this might take some time.

Hope this helps.

Thank you for your reply. I edited /srv/openhab-userdata/etc/log4j2.xml and restarted openhab, but nothing changed, it logs the red messages in every 10 sec like this:

2022-01-19 13:04:18.142 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:tv' changed from OFFLINE (COMMUNICATION_ERROR): Error connecting to device: not reachable to UNKNOWN: Initializing ...

2022-01-19 13:04:18.644 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:tv' changed from UNKNOWN: Initializing ... to OFFLINE (COMMUNICATION_ERROR): Error connecting to device: not reachable

Maybe I have to clean some kind of cache, restart is not enough?

If I understand correctly your suggestion would modify openhab generally. Maybe is there a way to ā€œfilter outā€ warnings from this binding (org.openhab.binding.sony)?

Hi!

Iā€™ve recently upgraded from OH 2.5.11 to 3.2. I removed the old binding and installed the new one from the community marketplace. My TV showed up (Sony XH90/X900H) and everything looked fine and it seems to work as expected. But I keep getting these errors in the log. I think they are connected to turning on/off the tv with the remote.

Is it something that isnā€™t working as it should?

12:52:20.477 [WARN ] [pache.cxf.phase.PhaseInterceptorChain] - Interceptor for {http://192.168.1.180/sony/system}WebClient has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not receive Message.
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:65) ~[?:?]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[?:?]
	at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:703) ~[?:?]
	at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1086) ~[?:?]
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:932) ~[?:?]
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:901) ~[?:?]
	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:461) ~[?:?]
	at org.apache.cxf.jaxrs.client.SyncInvokerImpl.method(SyncInvokerImpl.java:150) ~[?:?]
	at org.apache.cxf.jaxrs.client.SyncInvokerImpl.method(SyncInvokerImpl.java:145) ~[?:?]
	at org.apache.cxf.jaxrs.client.SyncInvokerImpl.post(SyncInvokerImpl.java:85) ~[?:?]
	at org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.post(InvocationBuilderImpl.java:153) ~[?:?]
	at org.openhab.binding.sony.internal.net.HttpRequest.sendPostCommand(HttpRequest.java:158) ~[?:?]
	at org.openhab.binding.sony.internal.net.HttpRequest.sendPostJsonCommand(HttpRequest.java:138) ~[?:?]
	at org.openhab.binding.sony.internal.transports.SonyHttpTransport.executePostJson(SonyHttpTransport.java:331) ~[?:?]
	at org.openhab.binding.sony.internal.transports.SonyHttpTransport.executePostJson(SonyHttpTransport.java:308) ~[?:?]
	at org.openhab.binding.sony.internal.transports.SonyHttpTransport.execute(SonyHttpTransport.java:129) ~[?:?]
	at org.openhab.binding.sony.internal.transports.SonyTransport.execute(SonyTransport.java:108) ~[?:?]
	at org.openhab.binding.sony.internal.scalarweb.models.ScalarWebService.execute(ScalarWebService.java:311) ~[?:?]
	at org.openhab.binding.sony.internal.scalarweb.models.ScalarWebService.executeSpecific(ScalarWebService.java:293) ~[?:?]
	at org.openhab.binding.sony.internal.scalarweb.models.ScalarWebService.execute(ScalarWebService.java:272) ~[?:?]
	at org.openhab.binding.sony.internal.scalarweb.protocols.ScalarWebLoginProtocol.lambda$4(ScalarWebLoginProtocol.java:195) ~[?:?]
	at org.openhab.binding.sony.internal.SonyAuthChecker.checkResult(SonyAuthChecker.java:83) ~[?:?]
	at org.openhab.binding.sony.internal.scalarweb.protocols.ScalarWebLoginProtocol.login(ScalarWebLoginProtocol.java:179) ~[?:?]
	at org.openhab.binding.sony.internal.scalarweb.ScalarWebHandler.connect(ScalarWebHandler.java:333) ~[?:?]
	at org.openhab.binding.sony.internal.AbstractThingHandler.doConnect(AbstractThingHandler.java:137) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://192.168.1.180/sony/system: Read timed out
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1400) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1384) ~[?:?]
	at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77) ~[?:?]
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:671) ~[?:?]
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) ~[?:?]
	... 30 more
Caused by: java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method) ~[?:?]
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:115) ~[?:?]
	at java.net.SocketInputStream.read(SocketInputStream.java:168) ~[?:?]
	at java.net.SocketInputStream.read(SocketInputStream.java:140) ~[?:?]
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:252) ~[?:?]
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:292) ~[?:?]
	at java.io.BufferedInputStream.read(BufferedInputStream.java:351) ~[?:?]
	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:746) ~[?:?]
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1615) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520) ~[?:?]
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527) ~[?:?]
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:377) ~[?:?]
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:373) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:373) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1598) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1571) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1371) ~[?:?]
	at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77) ~[?:?]
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[?:?]
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:671) ~[?:?]
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) ~[?:?]
	... 30 more

This is a known and not yet fixed issue which shouldnā€™t have any impact on the functionality.
You can supress these logs by setting

<Logger level="ERROR" name="org.apache.cxf.phase.PhaseInterceptorChain"/>

in the log4j2.xml file (see the initial post).

1 Like