Snippets

OICP 2.1 Pull EVSE Status by ID | Java

Created by Gregor Schermuly last modified Julius Poessnecker
1
2
3
4
5
6
7
The service description can be found in the OICP 2.1 (EMP).

Section:
3.5.2 eRoamingPullEVSEStatusById

To download the latest OICP Version, please visit our website:
https://www.hubject.com/downloads/
/**
 * Create a new OICP v2.0 PullEVSEStatusById request.
 *
 * @param ProviderId the unique identification of the EV service provider for this request.
 * @param EVSEIds an array of EVSE Ids to query their status.
 * @return a new PullEVSEStatusById request builder object.
 */
public PullEVSEStatusByIdRequest PullEVSEStatusById(final EVSP_Id     ProviderId,
                                                    final EVSE_Id...  EVSEIds)
{ ... }

/**
 * Create a new OICP v2.0 PullEVSEStatusById request.
 *
 * @param ProviderId the unique identification of the EV service provider for this request.
 * @param EVSEIds a stream of EVSE Ids to query their status.
 * @return a new PullEVSEStatusById request builder object.
 */
public PullEVSEStatusByIdRequest PullEVSEStatusById(final EVSP_Id          ProviderId,
                                                    final Stream<EVSE_Id>  EVSEIds)
{ ... }
CompletableFuture req = new EMPClient("api.playground.hubject.com").

    PullEVSEStatusById(EVSP_Id.Parse("DE*GDF"),
                       Stream.of(EVSE_Id.Parse("DE*GEF*E123456789*1"),
                                 EVSE_Id.Parse("+49*822*083431571*1"))).

    Run(EVSEStatus -> {

        if (EVSEStatus.getStatusCode().hasResult())
            System.out.println(
                    EVSEStatus.getEVSEStatusRecords().
                               map(evsedatarecords -> "EVSE '" + evsedatarecords.getId() +
                                                      "' has status '" +
                                                      evsedatarecords.getStatus().toString() +
                                                      "'" ).

                               reduce((a, b) -> a + System.lineSeparator() + b).
                               get());

        else {
            System.out.println(EVSEStatus.getStatusCode().getCode());
            System.out.println(EVSEStatus.getStatusCode().getDescription());
            System.out.println(EVSEStatus.getStatusCode().getAdditionalInfo());
        }

    });

// Wait for the future to complete...
req.get();

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.