When using Gridio to control smart charging of your customer’s vehicle(s), you need to be able to do three things:

The following walkthrough assumes that you have authenticated with Gridio and have a valid access token in possession. For getting access, please see Getting Started with Gridio Connect

Getting vehicle status

Vehicle status comes in two flavors: you can ask Gridio for latest cached data point or force Gridio to request the fresh data point from the vehicle. We are separating those two because the latter, although attractive, may have adverse impact on vehicle 12V battery on some vehicle brands. For others, such as Tesla, in may involve waking up a sleeping vehicle, that will also have negative impact on the battery of the vehicle. Therefore, we recommend using the cached vehicle state data as much as possible and and use the second request for latest data sparingly.

Cached data and configuration request

curl -X GET <https://api.gridio.energy/api/v1/businesses/{business_id}/devices/{dev_id}> \\
-H "Authorization: Bearer <backend access token>" 

Sample response


        {
            "__typename": "Vehicle",
            "id": "1768571200",
            "dev_make": "mock",
            "phys_id": "019bc70e-45de-7b0a-a5dc-8c0f00415c7b",
            "dev_type": "Electric vehicle",
            "metadata": {
                "id": "1768571200",
                "dev_id": "1768571200",
                "dev_type": "Electric vehicle",
                "dev_make": "mock",
                "phys_id": "019bc70e-45de-7b0a-a5dc-8c0f00415c7b",
                "setup_complete": true
            },
            "connector_data": {
                "title": "BMW iX3",
                "display_name": "BMW iX3",
                "location_aware": true
            },
            "config": {
                "opt_out": false,
                "opt_out_until": "",
                "charge_by": "06:00",
                "charge_from": "06:00",
                "guaranteed_max_price": null,
                "guaranteed_soc": 0,
                "target_soc": 100
            },
            "policy": "CHARGE BY",
            "setup_complete": true
        }

Gridio statuses

Besides charging statuses that show what the car is doing (charging, being full etc), Gridio also provides a “gridio_status” field that provides additional information on Gridio’s current behavior with regards to a given vehicle. This is helpful when telling the customer “WHY” the car is charging. Is it because it is at a DC charger (Gridio will not engage), is it because of low prices or perhaps because the vehicle is outside the permitted time window.

Gridio Status Charging status Description
active_smart_charging plugged_in_charging Gridio is active, the vehicle is at charging location, and charging. gridio is controlling the charging
active_charging plugged_in_charging Gridio is active, but vehicle is outside designated charging location (is. fast charger). gridio is not controlling the vehicle, just monitoring
active_solar_charging plugged_in_charging Gridio is active and is charging the car because there is excess solar for the vehicle present at the charging location
active_scheduled plugged_in_stopped Gridio is active and has stopped the car from charging and is waiting for cheaper prices
active_waiting plugged_in_stopped
plugged_in_completed
plugged_in_charging
plugged_in_error
unplugged
unknown Gridio is active, but the car is unplugged, outside charging location or the charging has been completed, Gridio is waiting for the car to be plugged in at a charging location
inactive_opted_out plugged_in_stopped
plugged_in_completed
plugged_in_charging
plugged_in_error
unplugged
unknown car has been opted out, Gridio is not doing anything
inactive_scheduled plugged_in_stopped
plugged_in_completed
plugged_in_charging
plugged_in_error
unplugged
unknown Gridio is inactive, because car is outside the charging window (ie, charging window is not 24 hours and we are outside the permitted hours)
inactive_setup_incomplete plugged_in_stopped
plugged_in_completed
plugged_in_charging
plugged_in_error
unplugged
unknown Gridio is inactive because some key setup is missing (most likely charge by time)

Latest data request

curl -X GET <https://api.gridio.energy/api/v1/businesses/{business_id}/devices/{dev_id}/metrics/latest> \\
-H "Authorization: Bearer <backend access token>" 

The difference between the responses of cached data and latest data is that, while the first response provides the vehicle object that includes both metric data and vehicle configuration, then requesting latest vehicle data just provides the latest numeric data (ie. telemetry such as state of charge, vehicle plug status).

For detailed samples, please see Gridio Connect API Endpoints