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

[nanoleaf] Refactored code to use core features and more #10101

Merged
merged 6 commits into from
Mar 17, 2021

Conversation

kaikreuzer
Copy link
Member

This is a bigger refactoring bringing these (partially breaking) changes:

  • System channel types are used where applicable
  • Obsolete channels (such as power) were removed
  • Some channel types were marked "advanced"
  • "Tap" channels were converted to a trigger channel type providing a "system button" behavior
  • Layout can now be requested by a console command
  • Command options for effect channel are dynamically provided
  • Log level has been reduced where appropriate
  • HTTP request timeouts were reduced
  • handleRemoval now returns quickly as expected
  • Fixed hanging thread / infinite loop when requesting layouts for non-square panels
  • Various other smaller enhancements and fixes
  • Documentation has been adapted accordingly

Signed-off-by: Kai Kreuzer kai@openhab.org

@kaikreuzer kaikreuzer added the enhancement An enhancement or new feature for an existing add-on label Feb 7, 2021
@kaikreuzer kaikreuzer requested review from raepple and a team February 7, 2021 22:16
@kaikreuzer
Copy link
Member Author

@stefan-hoehn Would be great if you could also review & test with your setup.
As I had missed to provide review comments to the previous PR on time, I have covered all desired changes in this PR - it works quite well and has some new features like the dynamic effect options that are now automatically populated:

Screenshot 2021-02-07 at 23 20 01

This is a bigger refactoring bringing these (breaking) changes:
- System channel types are used where applicable
- Obsolete channels (such as power) were removed
- Some channel types were marked "advanced"
- "Tap" channels were converted to a trigger channel type providing a "system button" behavior
- Layout can now be requested by a console command
- Command options for effect channel are dynamically provided
- Log level has been reduced where appropriate
- HTTP request timeouts were reduced
- handleRemoval now returns quickly as expected
- Fixed hanging thread / infinite loop when requesting layouts for non-square panels
- Various other smaller enhancements and fixes
- Documentation has been adapted accordingly

Signed-off-by: Kai Kreuzer <kai@openhab.org>
@stefan-hoehn
Copy link
Contributor

stefan-hoehn commented Feb 8, 2021

First of all, Kai, thanks a lot for working on the binding. I really appreciate that.
I am amazed how much and what you have changed - definitely a huge step forward for the nanoleaf binding!

I am eager to review but I probably need to take some time to understand what you have done (though I am sure that there hardly will be any comment from my side as you are much more experienced that I am). How quickly do you need my review?

And second question: How would I actually try out the pull request? What is the right way to do that? Just do a "git clone" from your repo fork onto my machine and test it?

And third question: Are all chances backward compatible? In some cases I was hesitant to change something because I was afraid people would need to recreate things (or items) as at least in one case I know that a user has around 200 of them?

@kaikreuzer
Copy link
Member Author

How quickly do you need my review?

It is enough if you roughly scan through it - I just wanted to make sure to keep you in the loop of code changes as you are actively working on it as well. If you only want to test it to ensure that nothing is broken with your devices, that'll be just fine as well.

How would I actually try out the pull request?

If you want to test it from source code in your IDE you can do

git checkout -b kaikreuzer-nanoleaf main
git pull /~https://github.com/kaikreuzer/openhab-addons.git nanoleaf

Otherwise just use this jar for testing: org.openhab.binding.nanoleaf-3.1.0-SNAPSHOT.zip (rename it to .jar)

Are all chances backward compatible?

As mentioned in the description ("partially breaking"), unfortunately no.
For a textual configuration, it should be fairly easy to adapt, for auto-discovered ones it'll indeed be a bit nasty...

@kaikreuzer
Copy link
Member Author

for auto-discovered ones it'll indeed be a bit nasty

I just checked - the ThingUID actually stays the same upon re-discovery, so I revert my comment that it might be nasty. Only the use of the changed channels might be required to be adapted, but overall the setup should still work.

@openhab/add-ons-maintainers I'd hence say it should be good to merge and I'll add a PR for distro wrt mentioning the breaking change.

@stefan-hoehn
Copy link
Contributor

First of all, Kai, I am really sorry for delay. I currently have a lot of business and private obligations and as I take the development binding seriously I just wanted to do the review thoroughly. The reason I am a bit hesitant is the breaking change of the channels as you mentioned which I wanted to test first. I always tried not to break anything for the user, so two things about that:

  1. Do you mind telling me why you changed the behaviour because I felt using a single touch and double touch pretty convenient to use?
  2. We should at least add a migration section into the Readme file and an updated channel description to the Readme file.

I have reviewed all the non-breaking changes and I am sure given your expertise this is more than welcome for the binding. I unfortunately haven't had the chance to actually try out the binding. I intend to do so during the next week.

thanks for taking the your time on the nanoleaf binding changes,
Stefan

@kaikreuzer
Copy link
Member Author

No worries, @stefan-hoehn, we are all very busy with other things in life besides openHAB ;-)

Wrt your questions:
Yes, in general I agree with not doing breaking changes. But in case where bindings violate the (unfortunately in bigger parts undocumented) rules of Thing modelling, I prefer to rectify them instead of keeping them as an example that will then be copied by others and which will thus proliferate.

  1. The touch gestures are input events, they are not a stateful feature of the panels. Therefore, they must be of "trigger kind" and not of "state kind". You can consider them to be pretty much the same as a push button. The neat thing about trigger channels is that you can link them to an item, which you want to control and where you have a state channel linked as well (e.g. a light that you want to turn on/off by the touch gesture) - and you do not need any rule for it.
  2. No, readmes should always reflect the latest documentation. Migration information must be put into the release notes. I will do so, once this PR is merged.

Hope this clarifies your questions a bit!

Signed-off-by: Kai Kreuzer <kai@openhab.org>
@stefan-hoehn
Copy link
Contributor

Sorry for the long delay but as discussed offline I experienced a lot of issues during test not caused but some revealed by this PR, so I wanted to make sure that I know what is happening. For the curious here is a link to the related thread:

https://community.openhab.org/t/solved-httpclient-keeps-failing-get-request-after-onqueued-with-timeout/118320

Copy link
Contributor

@stefan-hoehn stefan-hoehn left a comment

Choose a reason for hiding this comment

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

Thanks Kai for taking the time to improve the binding. Everything looks fine from my perspective.

@kaikreuzer kaikreuzer removed the request for review from raepple March 13, 2021 15:52
@kaikreuzer
Copy link
Member Author

@openhab/add-ons-maintainers Would be nice to get a review then, so that this can be finally merged!

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

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

I think it looks good! I have a few minor comments:

Co-authored-by: Wouter Born <github@maindrain.net>
@kaikreuzer kaikreuzer requested a review from raepple as a code owner March 16, 2021 20:36
kaikreuzer and others added 3 commits March 16, 2021 21:37
Co-authored-by: Wouter Born <github@maindrain.net>
Co-authored-by: Wouter Born <github@maindrain.net>
Signed-off-by: Kai Kreuzer <kai@openhab.org>
@kaikreuzer kaikreuzer requested a review from wborn March 16, 2021 20:48
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

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

Thank you!

@wborn wborn merged commit 009208a into openhab:main Mar 17, 2021
@wborn wborn added this to the 3.1 milestone Mar 17, 2021
Copy link
Contributor

@stefan-hoehn stefan-hoehn left a comment

Choose a reason for hiding this comment

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

Fine from my side

@kaikreuzer kaikreuzer deleted the nanoleaf branch April 1, 2021 10:07
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
This is a bigger refactoring bringing these (breaking) changes:
- System channel types are used where applicable
- Obsolete channels (such as power) were removed
- Some channel types were marked "advanced"
- "Tap" channels were converted to a trigger channel type providing a "system button" behavior
- Layout can now be requested by a console command
- Command options for effect channel are dynamically provided
- Log level has been reduced where appropriate
- HTTP request timeouts were reduced
- handleRemoval now returns quickly as expected
- Fixed hanging thread / infinite loop when requesting layouts for non-square panels
- Various other smaller enhancements and fixes
- Documentation has been adapted accordingly

Signed-off-by: Kai Kreuzer <kai@openhab.org>
Signed-off-by: John Marshall <john.marshall.au@gmail.com>
computergeek1507 pushed a commit to computergeek1507/openhab-addons that referenced this pull request Jul 13, 2021
This is a bigger refactoring bringing these (breaking) changes:
- System channel types are used where applicable
- Obsolete channels (such as power) were removed
- Some channel types were marked "advanced"
- "Tap" channels were converted to a trigger channel type providing a "system button" behavior
- Layout can now be requested by a console command
- Command options for effect channel are dynamically provided
- Log level has been reduced where appropriate
- HTTP request timeouts were reduced
- handleRemoval now returns quickly as expected
- Fixed hanging thread / infinite loop when requesting layouts for non-square panels
- Various other smaller enhancements and fixes
- Documentation has been adapted accordingly

Signed-off-by: Kai Kreuzer <kai@openhab.org>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
This is a bigger refactoring bringing these (breaking) changes:
- System channel types are used where applicable
- Obsolete channels (such as power) were removed
- Some channel types were marked "advanced"
- "Tap" channels were converted to a trigger channel type providing a "system button" behavior
- Layout can now be requested by a console command
- Command options for effect channel are dynamically provided
- Log level has been reduced where appropriate
- HTTP request timeouts were reduced
- handleRemoval now returns quickly as expected
- Fixed hanging thread / infinite loop when requesting layouts for non-square panels
- Various other smaller enhancements and fixes
- Documentation has been adapted accordingly

Signed-off-by: Kai Kreuzer <kai@openhab.org>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
This is a bigger refactoring bringing these (breaking) changes:
- System channel types are used where applicable
- Obsolete channels (such as power) were removed
- Some channel types were marked "advanced"
- "Tap" channels were converted to a trigger channel type providing a "system button" behavior
- Layout can now be requested by a console command
- Command options for effect channel are dynamically provided
- Log level has been reduced where appropriate
- HTTP request timeouts were reduced
- handleRemoval now returns quickly as expected
- Fixed hanging thread / infinite loop when requesting layouts for non-square panels
- Various other smaller enhancements and fixes
- Documentation has been adapted accordingly

Signed-off-by: Kai Kreuzer <kai@openhab.org>
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.

3 participants