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

[zoneminder] Fix calls to set state options #11463

Merged
merged 2 commits into from
Oct 31, 2021

Conversation

mhilbush
Copy link
Contributor

There are situations when the binding updates the state options even if the options haven't changed. This results in an unnecessary reload of the page in Basic UI. With this change, the state options are updated only if they change.

Signed-off-by: Mark Hilbush mark@hilbush.com

Signed-off-by: Mark Hilbush <mark@hilbush.com>
@mhilbush mhilbush added the bug An unexpected problem or unintended behavior of an add-on label Oct 27, 2021
@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/new-zoneminder-binding-for-zoneminder-versions-1-34-0/95112/362

@kaikreuzer kaikreuzer added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Oct 28, 2021
@lolodomo
Copy link
Contributor

My immediate thinking is that'll it should rather be done / checked by the core framework.
@cweitkamp : WDYT?

@cweitkamp
Copy link
Contributor

@cweitkamp
Copy link
Contributor

Do you think the ordering of the list elements might be the culprit?

@mhilbush
Copy link
Contributor Author

Do you think the ordering of the list elements might be the culprit?

No. 😉

Look at my original code. I had the call to setStateOptions in the wrong part of the code. It was inside the for loop. 🙄

@mhilbush
Copy link
Contributor Author

I'll update the PR to move those calls to after the for loop. That should resolve the issue. Agree?

@cweitkamp
Copy link
Contributor

Agree?

I do.

Signed-off-by: Mark Hilbush <mark@hilbush.com>
@mhilbush
Copy link
Contributor Author

Ok, I believe this is the correct fix. Thanks for helping me find my error.

Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@lolodomo Fine for you?

@cweitkamp cweitkamp added this to the 3.2 milestone Oct 31, 2021
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

@lolodomo lolodomo merged commit edd3e01 into openhab:main Oct 31, 2021
@lolodomo
Copy link
Contributor

I realized the PR title is wrong. Can you fix it?

@mhilbush mhilbush changed the title [zoneminder] Only update state options if they've changed [zoneminder] Fix calls to set state options Oct 31, 2021
@mhilbush
Copy link
Contributor Author

Good catch. fixed.

@mhilbush mhilbush deleted the zm-state-options branch October 31, 2021 12:52
dschoepel pushed a commit to dschoepel/openhab-addons that referenced this pull request Nov 9, 2021
)

* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>

* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.com>
Signed-off-by: Dave J Schoepel <dave@theschoepels.com>
jpg0 pushed a commit to jpg0/openhab-addons that referenced this pull request Nov 10, 2021
)

* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>

* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.com>
NickWaterton pushed a commit to NickWaterton/openhab-addons that referenced this pull request Dec 30, 2021
)

* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>

* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.com>
Signed-off-by: Nick Waterton <n.waterton@outlook.com>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Jan 28, 2022
)

* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>

* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.com>
volkmarnissen pushed a commit to volkmarnissen/openhab-addons that referenced this pull request Mar 3, 2022
)

* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>

* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.com>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
)

* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>

* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.com>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
)

* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>

* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants