-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[meteofrance] New binding #15462
base: main
Are you sure you want to change the base?
[meteofrance] New binding #15462
Conversation
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/meteo-alerte-binding-do-not-receive-data-since-may-2023/148545/5 |
bb043b9
to
cdea557
Compare
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.
@clinique I am not sure if I am a good reviewer for this binding.... For now, I just checked a few code style topics, javadoc has only expected warnings, i18n property file is in sync. That is what I can do today.
Find my suggestions below.
...hab.binding.meteoalerte/src/main/java/org/openhab/binding/meteoalerte/internal/dto/Term.java
Outdated
Show resolved
Hide resolved
...binding.meteoalerte/src/main/java/org/openhab/binding/meteoalerte/internal/dto/BlocType.java
Outdated
Show resolved
Hide resolved
...lerte/src/main/java/org/openhab/binding/meteoalerte/internal/handler/MeteoAlerteHandler.java
Outdated
Show resolved
Hide resolved
...teoalerte/src/main/java/org/openhab/binding/meteoalerte/internal/db/DepartmentDbService.java
Outdated
Show resolved
Hide resolved
@lolodomo : if you can start to have a look at this. I think it's pretty ready codewise. Documentation still has to be updated. |
@lolodomo : can I kindly request a review ? |
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.
just 2 minor comments regarding the README...
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.
Sorry, this one seems missing.
Otherwise the parts I have looked at LGTM, leaving the code review to @lolodomo.
| apikey | Data-platform token to access the service. Mandatory. | | ||
|
||
To obtain an API key, you must create an account on https://portail-api.meteofrance.fr/web/fr/ | ||
Inside the Portail API, create an application on "Bulletin Vigilance" and generate they API Key (set duration to 0). |
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.
Inside the Portail API, create an application on "Bulletin Vigilance" and generate they API Key (set duration to 0). | |
Inside the Portail API, create an application on "Bulletin Vigilance" and generate they API key (set duration to 0). |
@lolodomo : as you're currently working only for me 😀 , maybe you can have a look at this one also ? |
a2fb986
to
5007393
Compare
5007393
to
2cc4b74
Compare
Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Small and slow progress Signed-off-by: clinique <[email protected]> Signed-off-by: [email protected] <[email protected]>
Data is ok. Still has to take care of auto refresh and we're ready to go. Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Switching internal dept Id from string name of the department to department number. Signed-off-by: [email protected] <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: Gaël L'hopital <[email protected]>
Signed-off-by: Gaël L'hopital <[email protected]>
Signed-off-by: Gaël L'hopital <[email protected]>
Signed-off-by: Gaël L'hopital <[email protected]>
Signed-off-by: Gaël L'hopital <[email protected]>
Renamed from Meteo Alerte to Meteo France Signed-off-by: Gaël L'hopital <[email protected]>
Signed-off-by: Gaël L'hopital <[email protected]>
dc17bf9
to
68c6fec
Compare
Signed-off-by: Gaël L'hopital <[email protected]>
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 for reviving this binding. As @lolodomo has chosen to work for anotther contributer ;-) i took the change and reviewed this PR.
Covered all files and after this initial round i expect jus a smaller last round before a merge. Ping me when you are ready to proceed.
|
||
The Meteo Alerte binding gives alert level regarding major weather related risk factors. | ||
The Meteo France binding gives alert level regarding major weather related risk factors as well as rain intensity forecasts. | ||
This binding provides its own icon set and provides appropriate static and dynamic SVG icons (see items examples below). | ||
|
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.
A section with the supported Things is missing. When added, it really helps to get a quick overisght of the bindings basics.
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.
Rearranged the section.
| apikey | Data-platform token to access the service. Mandatory. | | ||
|
||
To obtain an API key, you must create an account on https://portail-api.meteofrance.fr/web/fr/ | ||
Inside the Portail API, create an application on "Bulletin Vigilance" and generate they API Key (set duration to 0). |
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.
Inside the Portail API, create an application on "Bulletin Vigilance" and generate they API Key (set duration to 0). | |
Inside the API Portal, create an application on "Bulletin Vigilance" and generate they API Key (set duration to 0). |
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.
Corrected
|
||
## Thing Configuration | ||
|
||
The thing has a few configuration parameters: | ||
The `vigilance` thing has these configuration parameters: |
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 could not get a clear meaning of vigilance
why did you choose this name as thing id?
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.
This is the name coming from the source dataset - let me see if I can find a better naming.
| oh:meteofrance:vent | Yes | ![](src/main/resources/icon/vent.svg) | | ||
| oh:meteofrance:pluie-inondation | Yes | ![](src/main/resources/icon/pluie-inondation.svg) | | ||
| oh:meteofrance:orage | Yes | ![](src/main/resources/icon/orage.svg) | | ||
| oh:meteofrance:inondation | Yes | ![](src/main/resources/icon/inondation.svg) | | ||
| oh:meteofrance:neige | Yes | ![](src/main/resources/icon/neige.svg) | | ||
| oh:meteofrance:canicule | Yes | ![](src/main/resources/icon/canicule.svg) | | ||
| oh:meteofrance:grand-froid | Yes | ![](src/main/resources/icon/grand-froid.svg) | | ||
| oh:meteofrance:avalanches | Yes | ![](src/main/resources/icon/avalanches.svg) | | ||
| oh:meteofrance:vague-submersion | Yes | ![](src/main/resources/icon/vague-submersion.svg) | | ||
| oh:meteofrance:meteo_france | No | ![](src/main/resources/icon/meteo_france.svg) | |
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.
To make the icons viewable in the docs, you have to copy the files to the docs folder and alter these links.
Unoftunately that means these icons are doubled in the repository.
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.
Duplicated images in doc/images
. Added the intensity
icon.
BridgeHandler handler = bridge.getHandler(); | ||
if (handler instanceof MeteoFranceBridgeHandler maHandler) { |
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.
BridgeHandler handler = bridge.getHandler(); | |
if (handler instanceof MeteoFranceBridgeHandler maHandler) { | |
if (bridge.getHandler() instanceof MeteoFranceBridgeHandler maHandler) { |
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.
Changed
|
||
updateStatus(ThingStatus.UNKNOWN); | ||
|
||
ForecastConfiguration config = getConfigAs(ForecastConfiguration.class); |
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.
No need to check the configuration ? For like isBlank()
or for having a numeric value? (i assumed the department code are all numeric ?)
and set the thing state to CONFIGURATION_ERROR
accordingly?
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.
location should be a valid PointType. Modified accordingly.
|
||
private void updateDate(String channelId, @Nullable ZonedDateTime zonedDateTime) { | ||
if (isLinked(channelId)) { | ||
updateState(channelId, zonedDateTime != null ? new DateTimeType(zonedDateTime) : UnDefType.NULL); |
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.
AFAIK the framework does not automatically change the zoneddatetime to the configured timezone of openHAB.
Not sure in what timezone the API responds, but it would be nice to use the openHAB api -> timezoneprovider
to update it to the openHAB configured timezone.
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.
You're more than right.
} | ||
updateStatus(ThingStatus.ONLINE); | ||
} else { | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "No data available for the department"); |
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.
Just a check, what would be the cause of no data being available?
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 guess that I has happened during tests or developments if it is there.
|
||
private void updateDate(String channelId, ZonedDateTime zonedDateTime) { | ||
if (isLinked(channelId)) { | ||
updateState(channelId, new DateTimeType(zonedDateTime)); |
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.
See earlier comment about respecting the openHAB configured timezone with the TimeZoneProvider
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.
Changed.
Signed-off-by: Gaël L'hopital <[email protected]>
Resolves #15461 .
Data feed changed completely, this will have major impact on binding organization.
This binding also integrates another Meteo France service : rain previsions over the coming hour.
Being more generic, it has been renamed and meteoalerte binding should be removed.