Can't get sonoff binding to work on OH4.1

Hi, I can’t get the binding to show up after following the steps in 3 threads I read.

I put the latest sonoff binding jar in the addons folder, and checked bindings. This showed sonoff as “installed” but not active. So I ran the binding start command for the installed sonoff one. The result then showed:

openhab> start 363
Error executing command: Error executing command on bundles:
Error starting bundle 363: Could not resolve module: org.openhab.binding.sonoff [363]
Unresolved requirement: Import-Package:; version=“[2.10.0,3.0.0)”

I checked and I have an older version of gson. I can’t find any instructions anywhere here or on google how to simply install this. Can anyone help?

what version GSON are you showing currently?
Also what exact version of Openhab are you running?
openhab 4.0.4 stable installed version is 36 │ Active │ 80 │ 2.9.1 │ Gson
4.1.0.M2,M3,M5 and snapshot build #3782 and all above higher version are running 36 │ Active │ 80 │ 2.10.1.v20230109-0753 │ Gson
and for clarity
openhab 3.4.4 runs 35 │ Active │ 80 │ 2.8.9 │ Gson
as a reference here is the github for all version

Also I am asuming it is the binding referenced in this link?

seems it had a few challenges perhaps you do not have the latest jar?

Here is what shows in the bindings now, so I guess 2.9.1

36 │ Active │ 80 │ 2.9.1 │ Gson
37 │ Active │ 80 │ 30.1.0.jre │ Guava: Google Core Libraries for Java
38 │ Active │ 80 │ 1.0.1 │ Guava InternalFutureFailureAccess and InternalFutures
39 │ Active │ 80 │ 5.0.1.v20210324-2015 │ Google Guice - Core Library

I have downloaded the newer Gson binding, but I don’t know where to save it, or what to do to upgrade it from a command line perspective.


Ok so then you are not on a 4.1.0 version of Openhab?
The version you show is embedded in 4.0.4 stable…

Other folks may have a different solution but as far as I am aware the safest and only supported way to upgrade core components such as GSON is to upgrade your Openhab version to a later revision.
Or modify the binding POM to include an external dependency version and then include it with the binding.

I assumed I was on 4.1 openhab because I did the upgrade through the GUI, and when trying to update again it says I’m on the latest version.

from your web interface can you click on help and about and see what version it shows there?
like this.

Most likely GUI? (openhabian?) is saying you are on the latest and that is correct.
I must admit I am not familiar with an option in the GUI that offers way to upgrade so I will have to assume you are referring to Openhabian which I do not use.
If you are on 4.0.4 that is in fact the latest stable version.
All of the 4.1 versions are milestone or snapshot versions so you would have to change option or configuration files to select one of those versions.
Once again without more information on your version and platform along all the other basic info it is hard to guide you further.

Thanks for being patient with me. Yes I checked the UI and it shows 4.0.4.

Do you know which link would best show me how to upgrade this? I’d prefer if there is some simple UI, but I’m not apposed to doing command line stuff if there is a simple step by step.


Sure, Start with the below link.

select which ever platform you have Openhab installed on.
As you read through the documentation for your specific platform there are very detailed set of instructions for doing an update/upgrade based on your installation type.
Understanding in order to get to version 4.1 versions you have to go to a snapshot or milestone version that means you are moving to a work in progress Openhab version that has not been fully completed and declared 100 % stable yet.
If all you are really wanting is to get that 1 binding to work, you might just choose to respond on the earlier thread I linked and ask the binding developer if they got a version that works on 4.0.4 stable available.

Thanks this worked for the upgrade. Also the reason I did all this was to get the sonoff binding working again in OH4, and it’s now working great.

A tip for others, I had to go into each of the already created sonoff “things”, click bridge and select the new sonoff account thing and then save. Now everything works including discovery.