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

[dwdpollenflug] Initial Contribution #7298

Merged
merged 21 commits into from
Apr 12, 2020
Merged

[dwdpollenflug] Initial Contribution #7298

merged 21 commits into from
Apr 12, 2020

Conversation

DerOetzi
Copy link
Contributor

@DerOetzi DerOetzi commented Apr 5, 2020

The "Deutsche Wetterdienst" (DWD) reports the current pollen count index for Germany on a daily base and a forecast for tomorrow and the day after tomorrow. This new binding allows you to retrieve this data for your region or partregion.

I added the information to this thread:
https://community.openhab.org/t/new-binding-dwdpollenflug/95596

Unfortunately I don't understand what I'm doing wrong at my git workflow. Can someone who knows about it have a look at my workflow description at #7289

@wborn
Copy link
Member

wborn commented Apr 5, 2020

Unfortunately I don't understand what I'm doing wrong at my git workflow. Can someone who knows about it have a look at my workflow description at #7289

I think you merged or resolved conflicts using the GitHub UI... or maybe merged changes locally? If you merge commits they will show up in your PR making it hard to review.

Instead you should rebase your branch to update it or resolve conflicts.

Here's a pretty accurate intro on how to do that using the command line:

https://dev.to/maxwell_dev/the-git-rebase-introduction-i-wish-id-had

It's also possible to do the same steps using the UI in Eclipse or any other IDE that supports Git.

@wborn
Copy link
Member

wborn commented Apr 5, 2020

I see you also wrote your steps in the issue. I think the missing part is the "force push" part. If you don't force it, it will not overwrite your existing branch... instead it will probably automatically make a merge commit for you. 😐

So it should have been:

git checkout dwdpollenflug
git rebase 2.5.x
git push --force-with-lease

You'll only need to force it after rebasing your branch on 2.5.x. After that you can use the normal push... until you rebase it again. Using the force option you can rewrite the history, whereas if you only add new commits these are linear, so in that case history doesn't need to be rewritten. :-)

You also don't have to switch to 2.5.x before you can rebase it.

This also works when you are on your dwdpollenflug branch:

git fetch upstream
git rebase upstream/2.5.x
git push --force-with-lease

You wouldn't even need a checkout of the 2.5.x branch in that case and you'll always be sure it doesn't contain any commits of your own that ended up on your local 2.5.x branch.

@DerOetzi
Copy link
Contributor Author

DerOetzi commented Apr 5, 2020

@wborn thanks that was the problem. I'm always using shortcuts in my config and somehow the --force was lost in my shortcut file

@cpmeister cpmeister added the new binding If someone has started to work on a binding. For a new binding PR. label Apr 5, 2020
@DerOetzi
Copy link
Contributor Author

DerOetzi commented Apr 7, 2020

Just noticed that there are no reviewers entered on this PR. Have I to do something on my side to get my PR reviewed an merged?

@wborn
Copy link
Member

wborn commented Apr 7, 2020

I think you've found an issue because we need to update the fallback in the CODEOWNERS file since the team got renamed after the repo got renamed:

# This file helps GitHub doing automatic review requests for new PRs.
# It should always list the active maintainers of certain add-ons.
# As a fallback, if no specific maintainer is listed below, assign the PR to the repo maintainers team:
* @openhab/2-x-add-ons-maintainers

@wborn wborn requested a review from a team April 7, 2020 09:12
@DerOetzi
Copy link
Contributor Author

DerOetzi commented Apr 7, 2020

I think you've found an issue because we need to update the fallback in the CODEOWNERS file since the team got renamed after the repo got renamed:

# This file helps GitHub doing automatic review requests for new PRs.
# It should always list the active maintainers of certain add-ons.
# As a fallback, if no specific maintainer is listed below, assign the PR to the repo maintainers team:
* @openhab/2-x-add-ons-maintainers

@wborn thanks

@DerOetzi
Copy link
Contributor Author

DerOetzi commented Apr 8, 2020

As weather is getting better this days in Germany and with it the pollen pollution, is there a way how to promote this PR do get a quicker review?

@J-N-K J-N-K self-assigned this Apr 9, 2020
Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. I have left some comments inside.

bundles/org.openhab.binding.dwdpollenflug/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.dwdpollenflug/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.dwdpollenflug/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.dwdpollenflug/README.md Outdated Show resolved Hide resolved
Comment on lines 51 to 53
<properties>
<property name="region_id"/>
<property name="region_name"/>
<property name="partregion_name"/>
</properties>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you should add these properties, they just reflect the configuration.

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 removed region_id! The region_name and partregion_name I want to leave there for control reasons for those who use text-configuration, whether the correct region is loaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you agree leaving region_name and partregion_name as properties?

@DerOetzi DerOetzi requested a review from J-N-K April 10, 2020 19:52
</channel-type>

<channel-type id="updated">
<kind>trigger</kind>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed if users can just trigger on changes to the "Update Time" channel?

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 thought about use case like: don't need to link a item to the refresh channel because I don't want to display anywhere but just want to trigger a rule on refresh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed trigger channel!


<channel-type id="update">
<item-type>DateTime</item-type>
<label>Update time</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

The first letter of every word in a label should be capitalized.

Suggested change
<label>Update time</label>
<label>Update Time</label>

Please update elsewhere as appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this an OpenHAB convention? Should I although do it like "Refresh In Minutes" or like "Refresh in Minutes". And should it be the same in translation file?

Copy link
Member

Choose a reason for hiding this comment

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

Using upper-case letters as first letters in labels is an openHAB convention, yes. This also applies to translations. Please do not use something like "In Minutes". If the unit is set in the description, the UI should properly display the unit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed all labels to upper case and removed in Minutes

Comment on lines 105 to 106
public void handleCommand(ChannelUID channelUID, Command command) {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You at least handle a RefreshType command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just for my understanding of this, when ist RefreshType command triggered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check my fix

Comment on lines +107 to +105
final ScheduledFuture<?> localPollingJob = this.pollingJob;
if (localPollingJob == null || localPollingJob.isCancelled()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
final ScheduledFuture<?> localPollingJob = this.pollingJob;
if (localPollingJob == null || localPollingJob.isCancelled()) {
final ScheduledFuture<?> localPollingJob = this.pollingJob;
final DWDPollenflug pollenflug = this.pollenflug;
if (localPollingJob == null || localPollingJob.isCancelled()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please check my fix.


public void poll() {
logger.debug("Polling");
requestRefresh().handle((pollenflug, e) -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of 'e', please give the variable a name that at least gives a hint as to what the datatype is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check my fix.

@DerOetzi
Copy link
Contributor Author

@J-N-K and @cpmeister I have refactored the complete DTO package. I would ask you to review it again. Thanks

@DerOetzi
Copy link
Contributor Author

And I just noticed a problem with translation.

    <channel-group-type id="updates">
   	<label>Updates</label>
   	<description>Information about data state</description>
   	<channels>
   		<channel id="refreshed" typeId="update">
   			<label>Bridge refreshed</label>
   		</channel>
   		<channel id="last_update" typeId="update">
   			<label>Last update from DWD</label>
   		</channel>
   		<channel id="next_update" typeId="update">
   			<label>Next update from DWD</label>
   		</channel>
   	</channels>
   </channel-group-type>

The labels of the channels are not translated. I thought it should work like this:

channel-group-type.dwdpollenflug.updates.refreshed.label = Letzte Aktualisierung Bridge
channel-group-type.dwdpollenflug.updates.last_update.label = Letzte Aktualisierung durch den DWD
channel-group-type.dwdpollenflug.updates.next_update.label = N\u00E4chste Aktualisierung durch den DWD

@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 11, 2020
@DerOetzi DerOetzi requested a review from cpmeister April 11, 2020 17:48
Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

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

Thanks for your fast response. Already looks much better. I'm glad we already got @cpmeister as a second reviewer. That'll speed up the whole process.

Johannes DerOetzi Ott added 12 commits April 12, 2020 19:17
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
@TravisBuddy
Copy link

Travis tests were successful

Hey @DerOetzi,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

1 similar comment
@TravisBuddy
Copy link

Travis tests were successful

Hey @DerOetzi,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Copy link
Contributor

@cpmeister cpmeister left a comment

Choose a reason for hiding this comment

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

LGTM

@cpmeister cpmeister merged commit 715322a into openhab:2.5.x Apr 12, 2020
@cpmeister cpmeister added this to the 2.5.4 milestone Apr 12, 2020
@DerOetzi
Copy link
Contributor Author

@cpmeister Thank you as well for the help

@DerOetzi DerOetzi deleted the dwdpollenflug branch April 16, 2020 21:23
yfre pushed a commit to yfre/openhab-addons that referenced this pull request Apr 27, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Eugen Freiter <freiter@gmx.de>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request May 29, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
LoungeFlyZ pushed a commit to LoungeFlyZ/openhab2-addons that referenced this pull request Jun 8, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
J-N-K pushed a commit to J-N-K/openhab-addons that referenced this pull request Jul 14, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: CSchlipp <christian@schlipp.de>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Signed-off-by: Daan Meijer <daan@studioseptember.nl>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
* [DWDPollenflug] New Binding retry

Signed-off-by: Johannes DerOetzi Ott <info@johannes-ott.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants