Dashboard of EV Goals

Dashboard of EV Goals

Feb 16, 2024    

Like many tech bros before me, I have bought an electric car. I’d love to tell you it was because of potential cost savings or concern for the environment, but I mostly switched because I thought it was cool. Doing my research before buying this car, the echo chamber of economic pundits may convince you one or both of the following are true:

  • sales have slowed down and the automakers need to make more affordable EVs
  • the public charging infrastructure in the US needs to improve before range anxiety stops being a factor

While I was able to use a generous $7500 point of sale tax incentive for my leased Mustang Mach-E, and I expect I’ll get $1000 back from DC government to help pay for the addition of the Level 2 at home, these are still luxury cars when purchased new.

Now that I have the car, I ran some numbers and created a dashboard in Kibana Canvas to track my progress towards making back the improvements to my house with savings.

  • $4500 - Cost of adding an L2 J-1772 charger

The project was more expensive because we had to pull permits and dig a 50-foot trench through my back garden to bury conduit for a 60A line to my detached back parking pad.

  • $0.16997 - Cost of a kWh from my home utility provider
  • $0.0 - Cost of a kWh when parking at work, which I do once or twice a week
  • $0.69 - Cost of a kWh at my nearest DC fast charger (EvGo) without a membership
  • $0.55 - Cost of a kWh at the same DC fast charger with a $7 monthly membership

I didn’t put a lot of miles on my car, but the Jeep I just got out of did the EPA-rated 21 mpg and my gas cost about $3.80 averaged out over the year. Thats $0.181 a mile for team internal combustion engine.

According to the EPA, the Mustang uses an EPA-rated 41 kWh / 100 mi. If I get all those kWh’s from my home utility provider this very sporty electric cross-over SUV gets $0.070 a mile.

However, energy is going to cost me more on road trips. As long as nothing changes with my work or office location. On the other hand, I can charge my car for free at work. As long as my work situation doesn’t change and I can there early enough to get a coveted spot at one of the six free EV chargers. The ratio of free, to home, to road trip energy cost is something I’d like to track to see if I can hit the energy savings break-even point.

Even if I get all my energy at work, compared to the cost of gas it will take me at least 19,337 miles of driving to earn back the $4500 assuming I also successfully get back the full $1000 DC tax incentive for adding the residential charger.

Now in an ideal world, I’d rig APIs somehow to get the charging data automatically, but that’s not possible on a Ford and too complicated using the multitude of competing DC fast charging companies. It’s manual, but I created a way to log my data all in one place using the forms feature of my N8N home server.

data entry form
The fields are mostly optional

The python code to do some extra math

# Loop over input items and add a new field called 'myNewField' to the JSON of each one
for item in _input.all():

  location = item.json["Where"]
  kWhAdded = item.json["kWh added"]
  altPercentToPercent = item.json["alt. percent to percent"]
  minutes = item.json["minutes"]
  chargeSpeed = item.json["charge speed kW"]
  costObserved = item.json["cost observed"]
  dateOfCharge = item.json["dateOfCharge"]
  submittedAt = item.json["submittedAt"]

  del item.json["Where"]
  del item.json["kWh added"]
  del item.json["alt. percent to percent"]
  del item.json["minutes"]
  del item.json["charge speed kW"]
  del item.json["cost observed"]
  del item.json["dateOfCharge"]


  if costObserved > 0 :
    item.json.costComputed = float(costObserved)
  if location == "Home" and costObserved == 0 :
    if kWhAdded > 0 :
      item.json.costComputed = float(kWhAdded * 0.16997)
  if costObserved == 0 and location != "Home" :
    item.json.costComputed = float(0.0)
    

  if chargeSpeed == 0 and minutes > 0 and kWhAdded > 0 :
    chargeSpeed = (kWhAdded / (minutes/60.0))


  if (not dateOfCharge) or dateOfCharge == "" :
    dateOfCharge = submittedAt[:10]

  item.json.location = location
  item.json.kWhAdded = float(kWhAdded)
  item.json.percentToPecentNote = altPercentToPercent
  item.json.minutes = minutes
  item.json.chargeSpeed = float(chargeSpeed)
  item.json.costObserved = float(costObserved)
  item.json.dateOfCharge = dateOfCharge

return _input.all()
the n8n flow
the N8N data workflow, I compute costs and speeds in the script

From there I make sure the Elasticsearch index is correctly set up to treat my numeric values as floats rather than integers so that I don’t lose the decimal places. If the first entry has a zero value in it for cost automatic schema detection can cause problems.

PUT /n8ncarchageform

PUT /n8ncarchageform/_mapping
{
  "properties": {
        "chargeSpeed": {
          "type": "float"
        },
        "costComputed": {
          "type": "float"
        },
        "costObserved": {
          "type": "float"
        },
        "dateOfCharge": {
          "type": "date"
        }
  }
}

Rather than a Kibana Dashboard I decided to make a pretty Canvas dashboard

Canvas dashboard
Here's my Canvas dashboard

The progress bar math is just Elasticsearch SQL, which is a nice way to do simple computations.

  • 1000 : the money I already expect from the tax rebate
  • sum(kWhAdded) : the kWh I put into my Mustang as logged in N8N
  • 100 / 41 : the conversion from kWh to miles
  • 21.0 * 3.8 : what those miles would have cost me on the Jeep
  • sum(costComputed) : what the energy cost me
  • 4500 : what I need to regain to break even on my project
SELECT (
    1000 + 
    (sum(kWhAdded) * 100.0 / 41.0 / 21.0 * 3.8)
     - sum(costComputed)
) / 4500.0   as remain  

FROM "n8ncarchageform"  

I can then save a Chrome tab to open when I start my browser each day adding the following to the end of the URL for anonymous access and full-screen mode

?auth_provider_hint=anonymous1&__fullScreen=true

Creating a role for anonymous access to an Anon space in Kibana is a bit of an advanced topic. I found this discussion thread on the Elastic community forum to have the best guide: https://discuss.elastic.co/t/anonymous-kibana-users/270071/18

I’ll see you in 20 thousand miles.