Hi Tim, I have the same problems with Sony KDL-26EX553 (Bravia-2012). After enabling ircc discovery, I was able to add it, but it displays in thing with error. Of all available items only “power off” works.
openhab log
2020-06-04 22:31:51.787 [home.event.InboxAddedEvent] - Discovery Result with UID ‘sony:ircc:5453EDC2BE0A’ has been added.==> /var/log/openhab2/openhab.log <==
2020-06-04 22:31:51.788 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘sony:ircc:5453EDC2BE0A’ to inbox.==> /var/log/openhab2/events.log <==
2020-06-04 22:54:02.325 [me.event.InboxRemovedEvent] - Discovery Result with UID ‘sony:ircc:5453EDC2BE0A’ has been removed.
2020-06-04 22:54:02.359 [hingStatusInfoChangedEvent] - ‘sony:ircc:5453EDC2BE0A’ changed from UNINITIALIZED to INITIALIZING
2020-06-04 22:54:02.369 [hingStatusInfoChangedEvent] - ‘sony:ircc:5453EDC2BE0A’ changed from INITIALIZING to UNKNOWN: Initializing …
2020-06-04 22:54:02.587 [hingStatusInfoChangedEvent] - ‘sony:ircc:5453EDC2BE0A’ changed from UNKNOWN: Initializing … to OFFLINE (CONFIGURATION_ERROR): 404 - not foundnot found
2020-06-04 23:03:31.828 [.ItemChannelLinkAddedEvent] - Link ‘BRAVIAKDL26EX553_Primary_IRCCPower-sony:ircc:5453EDC2BE0A:primary#power’ has been added.
2020-06-04 23:03:42.349 [ome.event.ItemCommandEvent] - Item ‘BRAVIAKDL26EX553_Primary_IRCCPower’ received command ON
2020-06-04 23:03:42.372 [nt.ItemStatePredictedEvent] - BRAVIAKDL26EX553_Primary_IRCCPower predicted to become NULL
2020-06-04 23:03:46.491 [ome.event.ItemCommandEvent] - Item ‘BRAVIAKDL26EX553_Primary_IRCCPower’ received command OFF
2020-06-04 23:03:46.499 [nt.ItemStatePredictedEvent] - BRAVIAKDL26EX553_Primary_IRCCPower predicted to become NULL
2020-06-04 23:03:48.008 [ome.event.ItemCommandEvent] - Item ‘BRAVIAKDL26EX553_Primary_IRCCPower’ received command ON
2020-06-04 23:03:48.026 [nt.ItemStatePredictedEvent] - BRAVIAKDL26EX553_Primary_IRCCPower predicted to become NULL
2020-06-04 23:03:49.053 [ome.event.ItemCommandEvent] - Item ‘BRAVIAKDL26EX553_Primary_IRCCPower’ received command OFF
2020-06-04 23:03:49.063 [nt.ItemStatePredictedEvent] - BRAVIAKDL26EX553_Primary_IRCCPower predicted to become NULL
2020-06-04 23:04:00.996 [ome.event.ItemCommandEvent] - Item ‘BRAVIAKDL26EX553_Primary_IRCCPower’ received command ON
2020-06-04 23:04:01.006 [nt.ItemStatePredictedEvent] - BRAVIAKDL26EX553_Primary_IRCCPower predicted to become NULL
2020-06-04 23:05:26.623 [.ItemChannelLinkAddedEvent] - Link ‘BRAVIAKDL26EX553_Primary_IRCCCommand-sony:ircc:5453EDC2BE0A:primary#command’ has been added.
2020-06-04 23:05:37.708 [.ItemChannelLinkAddedEvent] - Link ‘BRAVIAKDL26EX553_Viewing_Title-sony:ircc:5453EDC2BE0A:viewing#title’ has been added.
2020-06-04 23:05:45.973 [.ItemChannelLinkAddedEvent] - Link ‘BRAVIAKDL26EX553_Content_Title-sony:ircc:5453EDC2BE0A:content#title’ has been added.
2020-06-04 23:05:54.098 [.ItemChannelLinkAddedEvent] - Link ‘BRAVIAKDL26EX553_Content_Description-sony:ircc:5453EDC2BE0A:content#description’ has been added.
2020-06-04 23:07:55.067 [ome.event.ItemCommandEvent] - Item ‘BRAVIAKDL26EX553_Primary_IRCCCommand’ received command NULL
2020-06-04 23:07:55.072 [nt.ItemStatePredictedEvent] - BRAVIAKDL26EX553_Primary_IRCCCommand predicted to become NULL
2020-06-04 23:08:03.553 [ome.event.ItemCommandEvent] - Item ‘BRAVIAKDL26EX553_Primary_IRCCCommand’ received command NULL
2020-06-04 23:08:03.562 [nt.ItemStatePredictedEvent] - BRAVIAKDL26EX553_Primary_IRCCCommand predicted to become NULL
today I tried to install the SONY Binding, and after trying and failing first I read quite a bit but not successful. I understand it is still in development so there isn’t any rush, just wanted to provide this feedback for you to know, and in case someone can give me a hint, I would be very happy.
Environment :
Raspberry pi 4 Model B Rev 1.2
OH 2.5.5.1
SONY KDL 65 XF 9005 (2020) latest firmware
Problem:
Binding installs fine through PaperUI
Scalar is discovered
Thing created, and On Screen PIN dispalyed.
After entry of PIN, following error in log
2020-06-08 20:24:39.277 [INFO ] [.internal.scalarweb.ScalarWebHandler] - Attempting connection to Scalar Web device…
2020-06-08 20:24:41.247 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.NoSuchFieldError: bundleContext
at org.openhab.binding.sony.internal.scalarweb.ScalarWebHandler.initializeTask(ScalarWebHandler.java:187) ~[?:?]
at org.openhab.binding.sony.internal.scalarweb.ScalarWebHandler.access$1(ScalarWebHandler.java:160) ~[?:?]
at org.openhab.binding.sony.internal.scalarweb.ScalarWebHandler$2.run(ScalarWebHandler.java:152) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_252]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_252]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_252]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Tried so far:
remove/ reinstall,clean cache, delete Pin association with TV, Delete .map, reinstall… same issue…
I guess it only something minor…but don’t know what else to try.
I have just tried to migrate from the Sonyaudio binding, which I’ve completely removed, to the Sony plugin to control my HT-ZF9 soundbar. The Sony plugin discovers it, but reports “Error connecting to Scalar Web device (may need to turn it on manually)” after accepting the Thing creation. Reviewing the Thing’s properties shows the correct IP, and curl is able to download the XML from the displayed Web URL.
I tested with the soundbar on and plugged in, but I never saw any kind of authentication request.
This is OpenHAB 2.5.5-1 with version 2.5.5.202004201157 of the Sony binding. Here’s an excerpt of the downloaded XML:
Hi
I use this addon to start some light in the evening based on TV ON status. It has always been working fine with SimpleIP. However, since Scalar is working in the binding, the simpleIP seems to be sometimes broken (or doesn’t get upted)
That wouldn’t be a problem if the Scalar thing was working fine from the filebase config. It seems it works fine when defined via PaperUI, but if I define it manually in a sony.things file, it doesn’t work properly
I still can’t reliably get the POWER status, either via simpleIP or via Scalar. With simpleIP, it is because it is simply not checked. There are queries sent periodicaly (like every 30s) to check for the volume or channel for example, but never for the power state :
@tmrobert8 is there any way to restart CEC/HDMI synchronization?
I have this problem, that I always use my KD-75XE9005 connected via HDMIwARC to my Onkyo TX-RX820. So I have speakers set up to “System audio” instead of “TV Speakers”. Usually it works very well with my Xbox One X connected to Onkyo. However when I want tu use TV Android apps like HBO or Netflix, it happens that pretty often I’m loosing sound, so Onkyo don’t switch for some reason to its AMP and there is lack of sound.
As I discovered, the only way to fix that is to switch Sony TV to “TV Speakers” and then, after few seconds, switch back to “System audio”.
It usually fix the problem, but I was hoping to find some solution with your binding. I remember that with some previous version of your binding I made a rule for switching CEC sync to OFF and then switch it back to ON and this was pretty nice solution. Unfortunately I don’t remember which channel it was and also I can’t find this option with the current version, is there any?
Maybe you or someone else have some better solution for me to fix this issue?
@tmrobert8 as you have a lot of knowledge about the Sony REST API, I have a question where you might be able to help. I’m using the REST API in my own rules, directly adressing (without the binding, just the get/post requests). It’s working all fine, no issues.
However I wanted to get the information, which App is currently running. In the docs I see the call to start an App, but I see no get request detailing which App is currently active, running and on front. Do you know how to get this information and if yes, which request & endpoint you are using.
Perhaps you could share your rules so others can learn from them? It would be great to see you post this in a new thread as often peoples scripts and rules can inspire new features.
This would also make it easier for you to get a more useful reply.
Ähhm sorry?! If you have invested 5 seconds more in looking at my profile and my posts rather then writing the above comment, you would know that I support this forum with good posts and help other members… Always great to have such a member like you!
But to answer your question, it’s the function that I posted into OAuth thread. You can find it by looking at my recent posts…
As said before, it is a function originally posted in the OAuth 2.0 thread with just a small modification. Basically you hand over to the function the endpoint and the post payload detailed in the Sony Bravia docs.
The question that I raised was, that I can’t find a request for the currently actively running App. This would be nice, because then I could display it also in OH. For now I can only start an, see which apps are installed etc, but no where I find the current running app in the foreground. Therefore @tmrobert8 might know it, because he is working on the REST API quite some time and knows a (unofficial) solution?
Here is the code that I use. Please note that the PSK is replaced by **** and as an example I just post the rule for on off the TV. You can obviously improve this code, e.g. putting it all in one function, put in a flag so that no duplicated commands are sent leading to strange behaviour etc etc…
Rule to call the function
// Query for TV Power status from TV API directly
rule "Sony TV an aus schalten toggle"
when
Item Sw_v_sonyTV_onoff_toggle received command
then
St_v_sonyTV_err.sendCommand("Starting start/shut down TV")
St_v_sonyTV_err_bol.sendCommand("false")
Dt_v_sonyTV_on_energy_API_updatestamp.postUpdate(new DateTimeType())
val endpointExt = "system"
var queryBody = ''
switch(receivedCommand) {
case OFF: {
queryBody = '{"method": "setPowerStatus","id": 55,"params": [{"status": false}],"version": "1.0"}'
St_v_sonyTV_err.sendCommand("Starting shut down TV")
}
case ON: {
queryBody = '{"method": "setPowerStatus","id": 55,"params": [{"status": true}],"version": "1.0"}'
St_v_sonyTV_err.sendCommand("Starting start TV")
}
}
val response = querySonyTVAPI.apply(IP_SONYTV + BASE + endpointExt, queryBody, readResponse)
// logWarn("SonyTV", "Query Status: " + response)
if (response.startsWith("ERROR")) {
St_v_sonyTV_err_bol.sendCommand("true")
return
}
St_v_sonyTV_err.sendCommand("Finished status query")
end
Function itself
val Functions$Function1<HttpURLConnection, String> readResponse = [ connection |
val responseCode = connection.responseCode
if(responseCode != 200){
return "ERROR " + responseCode.toString;
}
val StringBuffer sb = new StringBuffer()
val BufferedReader br = new BufferedReader(new InputStreamReader(new BufferedInputStream(connection.getInputStream())))
var String inputLine = ""
while ((inputLine = br.readLine()) !== null) {
sb.append(inputLine)
}
sb.toString
]
// send the command and get the answer back
val Functions$Function3<String, String, Functions$Function1<HttpURLConnection, String>, String> querySonyTVAPI = [ endpointURL, queryBody, readResponse |
try {
val endpoint = new URL(endpointURL)
val HttpURLConnection connection = endpoint.openConnection() as HttpURLConnection
connection.requestMethod = "POST"
connection.setRequestProperty ('X-Auth-PSK', "****")
connection.doOutput = true
connection.setDoInput = true
connection.setConnectTimeout(30000); //set timeout to 30 seconds
val OutputStream os = connection.getOutputStream()
val OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8")
osw.write(queryBody)
osw.flush()
osw.close()
os.close()
val response = readResponse.apply(connection)
return response;
} catch (java.net.SocketTimeoutException e) {
return "ERROR TIMEOUT " + e.toString;
} catch (java.io.IOException e) {
return "ERROR IOException " + e.toString;
}
]
Ahh cool thanks for the post. Yeah I saw the same description in the binding docs on github, butit wouldbbe interestingtto wwhich API call this is referred to (though probably broken atm).
However very hacky solution would beto have a background deamon on the TV, aaccessing it via the Android functions… But that’s not a good design and approach
I recently bought a BDP S-6700 and I’m trying to enable the binding. It seems that there are some problems with the authentication for IRCC protocol. The device never shows the code and the binding remains in OFFLINE with error ‘forbidden’. I tried with curl to start the registration process with
I have a X750H TV and cant get it to communicate with the Binding. My old Sony TV talks just fine, but my new one will not talk on any of the binding options. I have Simple IP commutation trued on, and it dose talk to the Sony Simple IP test app.