-
Notifications
You must be signed in to change notification settings - Fork 1
/
charge.go
129 lines (90 loc) · 3.19 KB
/
charge.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package monta
import "time"
// SoCSource source of the SoC.
type SoCSource string
// Known [SoCSource] values.
const (
SoCSourceChargePoint SoCSource = "charge-point"
SoCSourceChargeVehicle SoCSource = "vehicle"
)
// Charge is a charging transaction.
type Charge struct {
// ID of the charge.
ID int64 `json:"id"`
// ID of the charge point related to this charge.
ChargePointID int64 `json:"chargePointId"`
// When the charge was created.
CreatedAt time.Time `json:"createdAt"`
// When the charge was last updated.
UpdatedAt time.Time `json:"updatedAt"`
// Date when cable was plugged in.
CablePluggedInAt *time.Time `json:"cablePluggedInAt"`
// Date when charge started.
StartedAt *time.Time `json:"startedAt"`
// Date when charge stopped.
StoppedAt *time.Time `json:"stoppedAt"`
// Date when EV was fully charged.
FullyChargedAt *time.Time `json:"fullyChargedAt"`
// Date when charge failed.
FailedAt *time.Time `json:"failedAt"`
// Date when charge timed out.
TimeoutAt *time.Time `json:"timeoutAt"`
// State of the charge.
State ChargeState `json:"state"`
// Consumed Kwh.
ConsumedKWh *float64 `json:"consumedKwh"`
// List of consumed Kwh split by hour.
KwhPerHour []KwhPerHour `json:"kwhPerHour"`
// Kwh of the meter before charging started.
StartMeterKWh *float64 `json:"startMeterKwh"`
// Kwh of the meter after charging stopped.
EndMeterKWh *float64 `json:"endMeterKwh"`
// Price for this charge.
Price *float64 `json:"price"`
// Configured price limit for this charge.
PriceLimit *float64 `json:"priceLimit"`
// Average price per Kwh.
AveragePricePerKWh *float64 `json:"averagePricePerKwh"`
// Average CO2 consumption per Kwh.
AverageCo2PerKWh *float64 `json:"averageCo2PerKwh"`
// Average percentage of renewable energy per Kwh.
AverageRenewablePerKWh *float64 `json:"averageRenewablePerKwh"`
// Failure reason for this charge.
FailureReason *string `json:"failureReason"`
// Stop reason for this charge.
StopReason *string `json:"stopReason"`
// Payment method for this charge.
PaymentMethod *PaymentMethod `json:"paymentMethod"`
// A note taken for this charge.
Note *string `json:"note"`
// The charge point KW recorded during the charge.
ChargePointKw *float64 `json:"chargePointKw"`
// Configured Kwh limit for this charge.
KWhLimit *float64 `json:"kwhLimit"`
// Currency for paying the charge.
Currency *Currency `json:"currency"`
// PayingTeam is the team paying for the charge.
PayingTeam *PayingTeam `json:"payingTeam"`
// ChargeAuth is the method used to authenticate the charge.
ChargeAuth *ChargeAuth `json:"chargeAuth"`
// Information about the state of charge.
SoC *SoC `json:"soc"`
// Configured SoC limit for this charge.
SoCLimit *float64 `json:"socLimit"`
// Operator of this charge
Operator *Operator `json:"operator"`
}
// Sum of kwh for a given hour.
type KwhPerHour struct {
// Hour for the sum of the kwh.
Time time.Time `json:"time"`
// Sum of kwh for this hour.
Value float64 `json:"value"`
}
// Information about the state of charge if available.
type SoC struct {
// Value of SoC in %
Percentage *float64 `json:"percentage"`
// Source of this value, eg vehicle or charge-point.
Source SoCSource `json:"source"`
}