Bose SoundTouch and special characters

Hello,

I’m trying to display the currently playing music stats of my Bose Soundtouch devices. The general connection and binding work fine. Unfortunately when the item value contains (some not all) special characters, the item state behaves not correctly. Example:

2020-03-14 15:35:58.307 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingArtist changed from NULL to Fest
2020-03-14 15:35:58.318 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingArtist changed from Fest  to &
2020-03-14 15:35:58.324 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingArtist changed from & to  Flauschig

2020-03-14 15:35:58.328 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingAlbum changed from NULL to Fest
2020-03-14 15:35:58.335 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingAlbum changed from Fest  to &
2020-03-14 15:35:58.340 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingAlbum changed from & to  Flauschig

2020-03-14 15:37:39.339 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingAlbum changed from NULL to Can
2020-03-14 15:37:39.345 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingAlbum changed from Can to '
2020-03-14 15:37:39.352 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingAlbum changed from ' to t Fight It

2020-03-14 15:37:39.314 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from NULL to Can
2020-03-14 15:37:39.317 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from Can to '
2020-03-14 15:37:39.322 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from ' to t Fight It

2020-03-14 15:40:19.725 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from NULL to Wide Awake (feat. Gustaf Norén
2020-03-14 15:40:19.730 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from Wide Awake (feat. Gustaf Norén  to &
2020-03-14 15:40:19.739 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from & to  Filatov
2020-03-14 15:40:19.752 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from  Filatov  to &
2020-03-14 15:40:19.757 [vent.ItemStateChangedEvent] - Bose_office1_nowPlayingTrack changed from & to  Karas) - Red Mix

When the item state contains these characters, it splits the value and uses the last splitted part as the final value. When there are no special characters, everything works fine.

The items are defined as follows:

Switch  Bose_office1_Power                              { channel="bosesoundtouch:10:office1:power" }
String  Bose_office1_operationMode                      { channel="bosesoundtouch:10:office1:operationMode" }
Player  Bose_office1_playerControl                      { channel="bosesoundtouch:10:office1:playerControl" }
Dimmer  Bose_office1_volume                             { channel="bosesoundtouch:10:office1:volume" }
String  Bose_office1_nowPlayingAlbum                    { channel="bosesoundtouch:10:office1:nowPlayingAlbum" }
String  Bose_office1_nowPlayingArtist                   { channel="bosesoundtouch:10:office1:nowPlayingArtist" }
String  Bose_office1_nowPlayingDescription              { channel="bosesoundtouch:10:office1:nowPlayingDescription" }
String  Bose_office1_nowPlayingGenre                    { channel="bosesoundtouch:10:office1:nowPlayingGenre" }
String  Bose_office1_nowPlayingItemName                 { channel="bosesoundtouch:10:office1:nowPlayingItemName" }
String  Bose_office1_nowPlayingStationLocation          { channel="bosesoundtouch:10:office1:nowPlayingStationLocation" }
String  Bose_office1_nowPlayingStationName              { channel="bosesoundtouch:10:office1:nowPlayingStationName" }
String  Bose_office1_nowPlayingTrack                    { channel="bosesoundtouch:10:office1:nowPlayingTrack" }
Number  Bose_office1_preset                             { channel="bosesoundtouch:10:office1:preset" }
Image   Bose_office1_nowPlayingArtwork                  { channel="bosesoundtouch:10:office1:nowPlayingArtwork" }

Does anybody else has this problem? Any idea how fix this?

My OH version is not really up to date (4.2.1 on Raspbian 8.0 jessie) but it runs good and upgrading causes a lot of trouble for me every time. Maybe there is a way to upgrade to binding (currently 2.4.0) independently?

Any help is appreciated. Thanks and regards!

You can try a snapshot binding from this link:

https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.bosesoundtouch/

After uninstalling the current binding via PaperUI place the jar file in /usr/share/openhab2/addons then restart OH. Note, when you select a snapshot do not use the sources jar file, only the snapshot.jar file (the bottom one).

BTW, OH 2.4 is over a year old and you may want to upgrade to 2.5. I understand if you, like many others, have issues when upgrading but I’m sure we can help to resolve them. Depending on what bindings you’re using, staying on OH 2.4 more issues may pop up over time. On the other hand, if it’s not broke don’t fix it, :wink: so give one of the snapshots a try and see what happens.

Also, make sure you have a backup in the event things go wrong and a fresh install is needed. FYI, using sudo openhab-cli backup --full and moving the zipped file to your PC or USB stick is the easiest way for a quick backup.

First of all, sorry for my late reply. Thank you for your very detailed answer, H102.

I tried to use a snapshot binding but unfortunately I’m failing on the dependencies. I used the 2.5.4 as the last 2.x version and put the .jar in the addons dir. After starting OH the logs showed me the following error:

  ==> /var/log/openhab2/openhab.log <==
2020-04-10 17:58:46.256 [ERROR] [org.openhab.binding.bosesoundtouch  ] - FrameworkEvent ERROR - org.openhab.binding.bosesoundtouch
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.bosesoundtouch [218]
  Unresolved requirement: Import-Package: com.google.gson.annotations; version="[2.8.0,3.0.0)"

        at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634) ~[?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1614) ~[?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585) ~[?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528) ~[?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[?:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]
		
2020-04-10 17:58:50.818 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.bosesoundtouch-2.5.4-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.bosesoundtouch [218]
  Unresolved requirement: Import-Package: com.google.gson.annotations; version="[2.8.0,3.0.0)"

        at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

So I downloaded the gson-2.8.0.jar (com.google.code.gson) from maven.org and put it next to the bose jar in the addons dir, hoping this would be it. Unfortunately this doesn’t fix the missing dependency.

Can you tell me how to include the missing dependencies?

To the point of upgrading in general: The pain isn’t big enough yet. :wink: I am very happy with its stability and funcionality at the moment. But you are right. When there will be more problems or even showstopper, I will do.

Have you tried using the console to install/import the needed package?

I recently switched to a new raspberry and did a fresh install to openhab 2.5.11-1 (ubuntu repo). The binding seems to handle special characters better, except apostrophe:

Song name: “I Don’t Wanna” becomes “t Wanna”.

17:19:53.191 [INFO ] [smarthome.event.ItemStateChangedEvent] - Bose_bathroom1_nowPlayingTrack changed from NULL to I Don
17:19:53.197 [INFO ] [smarthome.event.ItemStateChangedEvent] - Bose_bathroom1_nowPlayingTrack changed from I Don to '
17:19:53.200 [INFO ] [smarthome.event.ItemStateChangedEvent] - Bose_bathroom1_nowPlayingTrack changed from ' to t Wanna