> For the complete documentation index, see [llms.txt](https://docs.net2grid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.net2grid.com/net2grid-energy-ai-edge-on-ami2/applications/ev/input-and-output.md).

# Output Messages

The application produces four types of output messages: start events, stop events, cancel events and heartbeats.

### Start event message

This message is generated when an EV charging session is detected and has the following format:

```json
{
    "eventType": "start",
    "start": 1744791347,
    "level": 11000,
    "confidence": "medium"
}
```

where

* eventType \[str]: The type of the event. In this case, the start value is used to indicate the start of charging.
* start \[int]: Start time of the charging event (UNIX timestamp in seconds).
* level \[int]: The EV charging power level in Watts (W).
* confidence \[str]: A confidence score, based on the detected power and the configured reporting interval. Higher power levels and longer intervals typically lead to higher confidence values. Expected values are “low”, “medium”, and “high”.

### Stop event message

Such messages are sent when the charging session ends and have the following format:

```json
{
    "eventType": "stop",
    "start": 1744791347,
    "stop": 1744800815,
    "level": 11000,
    "energy": 28930
}
```

where

* eventType \[str]: The type of the event. In this case, the stop value is used to indicate the event of stop charging.
* start \[int]: Start time of the charging event (UNIX timestamp in seconds). It should match the timestamp in the respective start event.
* stop \[int]: Stop time of the charging event (UNIX timestamp in seconds).
* level \[int]: The EV charging power level in Watts (W).
* energy \[int]: The amount of energy that was consumed in Wh.

### Cancel event message

If a previously reported charging event is determined to be a false positive, the application issues a cancel message instead of a stop event, with the following structure:

```json
{
  "eventType": "cancel",
  "start": 1744791347,
  "cancel": 1744791595
}
```

where

* eventType \[str]: The type of the event. In this case, the cancel value is used to indicate the cancellation of the previous start event.
* start \[int]: Start time of the charging event (UNIX timestamp in seconds).
* cancel \[int]: Time of charging event cancellation (UNIX timestamp in seconds)

### Heartbeat message

The heartbeat message is sent daily to confirm the application is running and functioning correctly. This message may include metadata such as version, current configuration, and operational status. The message format is the following:

```json
{
    "version": "4.0.0",
    "inferences": 480,
    "evt_count": 0,
    "ev_detected": false,
    "ev_detected_ts": 0,
    "train_evt_count": 6,
    "run_days": 12,
    "restart_count": 1,
    "rpt_intv": 15,
    "mean_dur": 0.6361,
    "energy_ratio": 0.0905,
    "train_score": 0.6,
    "high_score_streak": 0
}
```

where

* version \[str]: The current application version.
* inferences \[int]: The number of model inferences during the period covered by the heartbeat message (one inference per three minutes is expected, resulting in 480 in total for a daily message).
* evt\_count \[int]: The number of charging events since the last heartbeat, in case a model has been successfully trained (0 if still in training period).
* ev\_detected \[bool]: A boolean flag indicating if an EV has been detected in any previous training period.
* ev\_detected\_ts \[int]: The UNIX timestamp when EV existence is confirmed (i.e., a training period is successful). If an EV has not been detected, it will be 0.
* train\_evt\_count \[int]: The number of events detected during the last 7 days of the training period.
* run\_days \[int]: The number of days that the application has been running in total.
* restart\_count \[int]: The number of restarts of the application.
* rpt\_intv \[int]: The reporting interval in minutes.
* mean\_dur \[float]: The mean duration of EV charging events during the last 7 days of the training period.
* energy\_ratio \[float]: The ratio of EV events over the total consumption during the last 7 days of the training period.
* train\_score \[float]: The training score of EV existence based on the last 7days.
* high\_score\_streak \[int]: The number of consecutive days with a high train\_score.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.net2grid.com/net2grid-energy-ai-edge-on-ami2/applications/ev/input-and-output.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
