Sony Devices Binding

Hi Tim, sorry an old version was indeed still active. Uninstalling in the karaf console and then dropping the new jar file did the trick. Now I have this log entries, which seems to be the changed message you meant:

2017-02-16 16:07:58.454 [WARN ] [y.internal.simpleip.SimpleIpProtocol] - Unparsable response ‘’ to command ‘*SEPIPI################’
2017-02-16 16:08:24.116 [WARN ] [y.internal.simpleip.SimpleIpProtocol] - Unparsable response ‘’ to command ‘*SEPIPI################’
2017-02-16 16:08:57.981 [WARN ] [y.internal.simpleip.SimpleIpProtocol] - Unparsable response ‘’ to command ‘*SEPIPI################’
2017-02-16 16:09:31.909 [WARN ] [y.internal.simpleip.SimpleIpProtocol] - Unparsable response ‘’ to command ‘*SEPIPI################’
2017-02-16 16:10:05.909 [WARN ] [y.internal.simpleip.SimpleIpProtocol] - Unparsable response ‘’ to command ‘*SEPIPI################’

Interesting - what model of tv do you have again? Do you know if it support picture-in-picture?

I have a KD-49XD7005 and i think it does not support pip because i cannot find the feature in the menus/manual and it does not react to the pip functions in your binding.

Try the latest one I just posted - should fix that issue…

It seems to work, thank you :slight_smile:

thanks, will give it a try and let you know the results.

i have updated openhab2 yesterday to current snapshot build #791 because i also had some strange error with the fritzbox binding which seems similar to this thread https://community.openhab.org/t/handler-takes-more-than-5000ms-for-processing-event/22158

not sure if it’s related, the sony binding stopped again status request this afternoon at 13:53 but the thing is still online in paperUI and i can controll the AV

`2017-02-16 13:53:04.420 [DEBUG] [inding.sony.internal.net.HttpRequest] - 42185 * Sending client request on thread ESH-thingHandler-2

42185 > GET http://192.168.205.46:50001/cers/getStatus
`
regarding the network i will do some further analysis and probably measure the wiring and replace the patchcables this weekend.

thanks, Oliver

Any updates on the scalar api? My Girlfriend is away for a week very soon :smiling_imp:

No real update - been too busy solving these other issues. The real issue with scalar is two fold: 1) its HUGE - it combines the capabilities of simpleip, dial and ircc into a single service and even adds to it. 2) its very dynamic and openhab just doesn’t like to be as dynamic as I’d like it to be to properly implement it - so I’ve been considering different design options on that and have yet to choose the best one. Give you an example - the scalar api (when I send it to my bravia) tells me there are two audio options (“speaker” and “headphone”) - I’d like to create two channel groups based on those names with the common audio channels (“mute” and “volume”) - giving you channels like speaker#mute, speaker#volume, headphone#mute, headphone#volume. I can’t easily do that with openhab right now. I don’t want to hardcode them because I’m pretty sure the AVs will tell me something different (probably something like “zone1”, “zone2” and will probably have additional audio channels [treble/bass/etc]). Very dynamic and that’s a simple example.

Hi Tim, since the last update everything is working fine and the binding ist stable!

While testing the channels and creating some items and rules i noticed, that the Primary Channel “Power” is not working as expected and does not “Power on/off device” of the AV. Instead it tries to power on/off the “Zone2” .
the power on command fails with WOL packet, and the power off command is sending AAAAAgAAAHkAAAAVAQ which actually toggles Zone2 on/standby:


2017-02-19 08:27:35.083 [INFO ] [ding.sony.internal.ircc.IrccProtocol] - WOL packet is not supported nor could we find a power on IRCC cmd
2017-02-19 08:27:36.068 [DEBUG] [inding.sony.internal.net.HttpRequest] - 2536 * Sending client request on thread safeCall-312
2536 > POST http://192.168.205.46:8080/upnp/control/IRCC
2536 > Accept: text/xml;charset=utf-8
2536 > Connection: close
2536 > Content-Type: text/xml;charset=utf-8
2536 > SOAPACTION: "urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"
2536 > User-Agent: OpenHab/Sony/Binding
2536 > X-CERS-DEVICE-ID: MediaRemote:00-11-22-33-44-55
2536 > X-CERS-DEVICE-INFO: OpenHab/Sony/Binding
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <s:Body>
    <u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">
      <IRCCCode>AAAAAgAAAHkAAAAVAQ==</IRCCCode>
    </u:X_SendIRCC>
  </s:Body>
</s:Envelope>


2017-02-19 08:27:36.138 [DEBUG] [inding.sony.internal.net.HttpRequest] - 2537 * Client response received on thread safeCall-312
2537 < 200
2537 < CONTENT-LENGTH: 311
2537 < CONTENT-TYPE: text/xml; charset="utf-8"
2537 < EXT:
2537 < SERVER: KnOS/3.2 UPnP/1.0 DMP/3.5
2537 < X-AV-Physical-Unit-Info: pa="STR-DN1030"
2537 < X-AV-Server-Info: av="5.0"; cn="Sony Corporation"; mn="STR-DN1030"; mv="1.00"
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
                xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
                s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <s:Body>
                <u:X_SendIRCCResponse xmlns:u="urn:schemas-sony-com:service:IRCC:1">
                </u:X_SendIRCCResponse>
        </s:Body>
</s:Envelope>

When i use the Primary IRCC Command channel sending PowerMain the AV powers on/off fine:

2017-02-19 08:46:37.597 [DEBUG] [ding.sony.internal.ircc.IrccProtocol] - Transformed PowerMain with map file 'ircc-5f9ec1b3-ed59-1900-4530-5453edf73098.map' to ircc:AAAAAgAAADAAAAAVAQ%3D%3D
2017-02-19 08:46:37.617 [DEBUG] [inding.sony.internal.net.HttpRequest] - 2552 * Sending client request on thread safeCall-318
2552 > POST http://192.168.205.46:8080/upnp/control/IRCC
2552 > Accept: text/xml;charset=utf-8
2552 > Connection: close
2552 > Content-Type: text/xml;charset=utf-8
2552 > SOAPACTION: "urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"
2552 > User-Agent: OpenHab/Sony/Binding
2552 > X-CERS-DEVICE-ID: MediaRemote:00-11-22-33-44-55
2552 > X-CERS-DEVICE-INFO: OpenHab/Sony/Binding
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <s:Body>
    <u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">
      <IRCCCode>AAAAAgAAADAAAAAVAQ==</IRCCCode>
    </u:X_SendIRCC>
  </s:Body>
</s:Envelope>

It’s nothing urgent as there is the workaround, but just wanted to make sure you get the test results from the AV amp users :wink:

Try the latest zip - should work for you

i think it’s still not working as expected.
toggling the power switch item (which was in on position) results in the following behavior:

  1. power off -> is activating Zone 2 Source
  2. power on -> putting AV in standby
  3. power off -> Zone2 in standby
  4. power on -> actually powering AV on

attached the excerpt from openhab.log and eventl.log
http://pastebin.com/TSqkft7E

Really weird - try the latest.

now it toggles Zone 2 on/off
the binding is only sending AAAAAgAAAHkAAAAVAQ which actually switches Zone2 on/off
this matches what’s listed in ircc transform: PowerZone2=ircc:AAAAAgAAAHkAAAAVAQ%3D%3D

shouldn’t it sends AAAAAgAAADAAAAAVAQ for PowerMain?

http://pastebin.com/gkBgdDwF

Yep - my fault, forgot the commands have that “STR:” attached to them. Try the latest instead…

thx, now it’s working!

one question: do you think it’s possible to poll also the power state of the AV and update the switch item accordingly?
when powering on/off the AV manually the switch on the sitemap does not reflect the correct status.

The only way to determine power status (in any IRCC device) is by side effects (there is no direct “getPowerStatus” type of call). The current implementation will turn set the switch ON if the getStatus call returns 200 and turn it OFF if the getStatus call returns 503 (service unavailable) - that worked both on the bravia and the bluray.

I’d watch the log for a few successful getStatus calls then turn the AV off and see what the log says then.

I’m not sure if getStatus will ever return 503 on your AV because you have two zones (zone1 off, zone2 on will probably still have the service running). Not sure if the AV really ‘turns’ off anyway because of that. Other than that - there is really no way of knowing…

Note2: your’s doesn’t have the scalar service (that I’m working on) implemented. But sony, supposedly, designed it to work on all their devices and someday you may get it. I definitely get an API that can tell that then

hmmm, then it seems i have no chance to detect the current power status.
even if AV is powered off, the getStatus call still returns 200

2017-02-22 22:08:15.070 [ItemCommandEvent          ] - Item 'IRCC_Power' received command OFF
2017-02-22 22:08:15.167 [ItemStateChangedEvent     ] - IRCC_Power changed from ON to OFF

2017-02-22 22:08:18.572 [DEBUG] [ding.sony.internal.ircc.IrccProtocol] - getContentInformation is not implemented
2017-02-22 22:08:20.577 [DEBUG] [inding.sony.internal.net.HttpRequest] - 45 * Sending client request on thread ESH-thingHandler-1
45 > GET http://192.168.205.46:50001/cers/getStatus
45 > Connection: close
45 > User-Agent: OpenHab/Sony/Binding
45 > X-CERS-DEVICE-ID: MediaRemote:00-11-22-33-44-55
45 > X-CERS-DEVICE-INFO: OpenHab/Sony/Binding

2017-02-22 22:08:21.163 [DEBUG] [inding.sony.internal.net.HttpRequest] - 46 * Client response received on thread ESH-thingHandler-1
46 < 200
46 < Connection: close
46 < CONTENT-LENGTH: 146
46 < CONTENT-TYPE: text/xml; charset="utf-8"
46 < X-AV-Physical-Unit-Info: pa="STR-DN1030"
46 < X-AV-Server-Info: av="5.0"; cn="Sony Corporation"; mn="STR-DN1030"; mv="1.00"
<statusList><status name="viewing"><statusItem field="source" value="TV" /><statusItem field="zone2Source" value="SOURCE" /></status></statusList>

also tried nmap, but in both ways the following ports are available

PORT      STATE SERVICE
80/tcp    open  http
1272/tcp  open  cspmlockmgr
1900/tcp  open  upnp
8080/tcp  open  http-proxy
50001/tcp open  unknown

So I’ve got an XBR-55X850C and I’ve been trying to get this binding to work for a bit now (I’m aware that it’s still under heavy development. :))

Two suggestions:

  1. Update the original post to include a link to the latest zip, and the PR. It took me quite a bit of digging to find the link to the latest version.
  2. Also, please include a brief snippet on what information would be useful in general for troubleshooting.

Now, on to the fun part!

Discovery seems to be failing for both IRCC and DIAL. DIAL is expected as it’s a TV, not a bluray, but IRCC was a bit surprising.

DIAL (expected):

07:45:37.789 [DEBUG] [inding.sony.internal.net.HttpRequest] - 3 * Sending client request on thread qtp31279137-71918
3 > GET http://10.254.20.191:80/DIAL/sony/applist
3 > Connection: close
3 > User-Agent: OpenHab/Sony/Binding
3 > X-CERS-DEVICE-ID: MediaRemote:00-11-22-33-44-55
3 > X-CERS-DEVICE-INFO: OpenHab/Sony/Binding

07:45:37.801 [DEBUG] [inding.sony.internal.net.HttpRequest] - 4 * Client response received on thread qtp31279137-71918
4 < 403
4 < Connection: close
4 < Content-Length: 0

IRCC (???):

07:45:37.910 [DEBUG] [y.discovery.IrccDiscoveryParticipant] - Could not find the IRCC service for device: org.jupnp.model.meta.DeviceDetails@37b55de0

So, I attempted to manually create the IRCC item. This is the RQST:

07:51:38.934 [DEBUG] [inding.sony.internal.net.HttpRequest] - 3 * Sending client request on thread qtp31279137-72008
3 > GET http://10.254.20.191:46007/DIALSCPD.xml
3 > Connection: close
3 > User-Agent: OpenHab/Sony/Binding
3 > X-CERS-DEVICE-ID: MediaRemote:00-11-22-33-44-55
3 > X-CERS-DEVICE-INFO: OpenHab/Sony/Binding

07:51:38.948 [DEBUG] [inding.sony.internal.net.HttpRequest] - 4 * Client response received on thread qtp31279137-72008
4 < 404
4 < Connection: close
4 < Date: Sat, 04 Mar 2017 14:51:39 GMT
4 < Server: FedoraCore/2 UPnP/1.0 MINT-X/1.8.1

And, as expected, when I attempted to configure the power channel and then turn the TV off:

07:59:50.688 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'master_tv_power_ircc' received command OFF
07:59:50.690 [ERROR] [ding.sony.internal.ircc.IrccProtocol] - IRCC Service was not found
07:59:50.694 [INFO ] [marthome.event.ItemStateChangedEvent] - master_tv_power_ircc changed from ON to OFF

For what it’s worth, the initial discovery:

1 > GET http://10.254.20.191:46007/dd.xml
1 > Connection: close
1 > User-Agent: OpenHab/Sony/Binding
1 > X-CERS-DEVICE-ID: MediaRemote:00-11-22-33-44-55
1 > X-CERS-DEVICE-INFO: OpenHab/Sony/Binding

07:45:37.777 [DEBUG] [inding.sony.internal.net.HttpRequest] - 2 * Client response received on thread qtp31279137-71918
2 < 200
2 < Accept-Range: none
2 < Application-URL: http://10.254.20.191:80/DIAL/apps/
2 < Connection: close
2 < Content-Length: 1155
2 < Content-Type: text/xml; charset="utf-8"
2 < Date: Sat, 04 Mar 2017 14:45:37 GMT
2 < Server: FedoraCore/2 UPnP/1.0 MINT-X/1.8.1
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
    <deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
    <friendlyName>XBR-55X850C</friendlyName>
    <manufacturer>Sony Corporation</manufacturer>
    <manufacturerURL>http://www.sony.net/</manufacturerURL>
    <modelDescription>BRAVIA</modelDescription>
    <modelName>XBR-55X850C</modelName>
    <UDN>uuid:aa5d148d-08ec-46bd-a198-2f9b0cdaa87e</UDN>
    <serviceList>
      <service>
        <serviceType>urn:dial-multiscreen-org:service:dial:1</serviceType>
        <serviceId>urn:dial-multiscreen-org:serviceId:dial</serviceId>
        <SCPDURL>/DIALSCPD.xml</SCPDURL>
        <controlURL>/upnp/control/DIAL</controlURL>
        <eventSubURL></eventSubURL>
      </service>
    </serviceList>
    <av:X_DIALEX_DeviceInfo xmlns:av="urn:schemas-sony-com:av">
      <av:X_DIALEX_AppsListURL>http://10.254.20.191:80/DIAL/sony/applist</av:X_DIALEX_AppsListURL>
      <av:X_DIALEX_DeviceType>Android_TV_DIAL_v1.0.0</av:X_DIALEX_DeviceType>
    </av:X_DIALEX_DeviceInfo>
  </device>
</root>

As an aside, thank you very much for the work on the binding. Automation of devices such as these seems to be one of openhab’s weaknesses at the moment, and having full integration of devices such as these is fantastic.

Kyle,

That is a really interesting log and very surprising. The binding is correct - your TV is advertising a DIAL service (but I haven’t got it working [yet]) and it is NOT advertising it has an IRCC service either (and really surprising it’s not advertising an XSCALAR service either). I’ve never seen that on a bravia - usually it advertises all three services.

Three things to try:

  1. Update the firmware to the latest - the rerun the discovery to see if those services are advertised again.
  2. Turn on simple ip (it’s under the network settings somewhere) - and try again.
  3. Finally - get the sony remote app (they’ve renamed it a few times now - look for Olivers posts above) - does that find it?

Let me know how it goes.

Note: I’ve paused a bit to work on the russound app. That needed some immediate attention (just started using habpanel) and wanted to create a widget for russound. Always does me good to let something lie about for a bit because when I get back to it - I get fresh ideas. In about a week or so, I’ll wrap up russound and get back to development on this.

Tim

It’s the latest firmware. Simple IP is on. And… the TV SideView app works fine.

No worries about the pause. I know perfectly well how taking a break can be beneficial, and this is likely just another curveball. :slight_smile:

When I was poking with the binding earlier it did actually manage to discover the scalar service, but it wasn’t able to find a core component of it (I unfortunately don’t have debug logs for this):

2017-03-03 21:53:10.737 [InboxAddedEvent           ] - Discovery Result with UID 'sony:scalar:4e4dc5e1-7f85-45d2-b5e0-afdd5c032613' has been added.
2017-03-03 21:56:04.801 [ThingAddedEvent           ] - Thing 'sony:scalar:4e4dc5e1-7f85-45d2-b5e0-afdd5c032613' has been added.
2017-03-03 21:56:05.322 [hingStatusInfoChangedEvent] - 'sony:scalar:4e4dc5e1-7f85-45d2-b5e0-afdd5c032613' changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): Device doesn't implement the system web service
2017-03-03 21:59:25.950 [hingStatusInfoChangedEvent] - 'sony:scalar:4e4dc5e1-7f85-45d2-b5e0-afdd5c032613' changed from OFFLINE (COMMUNICATION_ERROR): Device doesn't implement the system web service to OFFLINE (COMMUNICATION_ERROR): Error connecting to IRCC device (may need to turn it on manually)

At this point I’m thinking that the service for some reason just isn’t running. I’ll poke more with the remote app to see if that triggers the service into running.