OpenSprinkler V2.2 Firmware Incompatibility with current OpenHAB Binding

@matt1 I just wanted to bring to your attention a minor incompatibility between the current OpenSprinkler (3.4x, 4.0x) binding and latest OSv2.2 firmware. I recently updated my OS firmware to v2.2 from 2.19 and noticed that the Programs channel no longer properly displays the available Programs to run. From what I can tell there was a change in the JSON structure that OS uses for the Programs and it no longer is being parsed correctly. There may be others, but this is the only issue I have noticed.

v2.2
Example Return:
{“nprogs”:3, “nboards”:1, “mnp”:40, “mnst”:4, “pnsize”:32,“pd”:[[3,127,0,[480,2,240,0],[0,2700,0,2700,0,0,0,0],“Summer”,[0,33,415]], [2,9,0,[120,0,300,0],[0,3720,0,0,0,0,0,0],“Fall Prog”,[0,33,415]],[195,16,0,[1150,-1,-1,-1],[0,0,0,0,0,0,64800,0],“Pipe”,[1,67,415]]]}

v2.19
Example Return​:
{“nprogs”:3, “nboards”:1, “mnp”:40, “mnst”:4, “pnsize”:32,“pd”:[[3,127,0,[480,2,240,0],[0,2700,0,2700,0,0,0,0],“Summer”], [2,9,0,[120,0,300,0],[0,3720,0,0,0,0,0,0],“Fall Prog”],[67,16,0,[1150,-1,-1,-1],[0,0,0,0,0,0,64800,0],“Pipe”]]}

Thank you for letting me know, I am still on 2.1.9 (9) here… I am pretty busy for the next 2-3 weeks, but can look into this and it should be pretty simple to resolve, UNLESS this is caused by poor formatting of the JSON data. If it is the JSON is invalid then it should be reported to the opensprinkler ppl to fix on their end.

You posted the example returns (great that is helpful) just it is not inside code fences so it is failing when I try to check it with these online format checkers:

  1. Determine if it is a bug in the firmware or a valid change that needs us to update.
  2. Post the info in a github issue if I dont remember and take care of it in a few weeks.

It is also getting reported on the home assistant forum that they can not connect the hardware after the firmware update, so does everything else work fine?

The binding is setup really well to deal with this as the binding already asks what the firmware version is and can adapt to changes in the firmware so that the old and the new firmware both can work and you are not forced to use X version.

I’ve been running v2.2 for about 6 weeks now and everything seems to work well with the existing binding except for the Programs display. What is displayed is 415.0] for each/all programs. Thanks for your help and support. I will open an issue git just for completeness.

I have updated my firmware to V2.2.0 (2) and have not had the time to try and reproduce any issues yet, however the changes are outlined in this documentation here and there appears to be no breaking changes, only newly added features which are in GREEN colour. Can you confirm if you are using the (1) or the (2) version?

OSAPI2.2.0(1) (raysfiles.com)

Return from 2.2.0(2)

{
	"nprogs": 3,
	"nboards": 1,
	"mnp": 40,
	"mnst": 4,
	"pnsize": 32,
	"pd": [
		[3, 68, 0, [20540, 0, 120, 0],
			[0, 2700, 2700, 0, 0, 0, 0, 0], Water Lawn, [0, 33, 415]
		],
		[3, 1, 0, [16384, 0, 0, 0],
			[0, 0, 0, 2700, 0, 0, 0, 0], Water Citrus, [0, 33, 415]
		],
		[3, 18, 0, [16384, 0, 0, 0],
			[2700, 0, 0, 0, 0, 0, 0, 0], Water Fruit Trees, [0, 33, 415]
		]
	]
}

V2.1.9

{
	"nprogs": 3,
	"nboards": 1,
	"mnp": 40,
	"mnst": 4,
	"pnsize": 32,
	"pd": [
		[3, 127, 0, [480, 2, 240, 0],
			[0, 2700, 0, 2700, 0, 0, 0, 0], "Summer"
		],
		[2, 9, 0, [120, 0, 300, 0],
			[0, 3720, 0, 0, 0, 0, 0, 0], "Fall Prog"
		],
		[67, 16, 0, [1150, -1, -1, -1],
			[0, 0, 0, 0, 0, 0, 64800, 0], "Pipe"
		]
	]
}

@matt1 I am using 2.2.0(1). The change to the JSON may not be listed as a breaking change, and in fact the standalone OS app works just fine with new JSON structure. It’s only OH that seems to struggle. The JSON structure I provided above for 2.2.0 and 2.1.9 are taken directly from the API docs for each firmware version.

Updated jar that includes a fix is found at the PR below, planning on adding some new feature from the newer firmware as time permits.

@matt1 I tried the updated OS binding this morning and it seems to have fixed the issue with the binding improperly displaying the program names. I’ll report back if any problems arise due to the changes made, but it looks good. Thanks for your help and support of this binding.

No Problem, since you gave a good clear overview of the problem, I wonder if you would mind giving feedback and if you’re interested in testing these new features that the upgraded firmware can bring? To be clear these are not in the updated beta you are using, they are what I am coding at the moment so if you feel they should be better implemented in another way now would be a good time to raise it before I fully code the features.

| cloudConnected  | Switch                 | ReadOnly | If the device is fully connected to the OpenSprinkler cloud this will show as 'ON'.|

| pausePrograms   | Number:Time            | RW | Sets/Shows the amount of time that programs will be paused for.  Sending a time of 0s will un-pause.                  |

| queuedZones     | Number:Dimensionless   | ReadOnly | A count of how many zones are running and also waiting to run in the queue.        |

@matt1. Sure I’d be willing to help evaluate/beta test the new features you are implementing to the OS binding. However, just a couple of caveats. I don’t use the cloud for open sprinkler or much else as far as my OH installation, preferring to use a VPN, so I have little to compare against. But I do make use of queuedZones on my OH Dashboard and the paused Programs will be a nice addition. Just let me know when you are ready.

Alpha build for you to trial is in the PR, just re-download it and delete and re-add the thing to see the extra channels. I have not tested it yet and wont get time to run some tests for a day or two.

@matt1, I installed your latest OS binding update and unfortunately it does not run at all. I am getting Error Handler messages on startup.

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.opensprinkler [335]
2023-08-22 17:31:07.168 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.binding.opensprinkler-4.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.opensprinkler [335]
2023-08-22 17:31:07.168 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.binding.opensprinkler-4.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.opensprinkler [335]

When I log in to the karaf I see the binding is installed but not active.

335 │ Installed │  80 │ 4.1.0.202308221728     │ openHAB Add-ons :: Bundles :: OpenSprinkler Binding

My environment is OH 4.0.2 Docker on a linux server.

What I did to install was to stop the docker, remove the older OS binding from the addons folder, delete the cache and tmp files, start the docker, then restart the docker twice more to insure everything was parsed and properly installed.

The UI is showing

Status: UNINITIALIZED
HANDLER_MISSING_ERROR
Handler factory not found

This is for all OS Things.

As expected reverting back to the previous version of the binding fixes the issue.

Found a dependency issue and fixed it, re-download from the PR after it compiles in 20 mins from now. I have tested all the new features your after and they work here.

Matt, I’m still having the same issue with your latest update. It installs but doesn’t go Active. Could it be because I am running OH4.0.2 and you are compiling against OH 4.1?? I believe your update that fixed Program Names was compiled against 4.1, and it worked fine for me though. Could there have been other changes since then? Just grasping.

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.opensprinkler [335]
2023-08-23 16:52:19.123 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.binding.opensprinkler-4.1.0-SNAPSHOT-3.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.opensprinkler [335]
2023-08-23 16:52:19.125 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.binding.opensprinkler-4.1.0-SNAPSHOT-3.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.opensprinkler [335]
335 │ Installed │  80 │ 4.1.0.202308231900     │ openHAB Add-ons :: Bundles :: OpenSprinkler Binding

In karaf console type in bundle:start 335

The 335 is the line number from doing bundle:list

It may give you some lines of errors that give more clues if it does not work to start it this way.

As you suggested I attempted to start the binding from inside the karaf and got the following error

Error executing command: Error executing command on bundles:
        Error starting bundle 337: Could not resolve module: org.openhab.binding.opensprinkler [337]
  Unresolved requirement: Import-Package: javax.measure; version="[2.2.0,3.0.0)"

Just to be clear, I am downloading the linked bundle from your Git page as I have in the past. That is still correct I assume.

To be clear, its not MY github page. It should be from the openHAB official github page and when I share the code back to the project, it is built automatically and SHOULD (appears not to be) be placed on the jfrog server (openHAB owned server) here:

https://openhab.jfrog.io/ui/native/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.opensprinkler/4.1.0-SNAPSHOT/

I say SHOULD because I just downloaded the file from the link above and it does not behave the same way that the file I compiled on my machine does. This may be caused because there are two PR currently for this binding.

https://github.com/openhab/openhab-addons/pulls?q=is%3Apr+is%3Aopen+opensprinkler

If there was only one, then it would be just fine.

The easiest way to solve this would be to trust that I am not a nasty person trying to give you a virus and download it from my own server here already compiled. I raise this as an issue because you never know when someones account is hacked and being used without their knowledge, so up to you if you trust the zipped jar at this link.
http://pcmus.com/openhab/opensprinkler/

This is why I have tried to use the jfrog server first, and why it is such a pain when it does not work.

You can also compile it yourself as I have shared the code already in a PR, you can also just wait for it to be reviewed and merged, but this could take months especially since the other PR is 60 lines of changes and has been waiting 3 months already and this one is much larger at 232 lines of changes.

If you do use the newer jar, then please be aware that you need to delete and re-add the things to be able to see the newer channels. If you take note of the Unique ID and create them with the same ones, then all the items and links should resolve back to normal and it will be a 60 second change to the newer jar.

@matt1 Thanks for the clarification regarding the Git page and also for confirming that the file linked on that page is not the file you and I thought it was. Glad it wasn’t just me having issues. At any rate I downloaded the file that you linked to on your server and It is working fine so far. I will continue to test for the next few weeks and if any issues arise I will report them to you. Thanks again for help and support.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.