Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opensprinkler] Fix Program names and add new features for firmware 2.2.0 #15410

Merged
merged 14 commits into from
Dec 10, 2023

Conversation

Skinah
Copy link
Contributor

@Skinah Skinah commented Aug 12, 2023

This change fixes the bindings ability to scrape the program names of the sprinkler controllers internal automated programs that a user can select to run. More information is found that the issue this fixes here closes #15260

The newer firmware uses JSON with this structure and the "pd" now has an extra element over previous firmware which causes the update to break the old code. The JSON is an Array that contains mixed types including further arrays. Details are included in case a better method exists.

{
	"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]
		]
	]
}

This pull request will automatically be built and available under the following links if anyone wants to test:
https://openhab.jfrog.io/ui/native/libs-pullrequest-local/org/openhab/addons/bundles/

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

Signed-off-by: Matthew Skinner matt@pcmus.com

@Skinah Skinah added the bug An unexpected problem or unintended behavior of an add-on label Aug 12, 2023
@Skinah Skinah changed the title Fix Program names are not parsed correctly for firmware 2.2.0 [opensprinkler] Fix Program names are not parsed correctly for firmware 2.2.0 Aug 12, 2023
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/opensprinkler-v2-2-firmware-incompatibility-with-current-openhab-binding/147841/6

@Skinah Skinah added the enhancement An enhancement or new feature for an existing add-on label Aug 22, 2023
@Skinah Skinah changed the title [opensprinkler] Fix Program names are not parsed correctly for firmware 2.2.0 [opensprinkler] Fix Program names and add new features for firmware 2.2.0 Aug 22, 2023
@@ -61,22 +61,25 @@ NOTE: Some channels will only show up if the hardware has the required sensor an

| Channel Type ID | Item Type | | Description |
|-----------------|------------------------|----|------------------------------------------------------------------------------------|
| rainsensor | Switch | RO | This channel indicates whether rain is detected by the device or not. |
| sensor2 | Switch | RO | This channel is for the second sensor (if your hardware supports it). |
| cloudConnected | Switch | RO | If the device is fully connected to the OpenSprinkler cloud this will show as 'ON'.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am asking myself if a channel is really the good option.
The connection status should probably be something defining the thing status ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlaur : WDYT ?

Copy link
Contributor

@jlaur jlaur Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I need some more context. The binding is declared as local, so if I understand this correctly, this is just some information from the device whether it is also integrated with a cloud service in addition to being integrated through the local API?

In that case, what would be the use of this channel? Perhaps it would be sufficient to provide this as a property? And also, in that case it probably shouldn't impact the thing status, since it wouldn't interfere with the openHAB integration in any way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe a property is wrong as it has a state that changes. Read only channel seemed to fit. Your thoughts are correct and I also do not see the use case, but was easy to add it when doing other channels instead of someone requesting it later. It could possibly be used to fault find why you can not use their cloud to connect and control the sprinkler. The binding is full local and it is perhaps strange that the device can do both without trying to force you to do one over the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to delete the channel then to spend any more time on changing or adding extra lines to add it to things that are missing the channel. I don't have a lot of spare time these days.

@lolodomo lolodomo added the awaiting feedback Awaiting feedback from the pull request author label Nov 3, 2023
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
@lolodomo lolodomo removed the awaiting feedback Awaiting feedback from the pull request author label Nov 26, 2023
@lolodomo
Copy link
Contributor

lolodomo commented Dec 7, 2023

@Skinah : any chance you take a look to my last comments ? I would like to merge your PR for OH 4.1.

Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
@Skinah
Copy link
Contributor Author

Skinah commented Dec 10, 2023

@lolodomo I believe all changes are now addressed. Can you take a look over the update instructions to ensure I did them correctly please?

Signed-off-by: Matthew Skinner <matt@pcmus.com>
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

@lolodomo lolodomo merged commit a950f19 into openhab:main Dec 10, 2023
3 checks passed
@lolodomo lolodomo added this to the 4.1 milestone Dec 10, 2023
@Skinah Skinah deleted the os branch December 10, 2023 10:17
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/too-many-stations-listed/152241/2

austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
….2.0 (openhab#15410)

* Fix Program names are not parsed correctly in firmware 2.2.0

---------

Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
….2.0 (openhab#15410)

* Fix Program names are not parsed correctly in firmware 2.2.0

---------

Signed-off-by: Matthew Skinner <matt@pcmus.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[OpenSprinkler]- Program Channel not displaying properly OS Firmware v2.2
4 participants