Sony Devices Binding

@andan
Gosh, such a silly mistake. Thank you for noticing!

Sorry if this is too basic… but can anybody explain me how to add the TV as a Thing using the text files?

I got as far as this:

Thing sony:scalar:937e8aceda45 "TVSony" [deviceAddress="192.168.100.15", commandsMapFile="scalar-937e8aceda45.map"]

Just updated to OH3.0.1. Swtiched to your .jar File and my Things were back online. Thank you and @tmrobert8 for this great work. Would love to see this Binding getting merged some day.

The Binding works great for me. It did on OH2.5 an does on OH3.0.1 by using simpleip and scalar. The only problem i can’t get fixed is that my device dosent stays reachable, it always falls in a kind of deep sleep. That results in the Binding turning offline.

OFFLINE (COMMUNICATION_ERROR): Error connecting to Scalar Web device (may need to turn it on manually)

My model is KD-49X8505B connected via ethernet. Any suggestions what settings in my TV may help? Does someone having same problems?

Biggest problems with that is that i cant turn on the TV via Binding and the Binding ist spamming my log trying to reconnect the Thing (with much more than just the line above).

The log spamming i may can handle by change / disable reconnect setting of the thing but then if my TV goes online by remote or Wake-On-LAN the Thing isnt trying to connect and stays offline (as expected).

Any ideas?

I’m experiencing the same issue with my TV and have already started investigations to improve the behaviour (if possible). My current understanding is that powering on via WOL should work regardless of the thing status. I’ve also observed that WoL via other tools seems to work even if the TV is in deep standby mode. Hope I can provide an update soon.

BTW: Did you experience the same issue also with the OH2.5 version?

Its was the same in OH2.5 as it is now in OH3.0.1 only that i get some additional warnings now.

I can confirm WOL is working even if the Thing cant connect any more. I think @tmrobert8 at some point had included a built-in WOL in the Binding but that does not work at least for me in OH3 now. In OH2.5 this Wake-on-LAN - Bindings | openHAB worked. I think it dosent in OH3 too. May be the same cause.

Its interessting that it takes about 20 minutes after turning the tv off that the binding loses connection. Until then turning the tv on again via binding works. Seems like some additional powersaving kicks in after that time.

I am thinking about writing a rule that disables the Thing when the tv is turned off and enables it when turning the tv on by WOL. Then the Binding would stay offline when using the remote to turn the tv on and vice versa. So not the best solution either. And at the moment i keep getting warnings in the log even after disabling the thing manually:

[WARN ] [.core.thing.binding.BaseThingHandler] - Handler ScalarWebHandler tried updating the thing status although the handler was already disposed.

EDIT:
Just saw the posts of @Rickytr and @dexter. Thats what iam getting too.

Yes, the implemention of the power on command is based on WOL in the binding.

I will try to implement a completely binding based solution for this problem, but if you find a working alternative solution it would be great if you could share it.

I’m also working on getting the code ready for a pull request for the offical OH3 addons repository, where I hope that @tmrobert8 will find some time for supporting this task.

In OH3 Network - Bindings | openHAB is working great for WOL. Works a little bit different but had no trouble setting it up.

I’ve released a new version for testing an improved WOL behaviour:
https://github.com/andan67/openhab-addons-sony/releases/tag/3.1.0-alpha.andan-SNAPSHOT

With this version it is possible to power on the device using the sony:scalar#powerstatus channel even from deep standby mode. The connection will be established ~30s after issuing the command. Commands that are sent right after the power on command should be cached and executed when the device becomes online (not tested yet). The retry polling can be disabled (i.e. set to -1).

@Knut1507 It would be great of you could test the version. Note that this still work in progress and subject for change and further improvements.

I look forward to here about similar solution for Openhab 2.5 and Simple IP :slightly_smiling_face:
Currently I have to use WOL binding and Sony/Simply IP binding/thing with Retry Polling set to 1000s. The only combination which works for my Bravia KDL: when I switch WOL binding th TV is ON, then after x-1000s Simply IP detects that TV is on and the thing Simple IP change to ONLINE (from OFFILNE COMMUNICATION ERROR state). I am using 1000s (~16min) to reduce COMMUNICATION ERROR messages in the log

I’ve justed replaced the previous release
https://github.com/andan67/openhab-addons-sony/releases/tag/3.1.0-alpha.andan-SNAPSHOT

This release fixes a major bug and supports WOL based powering on from deep standby for scalar, simple IP, and ircc services (tested only for scalar).

@RafalO I think I won’t backport the changes for OH2.5. So maybe its time to migrate :slight_smile:

I updated to the newest release and tried but the WOL via Simple IP did not work. I turned the tv off, waited till the binding could not connect anymore and then tried to turn it on again.

2021-03-14 09:44:22.517 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'SonySimpleIP_Power' received command OFF
2021-03-14 09:44:22.532 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'SonySimpleIP_Power' predicted to become OFF
2021-03-14 09:44:22.542 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonySimpleIP_Power' changed from ON to OFF
2021-03-14 09:44:26.420 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonySimpleIP_Volume' changed from 10 to 0
2021-03-14 09:44:26.520 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonySimpleIP_Channel' changed from 4.0 to 
2021-03-14 10:04:35.951 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Exception occurred reading from the socket: server closed connection
2021-03-14 10:06:35.953 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from OFFLINE (COMMUNICATION_ERROR): Exception occurred reading from the socket: server closed connection to UNKNOWN: Initializing ...
2021-03-14 10:06:37.957 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from UNKNOWN: Initializing ... to OFFLINE (COMMUNICATION_ERROR): Error connecting to simple IP tv
2021-03-14 10:08:37.958 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from OFFLINE (COMMUNICATION_ERROR): Error connecting to simple IP tv to UNKNOWN: Initializing ...
2021-03-14 10:08:39.962 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from UNKNOWN: Initializing ... to OFFLINE (COMMUNICATION_ERROR): Error connecting to simple IP tv
2021-03-14 10:09:56.116 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'SonySimpleIP_Power' received command ON
2021-03-14 10:09:56.125 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'SonySimpleIP_Power' predicted to become OFF
2021-03-14 10:10:39.963 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from OFFLINE (COMMUNICATION_ERROR): Error connecting to simple IP tv to UNKNOWN: Initializing ...
2021-03-14 10:10:41.969 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from UNKNOWN: Initializing ... to OFFLINE (COMMUNICATION_ERROR): Error connecting to simple IP tv

I disabled the Simple IP Thing and enabled the ScalarThing. Then i tried turning on the tv via my scalar power item. WOL didnt worked there either. I read you successfully tested it with scalar so maybe its not a problem with your code but when i use the addtional networkbinding WOL my tv turns on instantly.

After my tv turning on i discoverd this in the log

==> /openhab/userdata/logs/events.log <==
2021-03-14 10:32:19.479 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonySimpleIP_Power' changed from OFF to ON
==> /openhab/userdata/logs/openhab.log <==
2021-03-14 10:32:21.930 [INFO ] [web.protocols.ScalarWebLoginProtocol] - WOL packet sent to FC:F1:52:A5:02:57
2021-03-14 10:32:22.319 [INFO ] [web.protocols.ScalarWebLoginProtocol] - WOL packet sent to FC:F1:52:A5:02:57
2021-03-14 10:32:22.853 [INFO ] [web.protocols.ScalarWebLoginProtocol] - WOL packet sent to FC:F1:52:A5:02:57

To me it seems the binding dosent execute the WOL unless the Thing is online. After turning on the the tv by remote and turn it off an on again via binding after the Thing went online its sending the WOL.

2021-03-14 11:47:11.793 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sony:simpleip:dfe0ea25' changed from UNKNOWN: Initializing ... to ONLINE
2021-03-14 11:47:41.906 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonySimpleIP_Power' changed from OFF to ON

==> /openhab/userdata/logs/openhab.log <==
2021-03-14 11:48:11.867 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'SonySimpleIP_Power' received command OFF
2021-03-14 11:48:11.880 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'SonySimpleIP_Power' predicted to become OFF
2021-03-14 11:48:11.886 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonySimpleIP_Power' changed from ON to OFF
2021-03-14 11:48:15.334 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'SonySimpleIP_Power' received command ON

==> /openhab/userdata/logs/openhab.log <==
2021-03-14 11:48:15.387 [INFO ] [y.internal.simpleip.SimpleIpProtocol] - WOL packet sent to FC:F1:52:A5:02:57

==> /openhab/userdata/logs/events.log <==
2021-03-14 11:48:15.388 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'SonySimpleIP_Power' predicted to become ON
2021-03-14 11:48:15.391 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonySimpleIP_Power' changed from OFF to ON

You see the WOL send and the tv going online but as long as the Thing is online its working without WOL anyway.

Unfortunately I forgot to mention that the retry polling needs to be disabled to enable the new WOL feature. The reason is just that I re-used existing code.

If a power on command is detected when the thing is offline, you should see the debug log message “Sent WOL”.

If this doesn’t help, then please let me know which power channels you are using. Thanks.

To disabled retry polling did the trick. Now its working.

@Rickytr
I’m revisiting your issue with the IRCC service. For this it would help if you could provide the event logs for the period from switching on the device until the time the ircc services goes online by saving the configuration. Thanks.

Hi @andan sorry for my late reply.

The problem is that after switch off the bluray I receive the following errors:

21-03-23 13:08:25.035 [hingStatusInfoChangedEvent] - Thing ‘sony:ircc:94db565a279d’ changed from OFFLINE (COMMUNICATION_ERROR): Could not connect to 192.168.xxx.xxx:50001 to UNKNOWN: Initializing …

2021-03-23 13:08:25.174 [hingStatusInfoChangedEvent] - Thing ‘sony:ircc:94db565a279d’ changed from UNKNOWN: Initializing … to OFFLINE (CONFIGURATION_ERROR): Unable to request an access code - HOME menu not displayed on device. Please display the home menu and try again.

After this the thing remains in ERROR:CONFIG and nothing happens even after I switch on the device. With the device ON if I save the configuration again the thing goes online.
As far as I can tell the problem is the wrong change in state when the thing goes offline.

Thanks @Rickytr for this helpful information. This is exactly the same bahaviour I observe from the ircc service of my TV. I think I’ve found the root cause of this issue and hope to provide a fix in the next week (for the OH3 version).

@Rickytr Here are the results of my analysis of your issue:

  • It seems that issue is caused by a parallel connect request from both the scalar and the ircc service on powering on the device
  • This results in an http error 503 for the ircc connect request, which is interpreted as a configuration error (thus the according error message)
  • Because the error is categorized as configuration error, the retry polling is not effective and therefore the irrc service stays offline (this is to prevent an infinite retry loop caused by bad configuration settings)
  • Saving the ircc service configuration triggers a new connect try. As at this time the scalar service is already online, this connect try is not disturbed by the scalar service and thus the ircc service eventually goes online

You might try one of the following options to solve this issue:

  • Power on the device with the ircc service if not already done (this might solve the parallel connect request problem)
  • Set-up a rule that that sends a power on command from the ircc service when the scalar service goes online. The code for the rule might look like

triggers:

  • id: “1”
    configuration:
    thingUID: sony:scalar:d8d43c4d563d
    status: ONLINE
    type: core.ThingStatusChangeTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: SonyIrcc_IRCCPower
    command: ON
    type: core.ItemCommandAction

I’m currently unsure if I should deal with this issue in the code as I don’t want to break anything that @tmrobert8 might have implemented for good reasons (like handling the http error as configuration error).

@andan I’m not sure that the problem can be this one. I disabled the scalar service and I’m already using the ircc service to switch on the device. And as far as I can tell from the logs the ircc service goes to configuration error after repeatedly trying to connect after a switch off. The problem doesn’t seem related to switch on but to switch off…

Hello!
Cannot make binding to work.
Fresh OH3 with zwave things and items, few rules.
openHAB 3.1.0.M2
added Sony binding.jar placed here on Mar 14 fto the folder, when OH3 was stopped, started OH3 - nothing.
Broadlink.jar is OK, for example.
Then I jumped to the first post Sep 2016, installed everything, OH3 stopped to work…
Then I uninstalled everything from Sep 2016 post.
Removed Sony.jar, removed Sony folder in /var/lib/openhab.
Now OH3 is working BUT in Things inbox I seeing Sony binding, but it uninstalled. (Also I seeing deleted Chromecast binding…).
Sooo, any help, how to install Sony binding for OH3 and do not break my hub ?
Also how to delete binding info if it is not in adding folder?
Fast reading of posts from Nov 2020 didn’t helped.