Sony Devices Binding

openhab2
Tags: #<Tag:0x00007f51defa8200>

(Esteban Ramirez) #501

This is my configuration:

		/* SONY BRAVIA TV */

		Switch	    item=Bravia_Power label="Power SonyBravia" icon=television
		Switch	 	item=Bravia_IR label="Channel []" mappings=["Channel-Up"="CH +", "Channel-Down"="CH -"] icon=television
		Setpoint	item=Bravia_Volume label="Volume SonyBravia" minValue=0 maxValue=100 step=1 icon=soundvolume
		Switch 		item=Bravia_AudioMute label="Mute SonyBravia" mappings=[ON="ON", OFF="OFF"] icon=soundvolume
		Switch		item=Bravia_IR label="Entertainment []" mappings=["Netflix"="Netflix"] icon=television
	    Selection   item=Bravia_Input label="Input SonyBravia" mappings=[TV="TV", HDMI1="CHROMECAST", HDMI2="HDMI2", HDMI3="HDMI3", HDMI4="PS4"] icon=television

(Fulvio Malfatto) #502

Still not installable on raspbian due to missing apache modules… I could not find any trick, neither installing it manually from downloaded jar. Help!


(Markus Michels) #503

Hi,

I have a new Sony Bravia KD65-XF8505. I was able to install the binding using PaperUI. The TV was auto discovered and I could use the RQST as default to request a PIN, which was displayed on the TV screen. I could control on/off, switch to channels etc. - everything worked fine.

By mistake I deinstalled the binding (hit theuninstall button on the wrong line). Now I’m trying to reinstall it, which works, but I’m not able to discover the TV anymore. I see that the binding starts and registers for UPnP discovery, but nothing happens anymore.

2018-09-19 23:27:08.368 [DEBUG] [org.openhab.binding.sony            ] - BundleEvent STARTING - org.openhab.binding.sony
2018-09-19 23:27:08.398 [DEBUG] [org.openhab.binding.sony            ] - BundleEvent STARTED - org.openhab.binding.sony
2018-09-19 23:27:08.530 [DEBUG] [org.openhab.binding.sony            ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.UpnpDiscoveryParticipant}={service.id=392, service.bundleid=229, service.scope=bundle, component.name=org.openhab.binding.sony.discovery.dial, component.id=227} - org.openhab.binding.sony
2018-09-19 23:27:08.540 [DEBUG] [org.openhab.binding.sony            ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.UpnpDiscoveryParticipant}={service.id=393, service.bundleid=229, service.scope=bundle, component.name=org.openhab.binding.sony.discovery.ircc, component.id=228} - org.openhab.binding.sony
2018-09-19 23:27:08.550 [DEBUG] [org.openhab.binding.sony            ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.UpnpDiscoveryParticipant}={service.id=394, service.bundleid=229, service.scope=bundle, component.name=org.openhab.binding.sony.discovery.scalarweb, component.id=229} - org.openhab.binding.sony
2018-09-19 23:27:08.562 [DEBUG] [org.openhab.binding.sony            ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=395, service.bundleid=229, service.scope=bundle, component.name=binding.sony, component.id=230} - org.openhab.binding.sony
2018-09-19 23:27:08.571 [DEBUG] [org.openhab.binding.sony            ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.UpnpDiscoveryParticipant}={service.id=396, service.bundleid=229, service.scope=bundle, component.name=org.openhab.binding.sony.discovery.simpleip, component.id=231} - org.openhab.binding.sony

Binding show active on the OH console:

229 │ Active   │  80 │ 2.2.0.201711091019     │ Sony Binding

Installing, restarting binding and OH, clearing cache/tmp doesn’t make a difference. Maybe OH thinks that the device was already discovered and doesn’t calls the discovery handler anymore. I’m not able to initiate a manual discovery in the inbox - the binding doesn’t show up in the selection box. I’m running OH 2.3 on openHABian.

@tmrobert8 Any idea welcome. The binding worked fine for me, but if I couldn’t get it back to work…


(Markus Michels) #504

ok, some progress. I also removed the HUE binding, which results in removing the UPnP support (because was the last binding defining this dependency in feature.xml). The Sony binding is not yet part of the standard release, which means OH doesn’t know that it requires UPnP.

to get UPnP support back you need to run

feature:install esh-io-transport-upnp

Now I get “Could not find the IRCC service for device: org.jupnp.model.meta.DeviceDetails@57f0f3”

2018-09-21 23:51:49.117 [DEBUG] [inding.sony.internal.net.HttpRequest] - 5 * Sending client request on thread Start Level: Equinox Container: 10b85b66-808c-4181-b9b9-21ab3908af39
5 > GET http://192.168.6.22:29569/sony/webapi/ssdp/scpd/WebApiSCPD.xml
5 > Connection: close
5 > User-Agent: OpenHab/Sony/Binding
5 > X-CERS-DEVICE-ID: MediaRemote:00-11-22-33-44-55
5 > X-CERS-DEVICE-INFO: OpenHab/Sony/Binding
2018-09-21 23:51:49.126 [DEBUG] [inding.sony.internal.net.HttpRequest] - 6 * Client response received on thread Start Level: Equinox Container: 10b85b66-808c-4181-b9b9-21ab3908af39
6 < 200
6 < Accept-Range: none
6 < Connection: close
6 < Content-Length: 323
6 < Content-Type: text/xml; charset="utf-8"
6 < Date: Fri, 21 Sep 2018 21:51:46 GMT
6 < Last-Modified: Fri, 21 Sep 2018 21:41:38 GMT
6 < Server: FedoraCore/2 UPnP/1.0 MINT-X/1.8.1
<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <serviceStateTable>
    <stateVariable sendEvents="no">
      <name>X_ScalarWebAPI</name>
      <dataType>string</dataType>
    </stateVariable>
  </serviceStateTable>
</scpd>
2018-09-21 23:51:49.133 [DEBUG] [nding.sony.internal.net.HttpResponse] - >>> contents: 323: <?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <serviceStateTable>
    <stateVariable sendEvents="no">
      <name>X_ScalarWebAPI</name>
      <dataType>string</dataType>
    </stateVariable>
  </serviceStateTable>
</scpd>
2018-09-21 23:51:49.143 [DEBUG] [.sony.internal.ircc.models.IrccState] - No actionsurl - generating default
2018-09-21 23:51:49.149 [DEBUG] [.sony.internal.ircc.models.IrccState] - No UnrDeviceInformation - returning default version
2018-09-21 23:51:49.153 [DEBUG] [y.discovery.IrccDiscoveryParticipant] - IRCC device didn't implement a valid actionURL - ignoring: (RemoteDeviceIdentity) UDN: uuid:63c471f2-782b-496e-81ce-7fb57bd3dec0, Descriptor: http://192.168.6.22:29569/sony/webapi/ssdp/dd.xml
2018-09-21 23:51:49.159 [DEBUG] [y.discovery.IrccDiscoveryParticipant] - Could not find the IRCC service for device: org.jupnp.model.meta.DeviceDetails@57f0f3

(Markus Michels) #505

he he after waiting a while it detected the TV and I’m back in the game :slight_smile:


(Markus Michels) #506

what’s your environment?
I’m using

  • openHABian
  • openHAB 2.3 Release
  • Sony Binding date 11/07
    and it runs on a Raspberry Pi 3B

I’m using the binding version from the market placed, installed via PaperUI.

Make sure you have UNpP support installed
open OH console and run “feature:install esh-io-transport-upnp” (if no other binding is already using UPnP)


(Eric) #507

Hi,
I have a very basic question. I’m interested by the Sony STR-DN1080 and I’d like to control it with the Sony Audio API (the only one which exists as far as I know) using my own home automation system. But I don’t understand if this API only allows to control the AVR for audio streams or if it is broader than that (configuring behavior of viedo streams as well)…
For instance, is it possible to use API to ask the STR-DN1080 to use the HDMI input 1 as video source and send the video to HDMI (ouput) n°2 (for beamer) instead of HDMI ouput n°1 (TV), while sending the audio stream (from HDMI input 1) to speakers handled by the AVR ?
And later on (after movie), set the avr to play video from Hdmi input 1 to HDMI ouput n°1 (TV) instead of to HDMI output 2 (the beamer) and only use the TV for audio (ie no activation of speakers handled by AVR for audio) ?
Could anyone clarify if it can be done with the API ?
Thanks a lot


(Markus Michels) #508

I found several IRCC codes here:
https://www.symcon.de/forum/threads/26330-Sony-Bravia-TV-2014-per-Lan-steuern
which allows to send most keys of the remote using the IRCC channel.


(Edvard Filistovic) #509

Hello,

I have my STR-DN1050 and want to bind. but do not see any access code request on my scree. where I can get this code?

Ed


(David Åberg) #510

Sony Audio products currently don’t have any access restrictions and there for no way to get the access code (there isn’t one to get)


(Edvard Filistovic) #511

Hello,

then how I can use this binding? or i’ts impossible to use?

Ed


(Markus Michels) #512

@tmrobert8 Does anyone know where to find the latest code version? I rapidly get an exception case by a json parsing problem and would like to fix it. The binding is working, but the exception messes up the log.


(Markus Michels) #513

Did you checked the device setup if the remote control function has to be enabled (not required for newer Bravia TVs)


(Markus Michels) #514

fyi: In between I forked the code and did a 2.4 SNAPSHOT buid. The original build is missimg some try-catch and messes up the log (at least in my setup). I didn’t fixed the functionality, because I’m missing the detailed knowledge.

As far as I can say is the binding is working with my Bravia TV pretty well.


( . ) #515

@tmrobert8 wrote in juli that he made big improvements to the binding, but that he is lacking time to complete it. I know in the meanwhile another sony binding has been made in eclipse smarthome. As far as i know that binding is limited to Sony soundproducts. And now @markus7017 made a fork and some improvement. Would it be possible to create a WIP pull request for these changes? So that they don’t get lost and we are all able to contribute on the most recent version?


(Markus Michels) #516

Hi, as I said this fork is for personal use with the intention to suspress periodic exception messages messing up the log. If @tmrobert8 hadn‘t the time tomcomplete the change I won‘t expect that the pull request gets merged within a short term.

In fact the exception is caused by Json parsing problem, because a Json object is parsed, but the object is a an JsonArray. Maybe Sony changed the formaz to allow more than one entry. I think this could be handled flexible so that both formats could be supported.

I had a look to the sony braviatv binding, but this only supports power on/off and no scalar interface.


( . ) #517

The pull WIP request doesn’t need to get merged soon. It is just a way to share the code. Others can continue the pull request. At the moment all the work tmrobert8 (and you) have done is not available to other developers.

I’m willing to contribute, but i don’t like to do work that is allready been done.


(Tim Roberts) #518

@markus7017

Yes - I have a pretty big update that I haven’t committed yet. Let me see if I can commit it and you can retroactively put your changes to them (in case I haven’t done that yet). I’ve actually be waiting for @freke to finish his changes to integrate them into the scalar binding. He just did that so I’ll be looking into this soon to see how to integrate.

BTW - this is such a large binding - would you like to do dual development of it with me. I would love some help on it…

Tim


(Markus Michels) #519

Hi @tmrobert8 good. I‘m happy to test the new new one and see if the exceptions is gone and it works in general.

I‘m not sure if you I could support development. It seems that‘s is a complex topic and I‘m not familar with scalar, but lets see. I already did a binding for the Rachio sprinkler and now working on one for the Telekom TV receiver - done in general, but the details drive us nuts.

Looking foreard to the new build.


(Nick Woodforth) #520

hey guys,

im having a small issue. the sony binding works very well with all the other installed bindings and things i have. but when i add wol binding. i get runnable errors every few seconds.

2018-11-16 16:24:00.290 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 

javax.ws.rs.ProcessingException: java.net.NoRouteToHostException: No route to host (Host unreachable)

at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287) ~[?:?]

at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255) ~[?:?]

at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684) ~[?:?]

at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681) ~[?:?]

at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[?:?]

at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[?:?]

at org.glassfish.jersey.internal.Errors.process(Errors.java:228) ~[?:?]

at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444) ~[?:?]

at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681) ~[?:?]

at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437) ~[?:?]

at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343) ~[?:?]

at org.openhab.binding.sony.internal.net.HttpRequest.sendPostCommand(HttpRequest.java:193) ~[?:?]

at org.openhab.binding.sony.internal.net.HttpRequest.sendPostJsonCommand(HttpRequest.java:167) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.models.ScalarWebService.execute(ScalarWebService.java:230) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.models.ScalarWebService.execute(ScalarWebService.java:209) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.protocols.AbstractScalarWebProtocol.handleExecute(AbstractScalarWebProtocol.java:114) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.protocols.AbstractScalarWebProtocol.execute(AbstractScalarWebProtocol.java:98) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.protocols.AbstractScalarWebProtocol.execute(AbstractScalarWebProtocol.java:86) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.protocols.ScalarWebSystemProtocol.refreshPowerStatus(ScalarWebSystemProtocol.java:353) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.protocols.ScalarWebSystemProtocol.refreshState(ScalarWebSystemProtocol.java:215) ~[?:?]

at org.openhab.binding.sony.internal.scalarweb.protocols.ScalarWebProtocolFactory$1.run(ScalarWebProtocolFactory.java:151) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: java.net.NoRouteToHostException: No route to host (Host unreachable)

at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]

at java.net.Socket.connect(Socket.java:589) ~[?:?]

at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[?:?]

at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[?:?]

at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[?:?]

at sun.net.www.http.HttpClient.<init>(HttpClient.java:242) ~[?:?]

at sun.net.www.http.HttpClient.New(HttpClient.java:339) ~[?:?]

at sun.net.www.http.HttpClient.New(HttpClient.java:357) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1040) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1038) ~[?:?]

at java.security.AccessController.doPrivileged(Native Method) ~[?:?]

at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1037) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1334) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection.access$100(HttpURLConnection.java:91) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection$8.run(HttpURLConnection.java:1301) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection$8.run(HttpURLConnection.java:1299) ~[?:?]

at java.security.AccessController.doPrivileged(Native Method) ~[?:?]

at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782) ~[?:?]

at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1298) ~[?:?]

at org.glassfish.jersey.client.internal.HttpUrlConnector$4.getOutputStream(HttpUrlConnector.java:385) ~[?:?]

at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200) ~[?:?]

at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194) ~[?:?]

at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:243) ~[?:?]

at org.openhab.binding.sony.internal.net.Slf4jLoggingFilter$LoggingStream.write(Slf4jLoggingFilter.java:417) ~[?:?]

at java.io.OutputStream.write(OutputStream.java:116) ~[?:?]

at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299) ~[?:?]

at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) ~[?:?]

at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) ~[?:?]

at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295) ~[?:?]

at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141) ~[?:?]

at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229) ~[?:?]

at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:193) ~[?:?]

at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130) ~[?:?]

at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:99) ~[?:?]

at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:59) ~[?:?]

at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) ~[?:?]

at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) ~[?:?]

at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[?:?]

at org.openhab.binding.sony.internal.net.Slf4jLoggingFilter.aroundWriteTo(Slf4jLoggingFilter.java:358) ~[?:?]

at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[?:?]

at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130) ~[?:?]

at org.glassfish.jersey.client.ClientRequest.doWriteEntity(ClientRequest.java:517) ~[?:?]

at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:499) ~[?:?]

at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:388) ~[?:?]

at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285) ~[?:?]

... 27 more