Conversation
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
I think everything is working better now except the background discovery which seems to be not running. I will take a look later. Manual discovery is working well. Problem with language is fixed too. |
I just discovered that the list of options for the language setting is wrong in the XML file ! We should find here the WU language codes, all the ones defined in the table LANG_ISO_TO_WU_CODES, or at least a subset. This is not the case ! |
So, would it make sense to mark the PR title with a leading "WIP" to ensure it is not merged by accident? |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
With my last commit, the background discovery is now started. |
@lolodomo Thanks for this. If you publish a jar, I'd be happy to test it. |
It does look better, thanks! However, shouldn't the communication to the WU service be solely handled by the bridge, as mentioned by @htreu in #5501 ? This was our motive for moving the |
We are talking about simple HTTP calls, I don't understand the logic to run them only in the bridge handler. By the way, the only call done by the bridge handler is a control of the API key, the "real" calls are run by the thing handler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lolodomo for taking care of this. Please find some remarks inline.
WeatherUndergroundDiscoveryService service = (WeatherUndergroundDiscoveryService) bundleContext | ||
.getService(serviceReg.getReference()); | ||
service.deactivate(); | ||
serviceReg.unregister(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although the reference implementation in the hue binding does it the same way I guess this should be turned around: We should unregister the service first, so DS will remove service usages. After this we can safely deactivate the service.
|
||
WeatherUndergroundConfiguration config = getConfigAs(WeatherUndergroundConfiguration.class); | ||
private void initializeThingHandler(@Nullable ThingHandler thingHandler, @Nullable ThingStatus bridgeStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thingHandler
should be renamed to bridgeHandler
@@ -412,113 +175,4 @@ public void handleCommand(ChannelUID channelUID, Command command) { | |||
public void setApikey(String apikey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know its not the scope of this PR and cosmetic: this method is only called from within this class, please remove or change to private
.
this.locationProvider = locationProvider; | ||
} | ||
|
||
@Override | ||
public void activate(@Nullable Map<@NonNull String, @Nullable Object> configProperties) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind adding a small comment on why this method has to be overridden? I had to to modify the code myself to see the necessity of this change ;-)
} | ||
|
||
@Override | ||
public void deactivate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, please drop a short note.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@htreu ! I considered all your review comments. I fixed the example in the documentation too. |
Ready for merge. |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
@mhilbush : while it takes time to merge this PR and because some users like you are blocked, here is a jar file you can use. |
Independently of this PR, I discovered during my tests that the WU language codes are not very reliable. As an example, for italian, the WU code should be IY but I got weather conditions in italian when I use IT, not when I use IY.
We are now relying on the second page but my feeling now is that it was a mistake because this page is titled "Country to ISO Matching" and provides this description: |
As a consequence, I removed my very last commit as the list of languages in the XML file was the right language codes. |
Automatic discovery updated to consider change of the system language Signed-off-by: Laurent Garnier <lg.hc@free.fr>
I finally fixed the language table and made a little change to the automatic discovery to consider change of the system language. @mhilbush : I updated the jar file you can download. |
There is only one little thing that would need an enhancement. Currently, the binding is not able to select automatically british english or french canadian from the system locale. English and French will be rather selected. But of course, the user can select these languages using the thing setting. |
Thanks for the changes and thanks for the jar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lolodomo, waiting for travis to succeed.
* WU: bridge/thing refactoring * WU: start/stop of the background discovery service fixed * Example fixed in the documentation * WU: language conversion table fixed Automatic discovery updated to consider change of the system language Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier lg.hc@free.fr