platform_driver.interfaces.chargepoint.service module

exception platform_driver.interfaces.chargepoint.service.CPAPIException(response_code, response_text)[source]

Bases: Exception

Generic Chargepoint API Exception.

Parameters
  • response_code – Exception code.

  • response_text – Exception description.

class platform_driver.interfaces.chargepoint.service.CPAPIGetAlarmsResponse(response)[source]

Bases: platform_driver.interfaces.chargepoint.service.CPAPIResponse

alarmTime(port=None)[source]
alarmType(port=None)[source]
property alarms
clearAlarms(port=None)[source]
class platform_driver.interfaces.chargepoint.service.CPAPIGetChargingSessionsResponse(response)[source]

Bases: platform_driver.interfaces.chargepoint.service.CPAPIResponse

Energy(port=None)[source]
property charging_sessions
driverAccountNumber(port=None)[source]
driverName(port=None)[source]
endTime(port=None)[source]
rfidSerialNumber(port=None)[source]
sessionID(port=None)[source]
startTime(port=None)[source]
class platform_driver.interfaces.chargepoint.service.CPAPIGetLoadResponse(response)[source]

Bases: platform_driver.interfaces.chargepoint.service.CPAPIResponse

allowedLoad(port=None)[source]
percentShed(port=None)[source]
portLoad(port=None)[source]
shedState(port=None)[source]
stationLoad(port=None)[source]
property station_data
class platform_driver.interfaces.chargepoint.service.CPAPIGetStationRightsResponse(response)[source]

Bases: platform_driver.interfaces.chargepoint.service.CPAPIResponse

property rights
class platform_driver.interfaces.chargepoint.service.CPAPIGetStationStatusResponse(response)[source]

Bases: platform_driver.interfaces.chargepoint.service.CPAPIResponse

Status(port=None)[source]
TimeStamp(port=None)[source]
property status
class platform_driver.interfaces.chargepoint.service.CPAPIGetStationsResponse(response)[source]

Bases: platform_driver.interfaces.chargepoint.service.CPAPIResponse

Address(port=None)[source]
City(port=None)[source]
Connector(port=None)[source]
Country(port=None)[source]
Current(port=None)[source]
Description(port=None)[source]
Lat(port=None)[source]
Level(port=None)[source]
Long(port=None)[source]
Mode(port=None)[source]
Power(port=None)[source]
Reservable(port=None)[source]
State(port=None)[source]
Type(port=None)[source]
Voltage(port=None)[source]
currencyCode(port=None)[source]
endTime(port=None)[source]
mainPhone(port=None)[source]
maxPrice(port=None)[source]
minPrice(port=None)[source]
numPorts(port=None)[source]
orgID(port=None)[source]
organizationName(port=None)[source]
portNumber(port=None)[source]
postalCode(port=None)[source]
static pricing_helper(attribute, station)[source]
sessionTime(port=None)[source]
sgID(port=None)[source]
sgName(port=None)[source]
startTime(port=None)[source]
stationID(port=None)[source]
stationMacAddr(port=None)[source]
stationManufacturer(port=None)[source]
stationModel(port=None)[source]
stationName(port=None)[source]
stationSerialNum(port=None)[source]
property stations
unitPriceForFirst(port=None)[source]
unitPricePerHour(port=None)[source]
unitPricePerHourThereafter(port=None)[source]
unitPricePerKWh(port=None)[source]
unitPricePerSession(port=None)[source]
class platform_driver.interfaces.chargepoint.service.CPAPIResponse(response)[source]

Bases: object

Response object describing a chargepoint API call

Parameters

response – SOAP object containing the API response

Property responseCode

API response Code. ‘100’ is a successful call.

Property responseText

Short description of the designation for the API call

Method is_successful

Returns Boolean value checking whether or not responseCode is set to ‘100.’

static check_output(attribute, parent_dict)[source]

Helper method for get_port_value

static get_attr_from_response(name_string, response, portNum=None)[source]
static get_port_value(port_number, data, attribute)[source]

Returns data for a given port

Parameters
  • port_number – Number of the port to access.

  • data – Larger data structure to scan for Port data.

  • attribute – Which piece of Port data to return.

Return port_data

Accessed data for given port number and attribute. Else None.

static is_not_found(name)[source]
is_successful()[source]
property responseCode
property responseText
class platform_driver.interfaces.chargepoint.service.CPGroupManager(cps, group, stations)[source]

Bases: object

Manger for a Chargepoint group and its stations.

Parameters
  • cps – Chargepoint Service object.

  • group – CPStationGroup object.

  • stations – List of CPStation objects belonging to the CPStationGroup.

refreshGroupStationData()[source]

For all stations belonging to group, refresh load data.

class platform_driver.interfaces.chargepoint.service.CPOrganization(cpn_id, organization_id, name='Unknown')[source]

Bases: object

Represents an organization within the ChargePoint network.

Parameters
  • cpn_id – Chargepoint Network ID.

  • organization_id – Chargepoint Org ID.

  • name

orgID()[source]

Returns Chargepoint orgID

Return orgID

‘cpn_id:organization_id’.

class platform_driver.interfaces.chargepoint.service.CPPort(data=None)[source]

Bases: object

property connector
property current
property level
property portNumber
property power
property voltage
class platform_driver.interfaces.chargepoint.service.CPService(username=None, password=None)[source]

Bases: object

Python wrapper around the Chargepoint WebServices API.

Current Version: 5.0 Docs: ChargePoint_Web_Services_API_Guide_Ver4.1_Rev5.pdf

clearAlarms(**kwargs)[source]

Clears the Alarms of given group or station based on given query parameters.

Parameters

**kwargs

any top-level kwarg in the following query. Most frequently queried via stationID.

Query:
(clearAlarmsSearchQuery){

orgID = None organizationName = None stationID = None stationName = None sgID = None sgName = None startTime = None endTime = None portNumber = None alarmType = None clearReason = None

}

:returns SOAP reply object. If successful, there will be a responseCode of ‘100’.

clearShedState(**kwargs)[source]

Clears the shed state of given group or station.

Parameters
  • (as kwarg) (stationID) – groupID of stations to clear.

  • (as kwarg) – (Optional) ID of individual station to clear. If this is used, only that station will have

a cleared shed state, even with the use of sgID.

:returns SOAP reply object. If successful, there will be a responseCode of ‘100’.

dump_methods_and_datatypes()[source]

Debugging tool. Prints out the SOAP methods and datatypes.

getAlarms(**kwargs)[source]

Returns any active alarms matching the search query.

Parameters

**kwargs

any top-level kwarg in the following query. Most frequently queried via stationID.

Query:
(getAlarmsSearchQuery){

orgID = None organizationName = None stationID = None stationName = None sgID = None sgName = None startTime = None endTime = None portNumber = None startRecord = None numTransactions = None

}

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” Alarms[] =

(oalarms){

stationID = “1:00001” stationName = “CHARGEPOINT / MAIN 001” stationModel = “CT2100-HD-CCR” orgID = “1:ORG00001” organizationName = “My Organization Name” stationManufacturer = Chargepoint stationSerialNum = “000000000001” portNumber = None alarmType = “Reachable” alarmTime = 2016-12-12 12:34:56+00:00 recordNumber = 1

moreFlag = 0

}

getCPNInstances()[source]

Returns ChargePoint network objects.

Generally not useful expect that it returns the all important CPNID which is needed to construct the orgID, described as CPNID:CompanyID.

For North America, the CPNID is ‘1’.

getChargingSessionData(**kwargs)[source]

Returns a list of charging sessions based on search query.

Returns a list of Charging Sessions. If there are more than 100 records returned by the query, there will be a MoreFlag return value of 1.

Parameters

**kwargs

any top-level kwarg in the following query. Most frequently queried via stationID.

Query:
(sessionSearchdata){

stationID = None sessionID = None stationName = None Address = None City = None State = None Country = None postalCode = None Proximity = None proximityUnit = None fromTimeStamp = None toTimeStamp = None startRecord = None Geo =

(geoData){

Lat = None Long = None

}

}

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” ChargingSessionData[] =

(sessionSearchResultdata){

stationID = “1:00001” stationName = “CHARGEPOINT / MAIN 001” portNumber = “2” Address = “1 Main St, Oakland, California, 94607, United States” City = “Oakland” State = “California” Country = “United States” postalCode = “94607” sessionID = 12345678 Energy = 12.345678 startTime = 2016-01-01 01:01:01+00:00 endTime = 2016-01-01 12:12:02+00:00 userID = “123456” recordNumber = 1 credentialID = “123456789”

moreFlag = 0

}

getLoad(**kwargs)[source]

Returns current load of charging station sessions.

Returns Load on Charging stations/groups as defined by input query. If sgID is not included, many group level parameters will be returned as ‘None.’

Parameters

**kwargs

sgID or stationID.

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” numStations = None groupName = None sgLoad = None stationData[] =

(stationloaddata){

stationID = “1:000013” stationName = “CHARGEPOINT / MAIN 001” Address = “1 Main St, Oakland, California, 94607, United States” stationLoad = 1.1 Port[] =

(stationPortData){

portNumber = “1” userID = None credentialID = None shedState = 0 portLoad = 0.0 allowedLoad = 0.0 percentShed = “0”

}, (stationPortData){

portNumber = “2” userID = “123456” credentialID = “123456789” shedState = 0 portLoad = 1.1 allowedLoad = 0.0 percentShed = “0”

},

}

getOrgsAndStationGroups(**kwargs)[source]

Returns orgnaizations and their station groups.

Get all organization and station group identifiers.

Parameters

**kwargs

any top-level kwarg in the following query. Most frequently queried via stationID.

Query:
(getOrgsAndStationGroupsSearchQuery){

orgID = None organizationName = None sgID = None sgName = None

}

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” orgData[] =

(ohostdata){

orgID = “1:ORG00001” organizationName = “My Organization Name” sgData[] =

(sgData){

sgID = 00001 sgName = “Main St Garage” parentGroupID = “0”

}

getStationGroupDetails(sgID, *stationID)[source]

Gives details for a given station group.

Parameters
  • sgID – groupID of stations to clear.

  • stationID – (Optional) ID of individual station to clear. If this is used, only that station will be

returned in the stationData list. If this parameter is given, numStations will return 1

:returns SOAP reply object. If successful, there will be a responseCode of ‘100’.

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” groupName = “My Group Name” numStations = 1 stationData[] =

(stationGroupData){

stationID = “1:00001” stationName = “CHARGEPOINT / MAIN 001” Address = “1 Main St, Oakland, California, 94607, United States”

}

getStationGroups(orgID)[source]

Returns a list of groups and their stations belonging to an organization.

Parameters

orgID – Chargepoint Organization ID

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” groupData[] =

(groupsdata){

sgID = 00001 orgID = “1:ORG00001” sgName = “Main St Garage” organizationName = “My Organization Name” stationData[] =

(stationData){

stationID = “1:00001” Geo =

(geoData){

Lat = “12.345678901234567” Long = “-123.456789012345678”

}

}

getStationRights(**kwargs)[source]

Returns station rights profiles as defined by the given query parameters.

It is worth noting that there ay be more than one rights profile for a given station. A profile defined the relationship between a charge station and a group and a charge station may belong to multiple groups.

Parameters

**kwargs

any top-level kwarg in the following query. Most frequently queried via stationID.

Query:
(stationRightsSearchRequest){

stationID = None stationManufacturer = None stationModel = None stationName = None serialNumber = None Address = None City = None State = None Country = None postalCode = None Proximity = None proximityUnit = None Connector = None Voltage = None Current = None Power = None demoSerialNumber =

(serialNumberData){

serialNumber[] = <empty>

}

Reservable = None Geo =

(geoData){

Lat = None Long = None

}

Level = None Mode = None Pricing =

(pricingOptions){

startTime = None Duration = None energyRequired = None vehiclePower = None

}

orgID = None organizationName = None sgID = None sgName = None provisionDateRange =

(provisionDateRange){

startDate = None endDate = None

}

currentFault = None portStatus = None adminStatus = None networkStatus = None provisionStatus = None startRecord = None

}

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” rightsData[] =

(rightsData){

sgID = “00001” sgName = “Main St Garage” stationRightsProfile = “network_manager” stationData[] =

(stationDataRights){

stationID = “1:00001” stationName = “CHARGEPOINT / MAIN 001” stationSerialNum = “000000000001” stationMacAddr = “0123:4567:89AB:CDEF”

moreFlag = 0

}

getStationStatus(station)[source]

Get port-level charging status for a given station

Parameters

station – stationID to query

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” stationData[] =

(oStatusdata){ stationID = “1:00001” Port[] =

(portDataStatus){

portNumber = “1” Status = “AVAILABLE” TimeStamp = 2016-12-12 12:34:56+00:00

moreFlag = 0

}

getStations(**kwargs)[source]

Returns a list of Chargepoint Stations based on keyword query args

It is worth noting that only stations the client has access to will be returned.

Parameters

**kwargs

any top-level kwarg in the following query. Most frequently queried via stationID.

Query:
(stationSearchRequestExtended){

stationID = None stationManufacturer = None stationModel = None stationName = None serialNumber = None Address = None City = None State = None Country = None postalCode = None Proximity = None proximityUnit = None Connector = None Voltage = None Current = None Power = None demoSerialNumber =

(serialNumberData){

serialNumber[] = <empty>

}

Reservable = None Geo =

(geoData){

Lat = None Long = None

}

Level = None Mode = None Pricing =

(pricingOptions){

startTime = None Duration = None energyRequired = None vehiclePower = None

}

orgID = None organizationName = None sgID = None sgName = None stationActivationDate = None startRecord = None numStations = None

}

Reply:
(reply){

responseCode = “100” responseText = “API input request executed successfully.” stationData[] =

(stationDataExtended){

stationID = “1:00001” stationManufacturer = “ChargePoint” stationModel = “CT2100-HD-CCR” stationMacAddr = “0123:4567:89AB:CDEF” stationSerialNum = “000000000001” stationActivationDate = 2016-01-01 12:23:45 Address = “1 Main St ” City = “Oakland” State = “California” Country = “United States” postalCode = “94607” Port[] =

(portData){

portNumber = “1” stationName = “CHARGEPOINT / MAIN 001” Geo =

(geoData){

Lat = “12.345678901234567” Long = “-123.456789012345678”

}

Description = “Use garage entrance on Main St., turn right and follow … Reservable = 0 Level = “L1” Connector = “NEMA 5-20R” Voltage = “120” Current = “16” Power = “1.920” estimatedCost = 0.0

Pricing[] =
(pricingSpecification){

Type = “None” startTime = 00:00:00 endTime = 23:59:59 minPrice = 0.0 maxPrice = 0.0 unitPricePerHour = 0.0 unitPricePerSession = 1.0 unitPricePerKWh = 0.2

},

numPorts = 2 mainPhone = “1-888-123-4567” currencyCode = “USD” orgID = “1:ORG00001” organizationName = “My Organization Name” sgID = “00001, 00002, 00003, 00004, 00005, 00006, 00007, 00008, 00009, … sgName = “Main St Garage, Public Garages, California Stations, …

moreFlag = 0

}

getUsers(**kwargs)[source]

Returns a list of Users as defined by the given query parameters

Parameters

**kwargs

any top-level kwarg in the following query. Most frequently queried via userID or credentialID.

Query:
(getUsersSearchRequest){

userID = None firstName = None lastName = None lastModifiedTimeStamp = None Connection =

(connectionDataRequest){
Status =
(connectedUserStatusTypes){

value = None

}

customInfo =
(customInfoData){

Key = None Value = None

}

}

managementRealm =
(managementRealmRequest){
Status =
(managedUserStatusTypes){

value = None

}

customInfo =
(customInfoData){

Key = None Value = None

}

}

credentialID = None startRecord = None numUsers = None

}

Reply
(reply){

responseCode = “100” responseText = “API input request executed successfully.” users =

(userParams){
user[] =
(userData){

lastModifiedTimestamp = 2016-11-11 01:23:45+00:00 userID = “123456” firstName = “John” lastName = “Doe” Connection =

(connectionData){

Status = “APPROVED” requestTimeStamp = 2016-11-11 01:23:45+00:00 customInfos =

(customInfosData){
customInfo[] =
(customInfoData){

Key = “Custom Key” Value = “Custom Value”

}

}

managementRealm = “” credentialIDs =

(credentialIDsData){
credentialID[] =

“123456789”, …

}

recordNumber = 1

moreFlag = 0

}

}

set_client(client)[source]
set_security_token()[source]
shedLoad(**kwargs)[source]

Reduce load on a Charegepoint station.

Main functionality for reducing load on a chargepoint station. Can pass either allowedLoadPerStation OR percentShedPerStation, but not both (one must be None).

Parameters

**kwargs

Input parameters for shedding load. One of allowedLoadPerStation and percentshedPerStation

must be included.

Query:
(shedLoadQueryInputData){
shedGroup =
(shedLoadGroupInputData){

sgID = None allowedLoadPerStation = None percentShedPerStation = None

}

shedStation =
(shedLoadStationInputData){

stationID = None allowedLoadPerStation = None percentShedPerStation = None Ports =

(Ports){

Port[] = <empty>

}

}

timeInterval = None

}

:returns SOAP reply object. If successful, there will be a responseCode of ‘100’.

class platform_driver.interfaces.chargepoint.service.CPStation(cps, sld=None, sde=None)[source]

Bases: object

Wrapper around the getStations() return by Chargepoint API.

Data surrounding a Chargepoint Station can generally be categorized as static or dynamic. Chargepoint API has two basic calls, getLoad and getStation, that each return station data. getLoad returns the stationLoadData SUDS object, and getStation returns the stationDataExtended SUDS object. These are each kept as separate meta-data parameters.

Parameters
  • cps – Chargepoint Service object.

  • sld – stationLoadData SUDS object.

  • sde – stationDataExtended SUDS object.

(stationDataExtended){

stationID = “1:00001” stationManufacturer = “ChargePoint” stationModel = “CT2100-HD-CDMA-CCR” stationMacAddr = “0123:4567:89AB:CDEF” stationSerialNum = “000000000001” stationActivationDate = 2016-01-01 12:23:45 Address = “1 Main St ” City = “Oakland” State = “California” Country = “United States” postalCode = “94607” Port[] =

(portData){

portNumber = “1” stationName = “CHARGEPOINT / MAIN 001” Geo =

(geoData){

Lat = “12.345678901234567” Long = “-123.456789012345678”

}

Description = “Use garage entrance on Main St., turn right and follow … Reservable = 0 Level = “L1” Connector = “NEMA 5-20R” Voltage = “120” Current = “16” Power = “1.920” estimatedCost = 0.0

}, (portData){

portNumber = “2” stationName = “CHARGEPOINT / MAIN 001” Geo =

(geoData){

Lat = “12.345678901234567” Long = “-123.456789012345678”

}

Description = “Use garage entrance on Main St., turn right and follow … Reservable = 0 Level = “L2” Connector = “J1772” Voltage = “240” Current = “30” Power = “6.600” estimatedCost = 0.0

},

Pricing[] =
(pricingSpecification){

Type = “None” startTime = 00:00:00 endTime = 23:59:59 minPrice = 0.0 maxPrice = 0.0 unitPricePerHour = 0.0 unitPricePerSession = 1.0 unitPricePerKWh = 0.2

},

numPorts = 2 mainPhone = “1-888-123-4567” currencyCode = “USD” orgID = “1:ORG00001” organizationName = “My Organization Name” sgID = “00001, 00002, 00003, 00004, 00005, 00006, 00007, 00008, 00009, … sgName = “Main St Garage, Public Garages, California Stations, …

}

(stationloaddata){

stationID = “1:00001” stationName = “CHARGEPOINT / MAIN 001” Address = “1 Main St, Oakland, California, 94607, United States” stationLoad = 5.43 Port[] =

(stationPortData){

portNumber = “1” userID = None credentialID = None shedState = 0 portLoad = 0.0 allowedLoad = 0.0 percentShed = “0”

}, (stationPortData){

portNumber = “2” credentialID = “ABC000123456” shedState = 0 portLoad = 5.43 allowedLoad = 0.0 percentShed = “0”

},

}

Property id

sde.stationID

Property manufacturer

sde.stationManufacturer

Property model

sde.stationModel

Property mac

sde.stationMacAddr

Property serial

sde.stationSerialNum

Property activationDate

sde.stationActivationDate

Property name

sld.stationName

Property load

sld.stationLoad

property activationDate
property id
property load
property mac
property manufacturer
property model
property name
property organization
property ports
refreshStationData()[source]
refreshStationDataExtended()[source]
property serial
class platform_driver.interfaces.chargepoint.service.CPStationGroup(cps, groupsdata)[source]

Bases: object

Wrapper around the getStationGroups() return by Chargepoint API.

Parameters
  • cps – Chargepoint Service object.

  • groupsdata – Returned from Chargepoint API. Defined below.

(groupsdata){

sgID = 00001 orgID = “1:ORG00001” sgName = “Main St Garage” organizationName = “My Organization Name” stationData[] =

(stationData){

stationID = “1:00001” Geo =

(geoData){

Lat = “12.345678901234567” Long = “-123.456789012345678”

}

}

Property id

sgID

Property name

sgName

Property organization

CPOrganization __str__ representation

Property station_ids

List of IDs for stations in belonging to the group

property id
property name
property organization
property station_ids