SmartPi API

With the integrated REST API, it is possible to read out all relevant data and use it in your own applications. The web interface of the SmartPi also uses the REST API.

Current values

For example, in the address bar of your browser, enter:
 http://<ipaddress:1080>/api/all/all/now .
You will get all current values displayed.
The structure of the URL is always the same:
 http://<ipaddress>:<port>/api/<phaseid>/<valueid>/now

For valueid the following parameters are allowed:

current Current [A](For phase 1,2,3 and neutral (4))
voltage Voltage [V](Only for phase 1,2,3)
power Power [W]  (Only for phase 1,2,3)
cosphi cos φ  (Only for phase 1,2,3)
frequency Frequency [Hz]  (Only for phase 1,2,3)
all all All values

 

For phaseid the following parameters are allowed:

1 phase 1
2 phase 2
3 phase 3
4 Only valid for the valueid current parameter (current of the neutral conductor)
all All phases

 

Historical and chart data

The REST API can also provide historical data.
For example, http://<ipaddress:1080>/api/chart/123/power/from/2016-09-29T00:00:00.000Z/to/2016-09-29T14:00:00.000Z
outputs all values measured on September 29, 2016 between 0:00 and 14:00.
Again, the structure of the URL is always the same:
http://<ipaddress>:<port>/api/chart/<phaseid>/<valueid>

For valueid the following parameters are allowed

current Current [A] (available for phase 1,2,3, neutral conductor)
voltage Voltage [V] (available for phase 1,2,3)
power Power [W]  (available for phase 1,2,3)
cosphi cos φ  (available for phase 1,2,3 –  it is important to measure the voltage)
energy_pos Energy [Wh] (energy consumption)
energy_neg Energy [Wh] (energy production)

 

Für phaseid sind folgende Parameter erlaubt

1 phase 1
2 phase 2
3 phase 3
4 Only valid for the valueid current parameter (current of the neutral conductor)
123 All phasen

SmartPi Modbus TCP/RTU

Minimum requirement: Version 0.9.4
With the integrated Modbus interface it is possible to read out all relevant data via TCP or RTU and to use them in own applications.
With Modbus RTU it must be ensured that the RS485 has been configured correctly.

See RS485 Aktivierung

Modbus TCP

TCP Port: 502

Slave Address: 1

Supported Functions: 3,4

Transaction number
TN

Protocol identifier
PK

Number of bytes still to come

Adress

Function

Data

2 Byte

2 Byte (always 0x0000)

2 Byte (n+2)

1 Byte

1 Byte

n Byte

Modbus RTU

Baud rate: 19200 8N1

Slave Address: adjustable (default: 1)

Supported functions: 3,4

Adress

Function

Data

CR-Check

1 Byte

1 Byte

n Bytes

2 Bytes

Register

No

Name

Address

Type

Data format

Unit

Function code

Note

1

I1

0-1

R

Float

A

3,4

I1>0 = Reference
I1<0 = Feed

2

I2

2-3

R

Float

A

3,4

I2>0 = Reference
I2<0 = Feed

3

I3

4-5

R

FLOAT

A

3,4

I3>0 = Reference
I3<0 = Feed

4

I4

6-7

R

FLOAT

A

3,4

I4>0 = Reference
I4<0 = Feed

5

U1

8-9

R

FLOAT

V

3,4

 

6

U2

10-11

R

FLOAT

V

3,4

 

7

U3

12-13

R

FLOAT

V

3,4

 

8

P1

14-15

R

FLOAT

W

3,4

P1>0 = Reference
P1<0 = Feed

9

P2

16-17

R

FLOAT

W

3,4

P2>0 = Reference
P2<0 = Feed

10

P3

18-19

R

FLOAT

W

3,4

P3>0 = Reference
P3<0 = Feed

11

CosPhi1

20-21

R

FLOAT

 

3,4

 

12

CosPhi2

22-23

R

FLOAT

 

3,4

 

13

CosPhi2

24-25

R

FLOAT

 

3,4

 

14

F1

26-27

R

FLOAT

Hz

3,4

 

15

F2 28-29 R FLOAT Hz 3,4  

16

F3 30-31 R FLOAT Hz 3,4  

 

 

Float

Formatting according to IEEE-754

 

Example:

Measured value: 230V

4 bytes: 0x43 0x66 0x00 0x00

Example Modbus RTU

Read all data.

Master => SmartPi

Adress

Function

Start Register

Number Register

CRC

0x01

0x03

0x00 0x00

0x00 0x20

0x44 0x12

 

SmartPi => Master

Adress

Function

Number Bytes

Data

CRC

0x01

0x03

0x40

0x 0x 0xBD 0xA7 0xA0 0x76 0xBD 0x9E 0xCF 0xFB 0xBD 0xA8 0x23 0xA7 0xBD 0x9B 0x46 0xC4 0x3E 0xC9 0x51 0x83 0x3E 0xCC 0x63 0xF1 0x3E 0xCA 0x71 0xDE 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xBC 0x9F 0x08 0x03 0x3F 0x77 0x4D 0xD9 0xBE 0x71 0x7D 0xBD 0xBE 0xEA 0xAD 0xFF 0x43 0x91 0xC9 0x2F 0x43 0x7E 0xFA 0xE7 0x42 0xA4 0x0C 0xCC

0x52 0x94