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] Add Veto and some default times to state options. #11816

Merged
merged 4 commits into from
Jan 8, 2022

Conversation

Skinah
Copy link
Contributor

@Skinah Skinah commented Dec 19, 2021

PR does two things.

  1. Gives default times to the duration channels so a new OH3 user does not need to setup metadata for the state options to get a working list widget.
  2. Adds Veto to the autoUpdates on a single channel as it was causing issues with a user here on the forum. closes [opensprinkler] Sequencing station commands can lead to unexpected behaviour unless autoupdate='false' #11815

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

@Skinah Skinah added the enhancement An enhancement or new feature for an existing add-on label Dec 19, 2021
@Skinah Skinah changed the title [opensprinkler] Add some default times to state options. [opensprinkler] Add Veto and some default times to state options. Dec 19, 2021
Comment on lines 184 to 188
<state readOnly="false" pattern="%.0f min">
<options>
<option value="15s">15 Seconds</option>
<option value="1min">1 Minute</option>
<option value="5min">5 Minutes</option>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do your options cover all possible values or only few of them ?
Is the pattern still necessary ? For other values ?
I have a doubt about the values in your options with different units. What unit is used when building the channel state in the binding.
Is it something you tested ?
Same comments for the other channel (rainDelay).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Covers values that most users should be happy with. Metadata can be added to change these default values if they do not suit and I have tested doing this. The issue IMHO is when no defaults are provided the control/widgets default to ANALIZE and showing a graph instead of offering a list of suitable commands to send. For a new openHAB user these changes are far better and also saves time for experienced users if the defaults are suitable.
  2. RE pattern: I have removed it for the nextDuration as the pattern was not necessary. For the rainDelay channel the API uses hours so I would prefer this gets displayed by default so if people see the TRACE logs they are less likely to get confused. Users can over ride the pattern with metadata. Originally when the binding was merged the ANALIZE feature did not take UOM into account when stored in persistence and this worked around that, not sure if this is fixed now in newer openHAB cores as I have seen it mentioned a few times.
  3. The rainDelay has a state that the API will count down in hours. The code does handle all the different units and this is something I have tested for 10+ months now as I have been using Metadata to add the options in different units.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have never played with Number:Time but if you set 24 hours as value, your final value as a string will be 1d and not 24h ?

And for the other channel, are you sure you will get 1min rather than 60s for example?

Copy link
Contributor Author

@Skinah Skinah Dec 23, 2021

Choose a reason for hiding this comment

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

All I know is that I have tested it, and it works as I don't know how the UOM works in depth internally. When the command is sent, the device is queried and the response back from the device updates the channels state in HOURS as per the pattern. The channel that has had the pattern removed can at times display the result in seconds if for example a time of 4 days is selected it can change to be shown in seconds. Most of the time it displays the selected option as the nextDuration, as the device does not have a state for this. It is only a virtual control used when you turn a watering zone 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 not clear with that. Can another maintainer please comment & review? @fwolter @cweitkamp @wborn @kaikreuzer

Copy link
Member

Choose a reason for hiding this comment

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

I've never tested if a StringType sent to a Channel, defined in state options and the Channel linked to an UoM Item converts correctly when the string is suffixed with the unit. There's a QuantityType constructor that accepts strings in the format defined in above state options. I think it can work and I trust in @Skinah if he says he tested it, that it works.

Copy link
Contributor

@lolodomo lolodomo Dec 28, 2021

Choose a reason for hiding this comment

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

In this case, if you think this is ok, please merge this PR @fwolter

@lolodomo
Copy link
Contributor

lolodomo commented Dec 19, 2021

And please also run the maven command to update the default i18n properties file.

mvn i18n:generate-default-translations

@Skinah
Copy link
Contributor Author

Skinah commented Dec 20, 2021

I tried to run mvn i18n:generate-default-translations guessing the build system is not yet ready for building 3.3.0-SNAPSHOT?

I got these lines...

[WARNING] The POM for org.openhab.core.tools:i18n-maven-plugin:jar:3.3.0-SNAPSHOT is missing, no dependency information available

.....

[ERROR] No plugin found for prefix 'i18n' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\nospa\.m2\repository), central (https://repo1.maven.org/maven2), openhab-release (https://openhab.jfrog.io/openhab/libs-release)] -> [Help 1]

.......

@lolodomo
Copy link
Contributor

Build failed. Please apply spotless: mvn spotless:apply

@lolodomo
Copy link
Contributor

A soon as you fixed the spotless problem, I will run the i18n tool for you and create a PR to your repo.

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

Skinah commented Dec 21, 2021

Spotless was fine on my system, so I did another rebase and force push and now it shows as sorted.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo
Copy link
Contributor

@Skinah : I pushed a PR to your repo with the result of the run of the i18n translation tool.

Update default translations properties

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

Skinah commented Dec 23, 2021

thanks, changes have been merged.

@lolodomo
Copy link
Contributor

lolodomo commented Jan 7, 2022

@fwolter : please take the lead to review this PR

@fwolter fwolter merged commit 06576fa into openhab:main Jan 8, 2022
@fwolter fwolter added this to the 3.3 milestone Jan 8, 2022
mischmidt83 pushed a commit to mischmidt83/openhab-addons that referenced this pull request Jan 9, 2022
…enhab#11816)

* Add default times to state options.


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

* remove pattern


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

* Update default translations properties

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

Co-authored-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
moesterheld pushed a commit to moesterheld/openhab-addons that referenced this pull request Jan 18, 2022
…enhab#11816)

* Add default times to state options.


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

* remove pattern


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

* Update default translations properties

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

Co-authored-by: Laurent Garnier <lg.hc@free.fr>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Jan 28, 2022
…enhab#11816)

* Add default times to state options.


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

* remove pattern


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

* Update default translations properties

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

Co-authored-by: Laurent Garnier <lg.hc@free.fr>
NickWaterton pushed a commit to NickWaterton/openhab-addons that referenced this pull request Apr 27, 2022
…enhab#11816)

* Add default times to state options.


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

* remove pattern


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

* Update default translations properties

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

Co-authored-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Nick Waterton <n.waterton@outlook.com>
@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-binding-how-to-set-nextduration-basic-ui-senscommand-jython/101423/24

@Skinah Skinah deleted the opensprinkler branch October 24, 2022 09:10
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
…enhab#11816)

* Add default times to state options.


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

* remove pattern


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

* Update default translations properties

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

Co-authored-by: Laurent Garnier <lg.hc@free.fr>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Nov 12, 2022
…enhab#11816)

* Add default times to state options.


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

* remove pattern


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

* Update default translations properties

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

Co-authored-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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] Sequencing station commands can lead to unexpected behaviour unless autoupdate='false'
4 participants