Vehicles
The ev module allows configuring vehicle profiles.
Vehicles are identified by their MAC address, which they transmit e.g. when connecting
via ISO 15118 (Autocharge) or which can be spoofed via the API using ev/inject_ev.
Based on the matched profile, charging sessions can be assigned to a user (Autocharge)
and the state of charge (SoC) of the vehicle can be estimated from battery capacity and charging efficiency.
Not supported on this hardware!
Not supported on this hardware!
Not supported on this hardware!
ev/state
The state of the currently connected vehicle.
{
"active_ev_index": 0,
"name": "ID.4",
"mac": "0A:1B:2C:D3:E4:F5",
"soc": 42.5,
"capacity": 77.0,
"charging_efficiency": 0.92
}
A vehicle is connected and was matched to the first vehicle profile. The estimated state of charge is 42.5 %.
| Name | Description |
|---|---|
active_ev_indexint | Index of the matched vehicle profile in |
namestring | Name of the matched vehicle profile. Empty if no vehicle is connected or the vehicle could not be matched to a profile. |
macstring | MAC address of the connected vehicle in the format |
socfloat (%) | Current state of charge (SoC) of the vehicle in percent. Either transmitted by the vehicle (ISO 15118-20), set via |
capacityfloat (kWh) | Battery capacity of the connected vehicle in kWh. Taken from the matched vehicle profile or transmitted by the vehicle (ISO 15118-20). null if no vehicle is connected. |
charging_efficiencyfloat | Charging efficiency of the connected vehicle: ratio of stored to consumed energy. Taken from the matched vehicle profile. 0.92 if no profile is matched. |
ev/seen_macs
The MAC addresses of the most recently connected vehicles (up to 8). Helpful for determining the MAC address of a vehicle to be configured in ev/config.
| Index | Description | ||||||
|---|---|---|---|---|---|---|---|
[..]object | A seen MAC address
|
ev/inject_soc
Sets the state of charge (SoC) of the currently connected vehicle via the API. Starting from this value, the SoC is further estimated from the charged energy, the battery capacity and the charging efficiency.
# $HOST e.g. warp4-AbCd
Write
curl http://$HOST/ev/inject_soc -d '{ "soc": 42.5 }'
or abbreviated:
curl http://$HOST/ev/inject_soc -d '42.5'
Sets the state of charge of the connected vehicle to 42.5 %.
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. warp4/AbCd
Write
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_soc -m '{ "soc": 42.5 }'
or abbreviated:
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_soc -m '42.5'
Sets the state of charge of the connected vehicle to 42.5 %.
| Name | Description |
|---|---|
socfloat (%) | State of charge in percent. Must be between 0 and 100. |
ev/inject_ev
Pretends that a vehicle with the given MAC address has connected. This allows identifying a vehicle via the API that does not transmit its MAC address itself (via ISO 15118). If the MAC address can be matched to a vehicle profile from ev/config, its settings are applied and (if Autocharge is active) the charging session is assigned to the configured user.
# $HOST e.g. warp4-AbCd
Write
curl http://$HOST/ev/inject_ev -d '{ "mac": "0A:1B:2C:D3:E4:F5" }'
or abbreviated:
curl http://$HOST/ev/inject_ev -d '"0A:1B:2C:D3:E4:F5"'
Pretends that a vehicle with the MAC address 0A:1B:2C:D3:E4:F5 has connected.
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. warp4/AbCd
Write
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_ev -m '{ "mac": "0A:1B:2C:D3:E4:F5" }'
or abbreviated:
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_ev -m '"0A:1B:2C:D3:E4:F5"'
Pretends that a vehicle with the MAC address 0A:1B:2C:D3:E4:F5 has connected.
| Name | Description |
|---|---|
macstring | MAC address of the vehicle in the format |
ev/config
The configured vehicle profiles.
# $HOST e.g. warp4-AbCd
Read
curl http://$HOST/ev/config
{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
Write
curl http://$HOST/ev/config -d '{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}'
or abbreviated:
curl http://$HOST/ev/config -d '[
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]'
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. warp4/AbCd
Read
mosquitto_sub -v -C 1 -h $BROKER -t $PREFIX/ev/config
{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
Write
With MQTT on $PREFIX/ev/config_update
mosquitto_pub -h $BROKER -t $PREFIX/ev/config_update -m '{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}'
or abbreviated:
mosquitto_pub -h $BROKER -t $PREFIX/ev/config_update -m '[
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]'
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
| Name | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
evsobject[..] | List of vehicle profiles (up to 16).
|
Not supported on this hardware!
Not supported on this hardware!
ev/state
The state of the currently connected vehicle.
{
"active_ev_index": 0,
"name": "ID.4",
"mac": "0A:1B:2C:D3:E4:F5",
"soc": 42.5,
"capacity": 77.0,
"charging_efficiency": 0.92
}
A vehicle is connected and was matched to the first vehicle profile. The estimated state of charge is 42.5 %.
| Name | Description |
|---|---|
active_ev_indexint | Index of the matched vehicle profile in |
namestring | Name of the matched vehicle profile. Empty if no vehicle is connected or the vehicle could not be matched to a profile. |
macstring | MAC address of the connected vehicle in the format |
socfloat (%) | Current state of charge (SoC) of the vehicle in percent. Either transmitted by the vehicle (ISO 15118-20), set via |
capacityfloat (kWh) | Battery capacity of the connected vehicle in kWh. Taken from the matched vehicle profile or transmitted by the vehicle (ISO 15118-20). null if no vehicle is connected. |
charging_efficiencyfloat | Charging efficiency of the connected vehicle: ratio of stored to consumed energy. Taken from the matched vehicle profile. 0.92 if no profile is matched. |
ev/seen_macs
The MAC addresses of the most recently connected vehicles (up to 8). Helpful for determining the MAC address of a vehicle to be configured in ev/config.
| Index | Description | ||||||
|---|---|---|---|---|---|---|---|
[..]object | A seen MAC address
|
ev/inject_soc
Sets the state of charge (SoC) of the currently connected vehicle via the API. Starting from this value, the SoC is further estimated from the charged energy, the battery capacity and the charging efficiency.
# $HOST e.g. warp-AbCd
Write
curl http://$HOST/ev/inject_soc -d '{ "soc": 42.5 }'
or abbreviated:
curl http://$HOST/ev/inject_soc -d '42.5'
Sets the state of charge of the connected vehicle to 42.5 %.
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. warp/AbCd
Write
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_soc -m '{ "soc": 42.5 }'
or abbreviated:
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_soc -m '42.5'
Sets the state of charge of the connected vehicle to 42.5 %.
| Name | Description |
|---|---|
socfloat (%) | State of charge in percent. Must be between 0 and 100. |
ev/inject_ev
Pretends that a vehicle with the given MAC address has connected. This allows identifying a vehicle via the API that does not transmit its MAC address itself (via ISO 15118). If the MAC address can be matched to a vehicle profile from ev/config, its settings are applied and (if Autocharge is active) the charging session is assigned to the configured user.
# $HOST e.g. warp-AbCd
Write
curl http://$HOST/ev/inject_ev -d '{ "mac": "0A:1B:2C:D3:E4:F5" }'
or abbreviated:
curl http://$HOST/ev/inject_ev -d '"0A:1B:2C:D3:E4:F5"'
Pretends that a vehicle with the MAC address 0A:1B:2C:D3:E4:F5 has connected.
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. warp/AbCd
Write
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_ev -m '{ "mac": "0A:1B:2C:D3:E4:F5" }'
or abbreviated:
mosquitto_pub -h $BROKER -t $PREFIX/ev/inject_ev -m '"0A:1B:2C:D3:E4:F5"'
Pretends that a vehicle with the MAC address 0A:1B:2C:D3:E4:F5 has connected.
| Name | Description |
|---|---|
macstring | MAC address of the vehicle in the format |
ev/config
The configured vehicle profiles.
# $HOST e.g. warp-AbCd
Read
curl http://$HOST/ev/config
{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
Write
curl http://$HOST/ev/config -d '{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}'
or abbreviated:
curl http://$HOST/ev/config -d '[
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]'
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. warp/AbCd
Read
mosquitto_sub -v -C 1 -h $BROKER -t $PREFIX/ev/config
{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
Write
With MQTT on $PREFIX/ev/config_update
mosquitto_pub -h $BROKER -t $PREFIX/ev/config_update -m '{
"evs": [
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]
}'
or abbreviated:
mosquitto_pub -h $BROKER -t $PREFIX/ev/config_update -m '[
{
"name": "ID.4",
"mac": "0A:1B:2C:xx:xx:xx",
"capacity": 77.0,
"charging_efficiency": 0.92,
"user_id": 2
},
{
"name": "Zoe",
"mac": "5C:AF:06:12:34:56",
"capacity": 52.0,
"charging_efficiency": 0.9,
"user_id": 0
}
]'
Configures two vehicle profiles: One vehicle with a rotating MAC address (only the first three bytes are used for identification) whose charging sessions are assigned to the user with ID 2, and one vehicle with a fixed MAC address without user assignment.
| Name | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
evsobject[..] | List of vehicle profiles (up to 16).
|