Skip to content

Latest commit

 

History

History
268 lines (228 loc) · 29.3 KB

go-eCharger Modbus TCP API v1 EN.md

File metadata and controls

268 lines (228 loc) · 29.3 KB

GO-E Charger Modbus TCP/IP Documentation English

Version Date Author Description
1.0 2020-10-01 Peter Pötzi Initial version

Index

Documentation to the used libraries

API activation

To activate the API, you have to allow API access in the go-eCharger app under Advanced Settings.
After activation, the charging box must be restarted.
The API is only available for firmware version 0.40 and newer.

Connection

The Modbus TCP connection goes as follows:

Connection Port
WLAN 502

The go-e Charger has the unitId of 1.

Modbus Register

The Register ID is 0-indexed. Because of that some clients have to increase the Register ID by 1.

Registers are designed as holding registers or input registers.

  • Holding Register allows reading and writing.
  • Input Register allows only reading.

For values ​​that are distributed over several registers are all 16-Bit packages a big-endian.

Register Name Register Type Data type Lenght Description
100 CAR_STATE Input Register unsigned integer (16) 1 Status PWM signaling
0: Unknown, Charging station defective
1: Charging station ready, no car
2: Car is charging
3: Waiting for car
4: Charging finnished, Car still connected
101 PP_CABLE Input Register unsigned integer (16) 1 Type2 Cable ampere coding
13-32: ampere coding
0: no cable
105
106
FWV Input Register ascii (4 byte) 2 Firmware version as ASCII
107 ERROR Input Register unsigned integer (16) 1 error:
1: RCCB (Residual current circuit breaker)
3: PHASE (phase disturbance)
8: NO_GROUND (Ground detection)
10, default: INTERNAL (Others)
108
109
VOLT_L1 Input Register unsigned integer (32) 2 Voltage on L1 in volts
110
111
VOLT_L2 Input Register unsigned integer (32) 2 Voltage on L2 in volts
112
113
VOLT_L3 Input Register unsigned integer (32) 2 Voltage on L3 in volts
114
115
AMP_L1 Input Register unsigned integer (32) 2 Amps on L1 in 0.1A (123 equals 12, 3A)
116
117
AMP_L2 Input Register unsigned integer (32) 2 Amps on L2 in 0.1A (123 equals 12, 3A)
118
119
AMP_L3 Input Register unsigned integer (32) 2 Amps on L3 in 0.1A (123 equals 12, 3A)
120
121
POWER_TOTAL Input Register unsigned integer (32) 2 Total power in 0.01kW (360 corresponds to 3.6kW)
128
129
ENERGY_TOTAL Input Register unsigned integer (32) 2 Total amount of energy charged in 0.1kWh
132
133
ENERGY_CHARGE Input Register unsigned integer (32) 2 Amount of energy charged in
Deka-Watt-Seconds
Example: 100, 000 means 1, 000, 000
Ws (= 277Wh = 0.277kWh) were loaded in this charging process.
144
145
VOLT_N Input Register unsigned integer (32) 2 Voltage on N in volts
146
147
POWER_L1 Input Register unsigned integer (32) 2 Power on L1 in 0.1kW (36 corresponds to 3.6kW)
148
149
POWER_L2 Input Register unsigned integer (32) 2 Power on L2 in 0.1kW (36 corresponds to 3.6kW)
150
151
POWER_L3 Input Register unsigned integer (32) 2 Power on L3 in 0.1kW (36 corresponds to 3.6kW)
152
153
POWER_FACTOR_L1 Input Register unsigned integer (32) 2 Power factor on L1 in %
154
155
POWER_FACTOR_L2 Input Register unsigned integer (32) 2 Power factor on L2 in %
156
157
POWER_FACTOR_L3 Input Register unsigned integer (32) 2 Power factor on L3 in %
158
159
POWER_FACTOR_N Input Register unsigned integer (32) 2 Power factor on N in %
200 ALLOW Holding Register unsigned integer (16) 1 allow_charging: PWM Signal is allowed
to abut
0: no
1: yes
201 ACCESS_STATE Holding Register unsigned integer (16) 1 access_state: access control.
0: open
1: RFID / App needed
2: electricity price / automatic
3: scheduler
202 ADAPTER_INPUT Input Register unsigned integer (16) 1 adapter_in: The charging box
is connected with an adapter
0: NO_ADAPTER
1: 16A_ADAPTER
203 UNLOCKED_BY Input Register unsigned integer (16) 1 Number of the RFID card that
activated the current charging process
204 CABLE_LOCK_MODE Holding Register unsigned integer (16) 1 Cable lock setting
0: Lock while the car is connected
1: Unlock automatically after
charging
2: Always keep the cable locked
205 PHASES Input Register unsigned integer (16) 1 Phases before and after the contactor
binary flags: 0b00ABCDEF
A... phase 3, before the contactor
B... phase 2 before the contactor
C... phase 1 before the contatctor
D... phase 3 after the contactor
E... phase 2 after the contactor
F... phase 1 after the contactor
pha 0b00001000: Phase 1 is
available
pha 0b00111000: Phase1-3 is
available
206 LED_BRIGHTNESS Holding Register unsigned integer (16) 1 LED brightness from 0-255
0: LED off
255: LED brightness max
207 LED_SAVE_ENERGY Holding Register unsigned integer (16) 1 led_save_energy: LED switch off
automatically after 10 seconds
0: Energy saving function deactivated
1: Energy saving function activated
208 ELECTRICITY_PRICES_HOURS Holding Register unsigned integer (16) 1 Minimum count ​of hours that must be
charged with "Electricity price - automatic"
Example: 2 ("Car is full enough after 2 hours")
209 ELECTRICITY_PRICES_FINISHED Holding Register unsigned integer (16) 1 Hour (​time) in which with "electricity price
- automatic" the charge must have lasted
at least aho hours.
Example: 7 ("Ready by 7:00, so charged at
least 2 hours before that")
210 ELECTRICITY_PRICES_ZONE Holding Register unsigned integer (16) 1 Awattar price zone
0: Austria
1: Germany
211 AMPERE_MAX Holding Register unsigned integer (16) 1 Absolute Max Amps: Maximum
value for Amps setting
Example: 20 (setting to more than
20A in the app not possible)
212 AMPERE_L1 Holding Register unsigned integer (16) 1 Ampere level 1 for push button on the
device.
6-32: Ampere level activated
0: Level deactivated (will be skipped)
213 AMLERE_L2 Holding Register unsigned integer (16) 1 Ampere level 2 for push button on the
device.
6-32: Ampere level activated
0: Level deactivated (will be skipped)
214 AMPERE_L3 Holding Register unsigned integer (16) 1 Ampere level 3 for push button on the
device.
6-32: Ampere level activated
0: Level deactivated (will be skipped)
215 AMPERE_L4 Holding Register unsigned integer (16) 1 Ampere level 4 for push button on the
device.
6-32: Ampere level activated
0: Level deactivated (will be skipped)
216 AMPERE_L5 Holding Register unsigned integer (16) 1 Ampere level 5 for push button on the
device.
6-32: Ampere level activated
0: Level deactivated (will be skipped)
217 CLOUD_DISABLED Holding Register unsigned integer (16) 1 Cloud disabled
0: cloud enabled
1: cloud disabled
218 NORWAY_MODE Holding Register unsigned integer (16) 1 Norway mode​ activated
0: deactivated (ground detection
activated)
1: activated (no ground detection,
only intended for IT networks)
299 AMPERE_VOLATILE Holding Register unsigned integer (16) 1 Amps Value for the PWM
signaling in whole amps of
6-32A

Is not saved in the EEPROM
and is reset to the value last saved in the EEPROM during the next boot process.

For energy control
300 AMPERE_EEPROM Holding Register unsigned integer (16) 1 Amps Value for the PWM
signaling in whole amps of
6-32A

Is saved in the EEPROM (max.
write cycles approx. 100, 000)
301
302
303
MAC Input Register unsigned integer (48) 3 MAC address of the WLAN station, binary
304
305
306
307
308
309
SNR Input Register ascii (12 byte) 6 Serial number of the go-eCharger, as
ASCII
310
311
312
313
314
HOSTNAME Input Register ascii (12 byte) 6 Host name of the go-eCharger, as ASCII
315
316
317
318
IP Input Register ascii (8 byte) 4 IP address of the go-eCharger, 1 byte per register
319
320
321
322
SUBNET Input Register unsigned integer (64) 4 Subnet mask of the go-eCharger, 1
byte per register
323
324
325
326
GATEWAY Input Register ascii (4 byte) 4 Go-eCharger gateway, 1 byte per register

Connect to Charger

// clientE.js
const net = require("net"); // import net
const modbus = require("jsmodbus"); // import jsmodbus
const socket = new net.Socket(); // create new socket
const client = new modbus.client.TCP(socket, 1); // create client that has been given the socket and the unitId as parameters
const options = { // config for connection
    port: 502, // port
    host: 'xxx.xxx.xxx.xxx' // ip
};

socket.on("error", (err) => { // when the computer has an error while connecting
    console.log(err); // prints error in the console
})
openSocket(socket, options);

Get Data from Input Register

/**
 * @function
 * @name getInputRegisters
 * @param {object} socket 
 * @param {object} client 
 * @param {number} register - attribute from the column "Register" of the GO-E Charger Modbus API
 * @param {number} count - attribute from the column "Länge" of the GO-E Charger Modbus API 
 * 
 * This function prints the JSON Object that the Charger Sends 
 * 
 */
function getInputRegisters(socket, client, register, count) {
    socket.on("connect", function() { // when the computer connects to the given ip
        /**
         * @method 
         * @name readInputRegisters - read only option from Modbus (From the GO-E Charger Modbus API --> column Register Typ)
         * @param {number} register - attribute from the column "Register" of the GO-E Charger Modbus API
         * @param {number} count - attribute from the column "Länge" of the GO-E Charger Modbus API 
         */
        client.readInputRegisters(register, count).then(function(response) {
            console.log(response); // prints response in the console

        }).catch(function(err) {
            console.log(err); // prints error in the console
            closeSocket(socket);

        });
    })
}

Get Data from Holding Register

/**
 * @function
 * @name getHoldingRegisters
 * @param {object} socket 
 * @param {object} client 
 * @param {number} register - attribute from the column "Register" of the GO-E Charger Modbus API
 * @param {number} count - attribute from the column "Länge" of the GO-E Charger Modbus API 
 * 
 * This function prints the JSON Object that the Charger Sends 
 * 
 */
function getHoldingRegisters(socket, client, register, count) {
    socket.on("connect", function() { // when the computer connects to the given ip
        /**
         * @method 
         * @name readHoldingRegisters - read and write option from Modbus
         * @param {number} register - attribute from the column "Register" of the GO-E Charger Modbus API
         * @param {number} count - attribute from the column "Länge" of the GO-E Charger Modbus API 
         */
        client.readHoldingRegisters(register, count).then(function(response) {
            console.log(response); // prints response in the console

        }).catch(function(err) {
            console.log(err); // prints error in the console
            closeSocket(socket);

        });
    })
}

Set Data for Holding Register

/**
 * @function
 * @name setHoldingRegisters
 * @param {object} socket 
 * @param {object} client 
 * @param {number} register - attribute from the column "Register" of the GO-E Charger Modbus API
 * @param {number} value - attribute to set the value of the given register
 * 
 * This function sets the value of a given register
 * 
 */
function setHoldingRegisters(socket, client, register, value) {
    socket.on("connect", function() {
        /**
         * @method 
         * @name writeSingleRegister - read and write option from Modbus
         * @param {number} register - attribute from the column "Register" of the GO-E Charger Modbus API
         * @param {number} value - attribute to set the value of the given register
         */
        client.writeSingleRegister(register, value).then(function(response) {
            console.log(response); // prints the response
        }).catch(function(err) {
            console.log(err); // prints the error
            closeSocket(socket);
        })
    })
}

Close Socket

/**
 * @function
 * @name closeSocket
 * @param {object} socket 
 * 
 * This function closes the socket
 * 
 */
function closeSocket(socket) {
    socket.end();
}

Open Socket

/**
 * @function
 * @name openSocket
 * @param {object} socket 
 * @param {object} option - config for connection
 * 
 * This function opens the socket
 *  
 */
function openSocket(socket, option) {
    socket.connect(options); // connect to the socket with the given config
}