Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
generate_config_run_script(CONFIG EVerestAPI-entrypoint)
generate_config_run_script(CONFIG sil)
generate_config_run_script(CONFIG sil-rpcapi)
generate_config_run_script(CONFIG sil-two-evse)
Expand Down
52 changes: 52 additions & 0 deletions config/config-EVerestAPI-entrypoint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
settings:
telemetry_enabled: true
active_modules:
api_entrypoint:
module: EVerest_API
mapping:
module:
evse: 1
connector: 2
access:
config:
allow_global_read: true
allow_global_write: false
allow_set_read_only: false
modules:
auth:
allow_read: true
allow_write: true
allow_set_read_only: true
dm_1:
module: display_message_API
config_module:
cfg_communication_check_to_s: 5
mapping:
module:
evse: 1
connector: 1
implementations:
main:
evse: 1
connector: 1
ps_dc_1:
module: power_supply_DC_API
config_module:
cfg_communication_check_to_s: 0
cfg_heartbeat_interval_ms: 10000
mapping:
module:
evse: 1
connector: 1
ps_dc_2:
module: power_supply_DC_API
config_module:
cfg_communication_check_to_s: 0
cfg_heartbeat_interval_ms: 10000
mapping:
module:
evse: 2
connector: 1

# send "{"headers": { "replyTo": "my/reply/topic" } }" to "everest_api/1/entrypoint/api_entrypoint/m2e/discover"
# and receive an array of (module_id, type, version[optional]) tuples on the reply topic
181 changes: 181 additions & 0 deletions docs/source/reference/EVerest_API/entrypoint_API.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
asyncapi: 3.0.0
id: 'pionix:de:everest:entrypoint_API'
info:
title: 'EVerest API definition for the API entrypoint interface'
version: 1.0.0
description: >-
API for EVerest API clients discovering the EVerest API capabilities.

license:
name: Apache-2.0
url: https://opensource.org/licenses/Apache-2.0
tags:
- name: EVerest
- name: Auth
servers:
default:
pathname: 'everest_api/1/entrypoint_api'
host: 'localhost:1883'
description: default local MQTT
protocol: mqtt
defaultContentType: application/json


channels:
send_request_discover:
address: 'm2e/discover'
messages:
send_request_discover:
$ref: '#/components/messages/send_request_discover'
receive_reply_discover:
address: null
messages:
receive_reply_discover:
$ref: '#/components/messages/receive_reply_discover'


receive_heartbeat:
address: 'e2m/heartbeat'
messages:
receive_heartbeat:
$ref: '#/components/messages/receive_heartbeat'


operations:
send_request_discover:
title: 'Request API capability discovery.'
action: send
channel:
$ref: '#/channels/send_request_discover'
description: >-
Allow API clients to discover the available capabilities of the API.
reply:
address:
location: "$message.header#/replyTo"
channel:
$ref: '#/channels/receive_reply_discover'
receive_reply_discover:
title: 'Reply to discover request'
action: receive
channel:
$ref: '#/channels/receive_reply_discover'


receive_heartbeat:
title: 'Receive heartbeat'
action: receive
channel:
$ref: '#/channels/receive_heartbeat'


components:
messages:
send_request_discover:
name: send_request_discover
title: 'Discover API'
summary: 'The provided token'
contentType: application/json
payload:
type: object
properties:
headers:
type: object
properties:
replyTo: # Address for the request to reply to
type: string
description: Address to send the response to.
examples:
- summary: "requesting available APIs"
payload:
headers:
replyTo: your/arbitrary/reply/topic
receive_reply_discover:
name: receive_reply_discover
title: 'Reply to request to discover the API'
summary: 'Reply to request to discover the API.'
contentType: application/json
payload:
$ref: '#/components/schemas/ApiDiscoverResponse'
examples:
- summary: "Reply is an array of (id, type, <version>) tuples"
payload:
- module_id: "dm_1"
type: "display_message"
version: "1"
- module_id: "ps_dc_1"
type: "power_supply_DC"
- module_id: "ps_dc_2"
type: "power_supply_DC"


receive_heartbeat:
name: receive_heartbeat
title: 'Receive heartbeat'
summary: Heartbeat produced by EVerest as configured via cfg_heartbeat_interval_ms in the EVerest configuration
contentType: application/json
payload:
$ref: '#/components/schemas/HeartBeatId'
examples:
- summary: "Heartbeat"
payload: 42


schemas:
ApiDiscoverResponse:
description: Type for API discovery results
type: object
additionalProperties: true
required:
- apis
properties:
apis:
description: Array of API parameters
type: array
items:
type: object
$ref: '#/components/schemas/ApiParameter'
ApiParameter:
description: Parameters for a single API
type: object
additionalProperties: true
required:
- type
- module_id
properties:
type:
type: object
$ref: '#/components/schemas/ApiTypeEnum'
module_id:
type: string
version:
type: integer
ApiTypeEnum:
description: All known API types
type: string
enum:
- auth_consumer
- auth_token_provider
- auth_token_validator
- dc_external_derate_consumer
- display_message
- error_history_consumer
- evse_board_support
- evse_manager_consumer
- external_energy_limits_consumer
- generic_error_raiser
- isolation_monitor
- ocpp_consumer
- over_voltage_monitor
- powermeter
- power_supply_DC
- session_cost
- session_cost_consumer
- slac
- system

HeartBeatId:
type: integer
description: "64bit unsigned integer. The id of every heartbeat increases by 1 and overflows when the maximum representable value is reached"

# TODO: Missing examples
3 changes: 3 additions & 0 deletions lib/everest/everest_api_types/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ target_sources(everest_api_types
src/everest_api_types/energy/json_codec.cpp
src/everest_api_types/energy/wrapper.cpp

src/everest_api_types/entrypoint/codec.cpp
src/everest_api_types/entrypoint/json_codec.cpp

src/everest_api_types/error_history/codec.cpp
src/everest_api_types/error_history/json_codec.cpp
src/everest_api_types/error_history/wrapper.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest

#pragma once
#include <optional>

Check warning on line 5 in lib/everest/everest_api_types/include/everest_api_types/entrypoint/API.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/everest_api_types/include/everest_api_types/entrypoint/API.hpp#L5

Include file: <optional> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <string>

Check warning on line 6 in lib/everest/everest_api_types/include/everest_api_types/entrypoint/API.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/everest_api_types/include/everest_api_types/entrypoint/API.hpp#L6

Include file: <string> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <vector>

Check warning on line 7 in lib/everest/everest_api_types/include/everest_api_types/entrypoint/API.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/everest_api_types/include/everest_api_types/entrypoint/API.hpp#L7

Include file: <vector> not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace everest::lib::API::V1_0::types::entrypoint {

enum class ApiTypeEnum {
auth_consumer,
auth_token_provider,
auth_token_validator,
dc_external_derate_consumer,
display_message,
error_history_consumer,
evse_board_support,
evse_manager_consumer,
external_energy_limits_consumer,
generic_error_raiser,
isolation_monitor,
ocpp_consumer,
over_voltage_monitor,
powermeter,
power_supply_DC,
session_cost,
session_cost_consumer,
slac,
system
};

struct ApiParameter {
ApiTypeEnum type;
std::string module_id;
std::optional<int32_t> version;
};

struct ApiDiscoverResponse {
std::vector<ApiParameter> apis;
};

} // namespace everest::lib::API::V1_0::types::entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest

#pragma once
#include <everest_api_types/entrypoint/API.hpp>

Check warning on line 5 in lib/everest/everest_api_types/include/everest_api_types/entrypoint/codec.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/everest_api_types/include/everest_api_types/entrypoint/codec.hpp#L5

Include file: <everest_api_types/entrypoint/API.hpp> not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace everest::lib::API::V1_0::types::entrypoint {

std::string serialize(ApiTypeEnum val) noexcept;
std::string serialize(ApiParameter val) noexcept;
std::string serialize(ApiDiscoverResponse val) noexcept;

std::ostream& operator<<(std::ostream& os, ApiTypeEnum const& val);
std::ostream& operator<<(std::ostream& os, ApiParameter const& val);
std::ostream& operator<<(std::ostream& os, ApiDiscoverResponse const& val);

template <class T> T deserialize(std::string const& val);
template <class T> std::optional<T> try_deserialize(std::string const& val) {
try {
return deserialize<T>(val);
} catch (...) {
return std::nullopt;
}
}
template <class T> bool adl_deserialize(std::string const& json_data, T& obj) {
auto opt = try_deserialize<T>(json_data);
if (opt) {
obj = opt.value();
return true;
}
return false;
}

} // namespace everest::lib::API::V1_0::types::entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest

#pragma once

#include "nlohmann/json_fwd.hpp"
#include <everest_api_types/entrypoint/API.hpp>

Check warning on line 7 in lib/everest/everest_api_types/private_include/everest_api_types/entrypoint/json_codec.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/everest_api_types/private_include/everest_api_types/entrypoint/json_codec.hpp#L7

Include file: <everest_api_types/entrypoint/API.hpp> not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace everest::lib::API::V1_0::types::entrypoint {

using json = nlohmann::json;

void to_json(json& j, ApiTypeEnum const& k) noexcept;
void from_json(const json& j, ApiTypeEnum& k);

void to_json(json& j, ApiParameter const& k) noexcept;
void from_json(const json& j, ApiParameter& k);

void to_json(json& j, ApiDiscoverResponse const& k) noexcept;
void from_json(const json& j, ApiDiscoverResponse& k);

} // namespace everest::lib::API::V1_0::types::entrypoint
Loading
Loading