Snippets

OICP 2.1 Pull EVSE Status by ID | C#

Updated by Julius Poessnecker

File (0) OICP Added

  • Ignore whitespace
  • Hide word diff
+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/
Created by Gregor Schermuly

File (1) Pull EVSE Status by ID | C#.cs Added

  • Ignore whitespace
  • Hide word diff
+/// <summary>
+/// Create a new task requesting the current status of up to 100 EVSEs by their EVSE Ids.
+/// </summary>
+/// <param name="ProviderId">The unique identification of the EVSP.</param>
+/// <param name="EVSEIds">Up to 100 EVSE Ids.</param>
+/// <param name="QueryTimeout">An optional timeout for this query.</param>
+public async Task<HTTPResponse<IEnumerable<KeyValuePair<EVSE_Id, OICPEVSEStatus>>>>
+
+    PullEVSEStatusById(EVSP_Id               ProviderId,
+                       IEnumerable<EVSE_Id>  EVSEIds,
+                       TimeSpan?             QueryTimeout = null)
+
+{
+
+    [...]
+
+}

File (2) Example.cs Added

  • Ignore whitespace
  • Hide word diff
+var req = new EMPClient("api.playground.hubject.com").
+
+              PullEVSEStatusById(EVSP_Id.Parse("DE*GDF"),
+                                EVSEIds:       Enumeration.Create(EVSE_Id.Parse("DE*GEF*E123456789*1"),
+                                                                  EVSE_Id.Parse("+49*822*083431571*1")),
+                                QueryTimeout:  TimeSpan.FromSeconds(120)).
+
+              ContinueWith(task => {
+
+                  var eRoamingEVSEStatusById = task.Result.Content;
+
+                  if (eRoamingEVSEStatusById.StatusCode.HasResult)
+                      Console.WriteLine(eRoamingEVSEStatusById.
+                                            EVSEStatusRecords.
+                                            Select(evsestatusrecord => "EVSE '" + evsestatusrecord.Id +
+                                                                       "' has status " +
+                                                                       evsestatusrecord.Status.ToString() +
+                                                                       "'").
+                                            AggregateWith(Environment.NewLine) +
+                                            Environment.NewLine));
+
+                  else
+                  {
+                      Console.WriteLine(eRoamingEVSEStatusById.StatusCode.Code);
+                      Console.WriteLine(eRoamingEVSEStatusById.StatusCode.Description);
+                      Console.WriteLine(eRoamingEVSEStatusById.StatusCode.AdditionalInfo);
+                  }
+
+              });
+
+
+req.Wait();
HTTPS SSH

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