---
title: "SolaX X1/X3-HAC EV Charger (Cloud API)"
description: "Charging power, energy, status and STOP/FAST/ECO/GREEN mode of SolaX HAC EV chargers via the SolaX Developer API. Needs Client ID, Secret and SN."
url: "https://taphome.com/en/compatibility/solax-hac-cloud-api/"
language: en
lastmod: 2026-11-12
generator: hugo
ai:
  topics: ["http","wallbox","cloud-api","oauth2","ev-charging","solar-surplus-charging"]
  questions: ["How to integrate a SolaX X1/X3-HAC EV charger with TapHome?","What does the SolaX HAC Cloud API TapHome template read and control?","How to get the Client ID and Client Secret for the SolaX Developer Portal API?","Which serial number does the SolaX HAC template need: Device SN or Registration No.?","How to connect the SolaX HAC charger to SolaXCloud over Wi-Fi, LAN or 4G?","Why does the SolaX Cloud API return code 10402 or 10406 in TapHome?"]
---

# SolaX X1/X3-HAC EV Charger (Cloud API)

Communication: Packet Parser → HTTP

## Integration guide

The SolaX HAC Cloud API template connects TapHome to a SolaX X1-HAC or X3-HAC EV charger through the SolaX Developer Portal API (OpenAPI). The template author lists the A1-HAC and C1/C3-HAC chargers as well. TapHome does not talk to the charger directly: the charger reports to SolaXCloud over Wi-Fi, LAN or 4G, and TapHome reads its data from the SolaX cloud over HTTPS every 60 seconds. Write commands (work mode, start and stop, lock, current limit) go back to the charger through the cloud the same way.

Two things have to be in place before the template is imported. The charger must be online in a SolaXCloud account, and that account needs an application in the SolaX Developer Portal that provides the **Client ID** and **Client Secret**. If the charger works next to a SolaX inverter, the [SolaX Inverter (Cloud API)](https://taphome.com/en/compatibility/solax-inverter/) template can run in the same TapHome project. It uses the older SolaxCloud monitoring API with its own token.

## Connecting the charger to SolaXCloud

### Network connection

The charger offers three ways to reach the internet. All of them use DHCP, so the router assigns the IP address automatically.

- **Wi-Fi**: 2.4 GHz only (802.11 b/g/n). 5 GHz networks are not supported.
- **Ethernet (LAN)**: the RJ45 port **LAN (/ DI)**. Ethernet uses pins 1, 2, 3 and 6 (TX+, TX−, RX+, RX−). Leave the other pins unconnected when only Ethernet is needed. With a LAN connection the Wi-Fi setup can be skipped.
- **4G**: only for models with "4G" in the name (for example X3-HAC-22P-B4G). An authorized professional must install a nano SIM card that supports Cat-M, NB-IoT or GSM. SolaX recommends at least 100 MB of data per month in the Solar and Standard scenes.

![Pin definition of the EV charger communication ports LAN/DI, COM2-M and COM1-S with RJ45 wire colours](https://taphome.com/images/compatibility/solax-hac-cloud-api/pins-communication-ports_hu_e3a3a34d16605204.jpg)

> [!WARNING]
> The Ethernet cable to the charger must be protected against lightning strikes. If the LAN and the DI signal input are both needed, crimp pins 1, 2, 3 and 6 for Ethernet and pins 4, 5 and 8 for DI, then join the two cables with the RJ45 coupler supplied with the charger.

The 4G connection is configured in the SolaXCloud app in local mode: open **Dongle**, then the settings button, set **Device Networking Mode** to **4G**, enter the operator's APN and choose the network deployment the SIM supports.

### Adding the charger in the SolaXCloud app

1. Install the **SolaXCloud** app from the App Store or Google Play and register an account with an e-mail address or phone number and a verification code.
2. On the first login, create a plant: allow location access, enter a plant name and complete the other settings.
3. Add the charger by scanning or typing the **Registration No.** from its type label. Chargers added later go through the **Device** page, the **+** icon, then **Add Device** or **Scan**.
4. Enter the Wi-Fi name and password if the charger connects over Wi-Fi.

![SolaXCloud app: adding the EV charger by Registration No. from the type label](https://taphome.com/images/compatibility/solax-hac-cloud-api/add-device-registration-no_hu_4b06cff948b79022.jpg)

The type label shows two different numbers. The **Registration No.** is used to add the charger in the app and to log in locally. The **SN** (device serial number) is what the TapHome template needs as `DeviceSN`. The app shows the device SN on the charger's **Basic information** page (tap the top part of the charger's Details page). It is also listed in the Developer Portal under **Device > Device List**.

### Reconnecting Wi-Fi and local access

If the charger goes offline, open the **Device** page in the app, tap the charger card marked offline and choose **Reconfigure**. Then enter the 2.4 GHz network and password again.

![SolaXCloud app: reconfiguring the Wi-Fi of the EV charger and local mode login by Registration No.](https://taphome.com/images/compatibility/solax-hac-cloud-api/wifi-reconfigure_hu_a2a623a4deacb2f4.jpg)

If reconfiguration fails, there is a second way. Connect a phone or laptop to the charger's own Wi-Fi network, which is named after its Registration No. (`Wifi_XC…`). Then open `http://192.168.10.10/` in a browser and log in as `admin`, with the Registration No. as the password. Local mode in the app (**More > Local Access**, or **Service > Application > Local Access** when logged in) uses the same network.

> [!NOTE]
> The charger switches its local Wi-Fi network off automatically one hour after it connects to the network successfully. To use local access later, turn the network back on in the app under **Network > Local Access**.

### Application scene and charging modes

The charger works in one of three application scenes, chosen in the app under **Advanced setting > Application scene**:

- **Solar** (default): the Green, Eco and Fast charging modes are available. Green and Eco need the charger to communicate with the inverter, or with a CT or meter on the grid connection, so that it knows the PV surplus.
- **Standard**: the charger only starts and stops charging. Green and Eco do not exist in this scene.
- **OCPP**: the charger is managed through an OCPP server, and the SolaXCloud app hides the mode selection.

![Solar scene: SolaX EV charger communicating with the inverter, Wi-Fi/LAN router to the cloud, CT/meter, RCBO and AC distribution box](https://taphome.com/images/compatibility/solax-hac-cloud-api/system-solar-scene-inverter_hu_d5e2ffa4db2be771.jpg)

The inverter connects to port **COM1-S-** (A1/B1). A meter or CT connects to port **COM2-M-** (A2/B2, CT inputs on the other pins). The charging current level for Green mode (3 A or 6 A) and for Eco mode (6, 10, 16, 20 or 25 A) is set in the app under **Details > Function Control > Charge Level**. On 11 kW models, Eco offers only 6 A and 10 A. Green and Eco charging also require a vehicle that complies with IEC 61851.

## Setting up API access in the SolaX Developer Portal

1. Sign in to the [SolaX Developer Portal](https://developer.solaxcloud.com/home) and open **Quick Start** or **Application**.
2. Create an application for the SolaXCloud plant that contains the charger. The application must have at least one authorized plant.
3. In the application's **Authorization** tab, copy the **Client ID** and **Client Secret**.
4. Under **Service API > Authorize**, enable the monitoring services **Data Monitoring Service** (`API_Telemetry_V2`) and **Information Access Service** (`API_Info_V2`). Enable the EV charger control service as well, which the work mode switch and the service actions need. Monitoring alone works without it.
5. Find the charger's serial number under **Device > Device List**. It is the same SN as in the SolaXCloud app.

> [!WARNING]
> The template is set to the European API host `openapi-eu.solaxcloud.com`. SolaX runs separate hosts for China (`openapi-cn.solaxcloud.com`) and India (`openapi-in.solaxcloud.com`). The region of the account is shown in the Developer Portal. The template does not work, as imported, with an application in another region.

### Import parameters

In TapHome, import the template and fill in the three parameters below. Everything else (token, polling, retries) is handled by the module.

| Parameter | Description | Where to find it |
|-----------|-------------|------------------|
| `ClientId` | Client ID of the Developer Portal application | Application > **Authorization** |
| `ClientSecret` | Client Secret of the same application | Application > **Authorization** |
| `DeviceSN` | Serial number of the charger (not the Registration No.) | Developer Portal **Device > Device List**, or **Basic information** in the SolaXCloud app |

> [!WARNING]
> Use one Client ID and Client Secret pair for only one client. Each application has only one valid access token, so a new token request cancels the previous one. A second TapHome template instance, or another tool polling with the same credentials, keeps cancelling this template's token. For a second charger, or for another system, create a separate application in the Developer Portal.

## Device capabilities

The device names in the template are in Slovak. Each one is shown below with its name in the app in brackets.

### Charging power and energy

**Charging power** (`Nabíjací výkon`) is an electricity meter. It shows the current charging power in kW and the total charged energy in kWh. Its service attributes show the energy of the current session (`Energia aktuálnej relácie [kWh]`), the phase currents L1, L2 and L3 (`Prúd L1 [A]`, `Prúd L2 [A]`, `Prúd L3 [A]`) and the single-phase current (`Jednofázový prúd [A]`).

### Charging state and status code

- **Charging in progress** (`Nabíjanie prebieha`) is a contact. It is on (`Nabíja`) only while the charger reports the status Charging. In every other status it is off (`Nenabíja`), including Suspended EV and Suspended EVSE.
- **Charger status** (`Stav nabíjačky`) is the raw status code of the charger:

| Code | Status | Code | Status |
|------|--------|------|--------|
| 0 | Available | 7 | Suspended EV |
| 1 | Preparing | 8 | Suspended EVSE |
| 2 | Charging | 9 | Update |
| 3 | Finishing | 10 | Card Activation |
| 4 | Faulted | 11 | Start Delay |
| 5 | Unavailable | 12 | Charge Pause |
| 6 | Reserved | 13 | Stopping |

### Work mode

**Work mode** (`Pracovný režim`) is a multi-value switch with four values: **STOP**, **FAST**, **ECO** and **GREEN**. It reads the current mode of the charger and sets a new one from TapHome. ECO and GREEN behave as described in the Solar scene above and depend on the charger's communication with the inverter or the meter.

### Service actions

The charger status device carries four service actions:

- **Start charging** (`Spustiť nabíjanie`) and **Stop charging** (`Zastaviť nabíjanie`).
- **Lock / make available** (`Zamknúť / sprístupniť nabíjačku`), with the values Lock (`Zamknúť`) and Make available (`Sprístupniť`).
- **Set current limit** (`Nastaviť limit prúdu`): 6–32 A on the 7 kW and 22 kW models, 6–16 A on the 11 kW model.

The commands are asynchronous. The answer "OK, príkaz odoslaný" means the SolaX cloud accepted the command, not that the charger has already carried it out. The result shows up in the readings of the next cycles.

### Card and session history in Charts

- **RFID card** (`RFID karta`) shows the number of the card that started the session, or 0 when no card is used.
- **Session charging time** (`Čas nabíjania relácie`) shows the duration of the current session in minutes.

The SolaX API does not provide a card history. With Charts enabled on these two variables, TapHome builds the history itself: which card charged, when and for how long, with a resolution of 60 seconds. Cards are only used when the charger's activation mode is set to **RFID** in the SolaXCloud app (**Charger setting > Activation mode**). The default **Plug & Charge** mode uses no card.

## Troubleshooting

### No data, or an authentication error on the module

- Check that the charger is online in the SolaXCloud app. The server icon on the charger's screen shows whether it is connected to SolaXCloud.
- Check `ClientId` and `ClientSecret` against the **Authorization** tab. A secret regenerated in the portal has to be entered again.
- Check that `DeviceSN` is the charger's serial number, not the Registration No.
- Check that the application has an authorized plant with the charger and that the monitoring services are authorized. An API code **10403** means that the API service has no access rights. A code **10500** means that the application has no permission for this device's data.
- Codes **10400** and **10402** mean the token is not valid. The module requests a new token and repeats the reading in the same cycle. If the module still reports an error with the text "aj po obnove tokenu" ("even after renewing the token"), the credentials or the authorized services are wrong.

### Readings stop changing

Codes **10405** and **10406** mean that the API call limit has been reached. The module shows a warning and keeps the values from the last successful cycle. The template makes one request per minute. Other tools reading the same SolaX account count toward the same limit.

### Work mode or actions fail

- A service action returns the text `SolaX API kód <code>` when the cloud rejects the command. A code **10403** (no access rights to the interface) can mean that the EV charger control service is not authorized for the application.
- ECO and GREEN only work in the Solar scene and need a working connection to the inverter or the CT/meter. In the Standard scene the charger only starts and stops charging.

### Commercial installations

The template reads the charger as part of a residential plant (`businessType=1`). According to the template author, a charger in a commercial and industrial plant needs the value 4, and its power values are then in kW instead of W.

## Available devices 6

These devices appear in TapHome after import.

SolaX Cloud API Module

Custom Variables

|                         |
|-------------------------|
| `AccessToken` (string)  |
| `RealtimeData` (string) |
| `ClientId` (string)     |
| `ClientSecret` (string) |
| `DeviceSN` (string)     |

Read (module)

```taphome
IF LENGTH(AccessToken) = 0
    VAR tokenBody := "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials";
    VAR tokenResponse := SENDHTTPREQUEST("/openapi/auth/oauth/token", "POST", tokenBody, "Content-Type: application/x-www-form-urlencoded");
    IF tokenResponse.IsSuccess
        VAR newToken := PARSEJSON(tokenResponse.Content, "$.result.access_token", true);
        IF !ISNULL(newToken)
            AccessToken := newToken;
        ELSE
            ADDERROR(1, "SolaX auth: odpoveď bez access_token");
        END
    ELSE
        ADDERROR(1, "SolaX auth zlyhala: HTTP " + tokenResponse.StatusCode);
    END
END

IF LENGTH(AccessToken) > 0
    VAR rtResponse := SENDHTTPREQUEST("/openapi/v2/device/realtime_data?snList=" + DeviceSN + "&deviceType=4&businessType=1", "GET", "", "Authorization: bearer " + AccessToken);
    IF rtResponse.IsSuccess
        VAR rtCode := PARSEJSON(rtResponse.Content, "$.code", true);
        IF rtCode = 10000
            RealtimeData := rtResponse.Content;
        ELSEIF rtCode = 10400 | rtCode = 10402
            VAR tokenBody2 := "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials";
            VAR tokenResponse2 := SENDHTTPREQUEST("/openapi/auth/oauth/token", "POST", tokenBody2, "Content-Type: application/x-www-form-urlencoded");
            AccessToken := "";
            IF tokenResponse2.IsSuccess
                VAR newToken2 := PARSEJSON(tokenResponse2.Content, "$.result.access_token", true);
                IF !ISNULL(newToken2)
                    AccessToken := newToken2;
                    rtResponse := SENDHTTPREQUEST("/openapi/v2/device/realtime_data?snList=" + DeviceSN + "&deviceType=4&businessType=1", "GET", "", "Authorization: bearer " + AccessToken);
                    IF rtResponse.IsSuccess
                        rtCode := PARSEJSON(rtResponse.Content, "$.code", true);
                        IF rtCode = 10000
                            RealtimeData := rtResponse.Content;
                        ELSE
                            ADDERROR(2, "SolaX API kód " + rtCode + " aj po obnove tokenu");
                        END
                    END
                END
            END
        ELSEIF rtCode = 10405 | rtCode = 10406
            ADDWARNING("SolaX limit volaní API (kód " + rtCode + "), zobrazujú sa dáta z minulého cyklu");
        ELSE
            ADDWARNING("SolaX prechodná chyba, kód " + rtCode);
        END
    ELSE
        ADDERROR(3, "Chyba čítania dát: HTTP " + rtResponse.StatusCode);
    END
END
```

Nabíjací výkon Electricity Meter

Service Attributes

|                                  |
|----------------------------------|
| Energia aktuálnej relácie \[kWh] |
| Prúd L1 \[A]                     |
| Prúd L2 \[A]                     |
| Prúd L3 \[A]                     |
| Jednofázový prúd \[A]            |

Read total consumption

```taphome
PARSEJSON(RealtimeData, "$.result[0].totalChargeEnergy", true)
```

Read demand

```taphome
PARSEJSON(RealtimeData, "$.result[0].chargingPower", true) / 1000
```

Service Attributes

Energia aktuálnej relácie \[kWh]

```taphome
PARSEJSON(RealtimeData, "$.result[0].chargingEnergyThisSession", true)
```

Prúd L1 \[A]

```taphome
PARSEJSON(RealtimeData, "$.result[0].l1Current", true)
```

Prúd L2 \[A]

```taphome
PARSEJSON(RealtimeData, "$.result[0].l2Current", true)
```

Prúd L3 \[A]

```taphome
PARSEJSON(RealtimeData, "$.result[0].l3Current", true)
```

Jednofázový prúd \[A]

```taphome
PARSEJSON(RealtimeData, "$.result[0].singlePhaseCurrent", true)
```

Nabíjanie prebieha Reed Contact

Read

```taphome
VAR status := PARSEJSON(RealtimeData, "$.result[0].deviceStatus", true);
IF ISNULL(status)
    RETURN(0);
END
IF status = 2
    RETURN(1);
END
RETURN(0);
```

Stav nabíjačky Variable

Service Actions

|                                 |
|---------------------------------|
| Spustiť nabíjanie               |
| Zastaviť nabíjanie              |
| Zamknúť / sprístupniť nabíjačku |
| Nastaviť limit prúdu            |

Read

```taphome
PARSEJSON(RealtimeData, "$.result[0].deviceStatus", true)
```

Service Actions

Spustiť nabíjanie

```taphome
VAR body := "{\"snList\":[\"" + DeviceSN + "\"],\"workCmd\":2,\"workMode\":2,\"businessType\":1}";
VAR r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_charge_command", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
VAR c := 0;
IF r.IsSuccess
    c := PARSEJSON(r.Content, "$.code", true);
    IF c = 10400 | c = 10402
        VAR tb := "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials";
        VAR tr := SENDHTTPREQUEST("/openapi/auth/oauth/token", "POST", tb, "Content-Type: application/x-www-form-urlencoded");
        IF tr.IsSuccess
            VAR nt := PARSEJSON(tr.Content, "$.result.access_token", true);
            IF !ISNULL(nt)
                AccessToken := nt;
                r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_charge_command", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
                IF r.IsSuccess
                    c := PARSEJSON(r.Content, "$.code", true);
                END
            END
        END
    END
    IF c = 10000
        RETURN("OK, príkaz odoslaný");
    END
    RETURN("SolaX API kód " + c);
END
ADDERROR(r.StatusCode);
RETURN("Chyba");
```

Zastaviť nabíjanie

```taphome
VAR body := "{\"snList\":[\"" + DeviceSN + "\"],\"workCmd\":3,\"workMode\":3,\"businessType\":1}";
VAR r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_charge_command", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
VAR c := 0;
IF r.IsSuccess
    c := PARSEJSON(r.Content, "$.code", true);
    IF c = 10400 | c = 10402
        VAR tb := "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials";
        VAR tr := SENDHTTPREQUEST("/openapi/auth/oauth/token", "POST", tb, "Content-Type: application/x-www-form-urlencoded");
        IF tr.IsSuccess
            VAR nt := PARSEJSON(tr.Content, "$.result.access_token", true);
            IF !ISNULL(nt)
                AccessToken := nt;
                r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_charge_command", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
                IF r.IsSuccess
                    c := PARSEJSON(r.Content, "$.code", true);
                END
            END
        END
    END
    IF c = 10000
        RETURN("OK, príkaz odoslaný");
    END
    RETURN("SolaX API kód " + c);
END
ADDERROR(r.StatusCode);
RETURN("Chyba");
```

Zamknúť / sprístupniť nabíjačku

Parameters: Stav

```taphome
VAR body := "{\"snList\":[\"" + DeviceSN + "\"],\"workCmd\":" + lockCmd + ",\"workMode\":" + lockCmd + ",\"businessType\":1}";
VAR r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_charge_command", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
VAR c := 0;
IF r.IsSuccess
    c := PARSEJSON(r.Content, "$.code", true);
    IF c = 10400 | c = 10402
        VAR tb := "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials";
        VAR tr := SENDHTTPREQUEST("/openapi/auth/oauth/token", "POST", tb, "Content-Type: application/x-www-form-urlencoded");
        IF tr.IsSuccess
            VAR nt := PARSEJSON(tr.Content, "$.result.access_token", true);
            IF !ISNULL(nt)
                AccessToken := nt;
                r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_charge_command", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
                IF r.IsSuccess
                    c := PARSEJSON(r.Content, "$.code", true);
                END
            END
        END
    END
    IF c = 10000
        RETURN("OK, príkaz odoslaný");
    END
    RETURN("SolaX API kód " + c);
END
ADDERROR(r.StatusCode);
RETURN("Chyba");
```

Nastaviť limit prúdu

Parameters: Limit prúdu \[A] (7/22 kW: 6-32, 11 kW: 6-16) (6–32 iLim)

```taphome
VAR body := "{\"snList\":[\"" + DeviceSN + "\"],\"currentLimit\":" + iLim + ",\"businessType\":1}";
VAR r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_current_limit", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
VAR c := 0;
IF r.IsSuccess
    c := PARSEJSON(r.Content, "$.code", true);
    IF c = 10400 | c = 10402
        VAR tb := "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials";
        VAR tr := SENDHTTPREQUEST("/openapi/auth/oauth/token", "POST", tb, "Content-Type: application/x-www-form-urlencoded");
        IF tr.IsSuccess
            VAR nt := PARSEJSON(tr.Content, "$.result.access_token", true);
            IF !ISNULL(nt)
                AccessToken := nt;
                r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_current_limit", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
                IF r.IsSuccess
                    c := PARSEJSON(r.Content, "$.code", true);
                END
            END
        END
    END
    IF c = 10000
        RETURN("OK, príkaz odoslaný");
    END
    RETURN("SolaX API kód " + c);
END
ADDERROR(r.StatusCode);
RETURN("Chyba");
```

RFID karta Variable

Read

```taphome
VAR rfid := PARSEJSON(RealtimeData, "$.result[0].rfidnumber", true);
IF ISNULL(rfid)
    RETURN(0);
END
RETURN(rfid);
```

Čas nabíjania relácie Variable

Read

```taphome
VAR t := PARSEJSON(RealtimeData, "$.result[0].chargingTimeThisSession", true);
IF ISNULL(t)
    RETURN(0);
END
RETURN(t / 60);
```

Pracovný režim Multi-value Switch

Values / States: STOP · FAST · ECO · GREEN

Read switch state

```taphome
VAR mode := PARSEJSON(RealtimeData, "$.result[0].deviceWorkingMode", true);
IF ISNULL(mode)
    RETURN(0);
END
RETURN(mode);
```

Write switch state

```taphome
VAR body := "{\"snList\":[\"" + DeviceSN + "\"],\"workMode\":" + Mu + ",\"businessType\":1}";
VAR r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_work_mode", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
VAR c := 0;
IF r.IsSuccess
    c := PARSEJSON(r.Content, "$.code", true);
    IF c = 10400 | c = 10402
        VAR tb := "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials";
        VAR tr := SENDHTTPREQUEST("/openapi/auth/oauth/token", "POST", tb, "Content-Type: application/x-www-form-urlencoded");
        IF tr.IsSuccess
            VAR nt := PARSEJSON(tr.Content, "$.result.access_token", true);
            IF !ISNULL(nt)
                AccessToken := nt;
                r := SENDHTTPREQUEST("/openapi/v2/device/evc_control/set_evc_work_mode", "POST", body, "Authorization: bearer " + AccessToken, "Content-Type: application/json");
                IF r.IsSuccess
                    c := PARSEJSON(r.Content, "$.code", true);
                END
            END
        END
    END
    IF c != 10000
        ADDERROR(1, "SolaX API kód " + c);
    END
ELSE
    ADDERROR(r.StatusCode);
END
```

**Connection:** Packet Parser → HTTP

## Import parameters

Enter these values when you import the XML.

| Asked in the app                                      | Default         |
|-------------------------------------------------------|-----------------|
| ClientId: ID klienta z SolaX Developer Portálu        | Enter at import |
| ClientSecret: Client Secret z SolaX Developer Portálu | Enter at import |
| DeviceSN: Sériové číslo nabíjačky (Device SN)         | Enter at import |

## Related Documentation

- [Packet Parser Integration](https://taphome.com/en/compatibility/packet-parser-guide/)
- [Packet Parser (HTTP, TCP, UDP, FTP, MQTT)](https://taphome.com/en/docs/integration/packet-parser/)
- [Packet parser functions](https://taphome.com/en/docs/script/packet-parser/)
- [Parsing functions](https://taphome.com/en/docs/script/parsing-functions/)

