EV charger control
Run one EV charge point from a dashboard: a ring shows the power and the battery while a car charges, a chip shows the OCPP status, and one line sums up the session in kWh, minutes and cost. Start, Stop, Unlock and Reset go out as RPC commands or as an attribute, shaped by your own payload function if needed, and a - / + control sets the current limit in amperes. Every status has its own color and icon, and the card scales to fit.
Who it’s for
The EV charger control widget is for operators of charging stations, parking lots and fleet depots who run charge points from a ThingsBoard dashboard. They want to see at a glance what one charge point is doing, start or stop a session for a driver, free a stuck cable, and cap the current when the site is short of power. The question they would type is “how do I start and stop an EV charger from my dashboard?”
What it does
Charge point CP-03 reports status = Charging, power = 21.8 and soc = 64. The ring fills to 64%, the center reads 21.8 kW · 64%, and the line under it reads 18.4 kWh · 52 min · €6.30. An operator clicks Stop: the widget sends RemoteStopTransaction with the transaction ID, the button reads Stopping…, and it switches back once the charge point reports Finishing.
- Shows every OCPP 1.6 status in its own color and icon: Available, Preparing, Charging, Paused by car, Paused by charger, Finished, Reserved, Unavailable and Faulted, with the error code under Fault.
- Offers one main button that fits the status: Start while the connector is free or plugged in, Stop while a car charges or pauses, and Reset while the charge point is faulted.
- Unlocks the cable with one click while a car is plugged in or has finished.
- Sets the current limit in amperes with − and +. The new value shows at once, and a run of clicks goes out as one command.
- Sums up the session on one line: energy, time since the start, and cost.
- Scales to any card size: on a tall card the title stays at the top, the buttons at the bottom and the ring grows in between, and on a wide card the buttons sit beside the ring.
- Controls one connector. A charger with two connectors takes two widgets, one per device.
How to set up
Data keys
The EV charger control widget has no datasource keys. Like other control widgets, it works on the Target device picked in the widget’s data settings. It reads each key below as telemetry or as an attribute, whichever the device has, and the names can be changed in the Data keys group of the settings. An empty field keeps the name shown here.
- Status,
statusby default. The charger state as text, in any letter case: Available, Preparing, Charging, SuspendedEV, SuspendedEVSE, Finishing, Reserved, Unavailable or Faulted. Until it arrives the card shows No data and every button is locked. - Power, kW,
powerby default. Shown in the center while a car charges. Without it the center shows 0. - Battery, %,
socby default. Fills the ring. Without it the ring stays empty and the center shows only kW. - Session energy, kWh, Session start and Session cost:
sessionEnergy,sessionStartandsessionCostby default. Together they make the session line.sessionStartis a timestamp in milliseconds or seconds. Each part is left out when its key is missing. - Error code,
errorCodeby default. Shown under Fault.NoErroris ignored. - Transaction ID,
transactionIdby default, shown only when commands go by RPC. Sent with Stop. Without it, Stop sends the connector instead. - Rated power, kW and Connector type:
ratedPowerandconnectorTypeby default. Shown under the title, for example 22 kW · Type 2. Hidden when missing. - active is the server attribute ThingsBoard keeps for every device. The widget reads it only when Lock when offline is on.
Commands
- Send commands as, RPC by default.
- RPC sends a one-way command, using Start method, Stop method, Unlock method and Reset method:
RemoteStartTransaction,RemoteStopTransaction,UnlockConnectorandResetby default.- Start sends
{ "connectorId": 1, "idTag": "OPERATOR" }, because chargers want to know which connector to start and who started it. - Stop sends
{ "transactionId": … }. - Unlock sends
{ "connectorId": 1 }. - Reset sends
{ "type": "Soft" }.
- Start sends
- Attribute writes Command attribute,
commandby default, in shared scope, with the valuestart,stop,unlockorreset.
- RPC sends a one-way command, using Start method, Stop method, Unlock method and Reset method:
- Custom payload, off by default. Turning it on opens Payload function(command, params). The function receives the command name, what would be sent and
ctx, and returns what to send instead. Use it for a charger with more than one connector, a different ID tag, or values of your own. When it returns nothing or throws, nothing is sent and the card says why.
After Start, Stop or Reset the button waits for the status to change. When the status has not changed in 30 seconds, a message says so.
Current limit
- Show the current limit, on by default.
- Send the limit as, Attribute by default. It writes Limit attribute (
currentLimitby default) in shared scope. RPC sends Limit method (SetChargingProfileby default) with{ "connectorId": 1, "limit": 16, "unit": "A" }. Either way, Limit attribute is read back as the current value. - Lowest limit, A and Highest limit, A: 6 and 32 by default. The step is 1 A.
How to customize
- To match your dashboard colors — set Accent, indigo
#3949ABby default. It colors the Charging and Preparing states, the Start button, Unlock and the current limit control. - To recolor the other states — set Free (green by default, for Available and Finished), Paused (amber, for both paused states) and Fault (red). The chip and the inside of the ring take a light shade of the same color.
- To show your currency — edit Currency,
€by default. - To lock the card while the charge point is offline — turn on Lock when offline, off by default. The card then shows Offline while
activeis false. - To rename the card — change the widget title, for example to the charge point’s name.
Tips
- Put the widget in a dashboard state whose entity is the charge point a user clicked in a table or a map. One widget then serves every charge point.
- Turn on Custom payload for a charger with two connectors:
params.connectorId = 2; return params;makes the same widget drive the second one. - Pick Attribute under Send commands as when a rule chain, not the charger itself, turns commands into charger calls. The rule chain reacts to the
commandattribute update. - Keep Attribute under Send the limit as when a rule chain, not the charger itself, turns the limit into a charging profile.
Share Your Widget with the Community
Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.