-
-
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
[SNCF] A binding to get French railways arrivals and departures #11607
Conversation
Conflicts: features/pom.xml Signed-off-by: Kai Kreuzer <kai@openhab.org> (github: @kaikreuzer) Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
I will review your PR. |
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.
Review part 1 of 3
bundles/org.openhab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/dto/Route.java
Outdated
Show resolved
Hide resolved
...s/org.openhab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/dto/StopArea.java
Show resolved
Hide resolved
...g.openhab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/dto/StopDateTime.java
Show resolved
Hide resolved
.../org.openhab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/dto/StopPoint.java
Show resolved
Hide resolved
...b.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/dto/VJDisplayInformation.java
Show resolved
Hide resolved
Added i18n data to get prepared for crowdin Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
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.
Review part 2 of 3
....binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/SncfBridgeHandler.java
Outdated
Show resolved
Hide resolved
....binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/SncfBridgeHandler.java
Outdated
Show resolved
Hide resolved
....binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/SncfBridgeHandler.java
Outdated
Show resolved
Hide resolved
....binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/SncfBridgeHandler.java
Outdated
Show resolved
Hide resolved
....binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/SncfBridgeHandler.java
Outdated
Show resolved
Hide resolved
....binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/SncfBridgeHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/config/config.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/i18n/sncf.properties
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/thing/station.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/i18n/sncf.properties
Show resolved
Hide resolved
Remains for me the class |
Signed-off-by: clinique <gael@lhopital.org>
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.
Review part 3 of 3
...ing.sncf/src/main/java/org/openhab/binding/sncf/internal/discovery/SncfDiscoveryService.java
Outdated
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Outdated
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Outdated
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Outdated
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Outdated
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/thing/station.xml
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/thing/station.xml
Show resolved
Hide resolved
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
@clinique : I am going to test the binding.
|
Fine for me @lolodomo |
Reading the FAQ, I see that for Transilien, thtis is unfortunately not real-time:
So probably something to mention in the documentation. Edit: maybe you could consider data.sncf.com too ? |
Doing my first tests, I see that the values for the channels code and name are identical. The values for channels commercial mode and network are identical too. Did you notice the same ? Do you thing it is really necessary to have all these channels ? Or maybe having some of them being advanced ? In your discovery service, please call the superclass with false as a last parameter as there is no background discovery. Regarding the discovery, 2 things with the same label are found, one is a bus station (property ending by ":Bus") and the other a train station (property ending by ":RapidTransit"). Maybe you could include the type of station in the label ? The refresh of data is not working at all for me. |
After adding few logs:
So the problem is your retrieval of the existing delay which is 0. |
...ing.sncf/src/main/java/org/openhab/binding/sncf/internal/discovery/SncfDiscoveryService.java
Outdated
Show resolved
Hide resolved
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/thing/station.xml
Outdated
Show resolved
Hide resolved
...ing.sncf/src/main/java/org/openhab/binding/sncf/internal/discovery/SncfDiscoveryService.java
Outdated
Show resolved
Hide resolved
Done for the last two points
On my test environment, I have Transilien scheduling working fine but I will add a mention in the README.MD.
I agree, |
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
scheduler.submit(() -> updatePassage(bridgeHandler, GROUP_ARRIVAL)); | ||
scheduler.submit(() -> updatePassage(bridgeHandler, GROUP_DEPARTURE)); |
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.
What annoys me with these calls called in parallel in separate threads is that you have to consider concurrent calls to scheduleRefresh
and freeRefreshJob
. I am not sure this is something you took into consideration, did you ?
Is it really necessary to do that ? Two calls in sequence could be ok, no ?
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.
Well, I had to do this because I faced a concurrent exception at jetty level with the previous code organization. It is the only I found to solve the problem. You're right, I can test it in a single scheduler submit call.
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.
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 still do not understand why you create a new thread while updateThing
is already executed by a scheduled thread ?
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.
If/when I don't do it in a thread, I get this error on second call :
17:32:17.180 [DEBUG] [f.internal.handler.SncfBridgeHandler] - Execution interrupted : null
java.lang.InterruptedException: null
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1343) ~[?:?]
...hab.binding.sncf/src/main/java/org/openhab/binding/sncf/internal/handler/StationHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.sncf/src/main/resources/OH-INF/thing/station.xml
Outdated
Show resolved
Hide resolved
I just saw a case while next arrival was at 19:45 and at 19:45 it changed to 19:46 (same train). So it would mean this is real-time. |
@lolodomo : I think I've addressed your last comments / remarks. I'm going to push a new update. |
Signed-off-by: clinique <gael@lhopital.org>
@clinique, I am running your last version. |
I found the solution, the direction has to be retrieved in display_information.
|
Thanks for your bug hunting. Pushing the update. |
Signed-off-by: clinique <gael@lhopital.org>
@clinique : still one comment not fully resolved (about creating additional threads). My tests are positive. New general comments:
|
I forgot one point: now that |
Just answered it a few minutes ago and retested (see above in the conversation thread).
I'm going to reduce to 10 seconds and see if it does the job.
I quite do not get the point of rounding a timestamp provided sharp. If used in automation, the sharper the better. Ok to come back on this on return of users experience.
Yes, I searched but did not find it neither.
I have a plan to take care of announced service disruptions (not time to dive on this currently), that could generate difference between planned and real-time data. |
Signed-off-by: clinique <gael@lhopital.org>
I don't want to round the raw data, only the default display value in UI to show only hours+minutes. |
Don't you think it'll be weird for users to see a given time in logs and a different one in the interface ? |
Signed-off-by: clinique <gael@lhopital.org>
Yes, maybe. |
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.
LGTM now
@clinique: let me know if your test is positive and I will then merge. I am going to run my own test in parallel. |
Yes, you can merge. Thanks for your attentive and patient review ! |
Yes, it seems to work well for me too. |
…hab#11607) * SNCF : new binding Signed-off-by: clinique <gael@lhopital.org> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
@clinique: if not yet done, you could add your binding's logo to the openHAB website. See https://www.openhab.org/docs/developer/bindings/#add-your-binding-s-logo-to-the-openhab-website |
…hab#11607) * SNCF : new binding Signed-off-by: clinique <gael@lhopital.org> Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
…hab#11607) * SNCF : new binding Signed-off-by: clinique <gael@lhopital.org>
…hab#11607) * SNCF : new binding Signed-off-by: clinique <gael@lhopital.org>
…hab#11607) * SNCF : new binding Signed-off-by: clinique <gael@lhopital.org>
…hab#11607) * SNCF : new binding Signed-off-by: clinique <gael@lhopital.org>
…hab#11607) * SNCF : new binding Signed-off-by: clinique <gael@lhopital.org> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
No description provided.