For demandshaper to be useful for EV charge scheduling the demand shaper ideally… needs to know the current SOC (state of charge of an EV). Unfortunately it's not possible to obtain SOC data via the J1772 EV charging protocol.
Various EV's have different proprietary API's retrieve SOC. The API's are often unpublished and reverse engineered. We will try and add support for all EV's (starting the Tesla). However, as a first implementation we have tested integrating with [OVMS](https://openvehicles.com) (Open vehicle Monitoring system). OVMS is an open-source hardware/software telematics platform that supports many types of EV's and is totally independent to the manufacturer.
[See OVMS user guide](https://docs.google.com/document/d/16JrXR7rybp-18DrEoeh1rg6GqQT_jVBvhaXh2oEWRHw)
Data can be retrieved from OVMS via their mobile app, MQTT or HTTP rest API (if using dexters-web OVMS server, default in Europe). See issue https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/issues/178
Here is an example API call to retrieve OVMS data:
`https://dexters-web.de/api/call?fn.name=ovms/export&fn.vehicleid=XXXXXX&fn.carpass=XXXXX&fn.format=csv&fn.types=D,S&fn.last=1`
Example responce:
```
#FILE,d.csv
rec_time,0,doors1,doors2,lockunlock,tpem,tmotor,tbattery,trip,odometer,speed,parktimer,ambient,doors3,staletemps,staleambient,vehicle12v,doors4,vehicle12v_ref,doors5,tcharger,vehicle12v_current
2019-03-13 17:44:08,0,192,0,5,11,0,12,0,434390,0,0,11,0,1,1,14.41,0,12.6,0,0,0,18
#FILE,s.csv
rec_time,0,soc,units,linevoltage,chargecurrent,chargestate,chargemode,idealrange,estimatedrange,chargelimit,chargeduration,chargeb4,chargekwh,chargesubstate,chargestateN,chargemodeN,chargetimer,chargestarttime,chargetimerstale,cac100,charge_etr_full,charge_etr_limit,charge_limit_range,charge_limit_soc,cooldown_active,cooldown_tbattery,cooldown_timelimit,charge_estimate,charge_etr_range,charge_etr_soc,idealrange_max,chargetype,chargepower,battvoltage,soh
2019-03-13 17:44:08,0,28.0,M,0,0,stopped,standard,24,0,0,0,0,0,13,21,0,0,0,0,57.22,0,0,0,0,-1,0,0,0,0,0,0,0,0.00,368.50,86
```
| rec_time | 0 | soc | units | linevoltage | chargecurrent | chargestate | chargemode | idealrange | estimatedrange | chargelimit | chargeduration | chargeb4 | chargekwh | chargesubstate | chargestateN | chargemodeN | chargetimer | chargestarttime | chargetimerstale | cac100 | charge_etr_full | charge_etr_limit | charge_limit_range | charge_limit_soc | cooldown_active | cooldown_tbattery | cooldown_timelimit | charge_estimate | charge_etr_range | charge_etr_soc | idealrange_max | chargetype | chargepower | battvoltage | soh |
|----------|---|------|-------|-------------|---------------|-------------|------------|------------|----------------|-------------|----------------|----------|-----------|----------------|--------------|-------------|-------------|-----------------|------------------|--------|-----------------|------------------|--------------------|------------------|-----------------|-------------------|--------------------|-----------------|------------------|----------------|----------------|------------|-------------|-------------|-----|
| 17:44:08 | 0 | 28.0 | M | 0 | 0 | stopped | standard | 24 | 0 | 0 | 0 | 0 | 0 | 13 | 21 | 0 | 0 | 0 | 0 | 57.22 | 0 | 0 | 0 | 0 | -1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00 | 368.50 | 86 |
| rec_time | 0 | doors1 | doors2 | lockunlock | tpem | tmotor | tbattery | trip | odometer | speed | parktimer | ambient | doors3 | staletemps | staleambient | vehicle12v | doors4 | vehicle12v_ref | doors5 | tcharger | vehicle12v_current | |
|---------------------|---|--------|--------|------------|------|--------|----------|------|----------|-------|-----------|---------|--------|------------|--------------|------------|--------|----------------|--------|----------|--------------------|----|
| 2019-03-13 17:44:08 | 0 | 192 | 0 | 5 | 11 | 0 | 12 | 0 | 434390 | 0 | 0 | 11 | 0 | 1 | 1 | 14.41 | 0 | 12.6 | 0 | 0 | 0 | 18 |