Now that the OH 3.1 version has been released, I think it is time to open a new thread that is dedicated to the OH 3 version of the Sony binding.
This binding has been originally developed by @tmrobert8 for OH 2 and is extensively discussed in the thread Sony Devices Binding. Since start of the development in 2016, it has evolved to one of the most powerful openHAB addons that is characterized by its support of a large range of Sony devices in combination with a high level of auto-discovery of the device capabilities.
For various reasons, the binding hasnβt been merged into the official addons repository yet. One of the consequences is that the migration of the binding code to OH 3 hasnβt been performed by the OH maintainers when OH 3 was released. This was the motivation for me to try to migrate the available OH2 code by my own when I started my OH journey in January 2021. In course of this work, it has turned out that I also had to implement some tweaks and fixes to get the binding work nicely for my Sony TV. Also, Iβve tried to address other issues that were reported by users in the OH2 thread.
With opening a new thread, Iβd like to provide a consolidated place for downloading the OH3 binding version from my personal github account and for reporting and discussing issues and further enhancements.
Please note that my contribution to the overall binding code is still rather marginal compared to what the original author @tmrobert8 provided. He gave same valuable hints when I started with the migration, but since than has been inactive. Of course, in case he becomes active again, I would be more than happy to collobarate with him in maintaining the binding. Thus for the time being, the support from the community is important to compensate my limited knowledge of the code (escpecially regarding certain non-obvious implementation solutions) and my testing capabilities.
Regarding the future of the binding, my original intention was to get the binding part of the official addons repository to ease the distribution, installation and maintenance. However, my current preference is to publish this binding on the new market place that has been announced forr the OH 3.2 version coming end 2021. I could imagine that this would be the less stressfull and faster alternative.
Binding download
The latest binding version for OH 3.1 (stable verions) and OH 3.2 can be downloaded from my fork of the addons repository:
Installation from community marketplace download
Starting with OH 3.2M3, the binding can also directly be installed from the community marketplace. In this case, no further manual installation steps are required
Changes to original OH2 binding code
The code is based on the latest released OH 2.5 binding version (see Release 2.5 12/01 #2 Β· tmrobert8/openhab-addons Β· GitHub) with following major changes:
- Standard OH2 β OH3 migration changes
- Fix of βCOMMUNICATION_ERROR - Forbiddenβ issue (see Sony Devices Binding - #1281 by dexter)
- Fix of issue with non refreshing item states (see Sony Devices Binding - #1301 by waspie)
- Fix of issue with incomplete preset channel list (see Sony Devices Binding - #1340 by andirs)
- Fixed/improved retry and WOL handling (see e.g. Sony Devices Binding - #1324 by Knut1507)
- Fix of issue with blu-ray player thing not getting online when device is switched on (see Sony Devices Binding - #1334 by Rickytr)
- Fix of issue where TV goes into disabled state after discovery (see Sony Devices Binding - #1347 by buch)
- Introduced option to sort and filter preset channel list
Installation
Not required if installed via community marketplace!
The installation procedures is nearly identical to the OH2.5 version:
- Open the karaf console
- From the console -
bundle:uninstall org.openhab.binding.sony
(if a previous version has already been installed) - Wait about 10 seconds for the bundle to be uninstalled
- Install feature dependencies by following commands:
feature:install openhab-transport-upnp
feature:install openhab-transformation-map
- Shutdown openHAB
- Remove all sony jars from the addons directory
- Optionally (to fully clean up) - delete the userdata/sony directory
- Start openHAB
- Wait about 30 seconds for openHAB to startup properly
- Copy the new jar into the addon directory
- Wait about 30 seconds for the addon to initialize and your things to come back online.
Documentation
The mainly unchanged documentation in form of README files can be found here:
Logging
To get the binding logging into a separate file, edit the file userdata/etc/log4j2.xml
as follows:
<Appenders>
...
<!-- Sony binding appender -->
<RollingFile fileName="${sys:openhab.logdir}/sony.log" filePattern="${sys:openhab.logdir}/sony-%d{yyyyMMdd-HHmmss}.log" name="SONY">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="16 MB"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
...
<Logger level="ERROR" name="org.apache.cxf.phase.PhaseInterceptorChain"/>
<Logger additivity="false" level="INFO" name="org.openhab.binding.sony">
<AppenderRef ref="SONY"/>
</Logger>
</Loggers>
The logger entry for PhaseInterceptorChain
supresses warning messages in the openhab log when Sony devices are unreachable. I havenβt yet found a way to avoid these warnings in the code.
Runtime configuration settings
It is highly recommended to disable the source feature of the binding as it tries to connect to github in short intervalls to get thing definitions from a library. I think I will delete this feature an in upcoming version as it seems to be obsolete.
Also you can define wich services (represented as things) should be auto-discovered by the binding.
The according settings are done in `services\runtime.cfgβ file as follows:
sony.sources:local=false
sony.sources:github=false
discovery.sony-simpleip:background=false
discovery.sony-dial:background=false
discovery.sony-ircc:background=false
discovery.sony-scalar:background=true