Monitoring a fleet of Tesla’s fully electric sedans with Nagios came up in conversation the other day in the office, and the idea was quite intriguing, so I set out to see just what would be required to pull off such a feat.

After a few minutes I came across the unofficial documentation of the Tesla Model S JSON API and was quite impressed what was already available.  Based on the documentation I deduced that once we convinced the people at Tesla Motors to send us a demo Model S to do some testing we should be able create an wizard for Nagios XI that can login to the Tesla system and get a list of vehicles that need to be monitored.  And there is a ton of interesting information available.

Now we can start monitoring the following for each vehicle:

  • Mobile Access
  • Charge State
    {
        "charging_state": "Complete",  // "Charging", ??
        "charge_to_max_range": false,  // current std/max-range setting
        "max_range_charge_counter": 0,
        "fast_charger_present": false, // connected to Supercharger?
        "battery_range": 239.02,       // rated miles
        "est_battery_range": 155.79,   // range estimated from recent driving
        "ideal_battery_range": 275.09, // ideal miles
        "battery_level": 91,           // integer charge percentage
        "battery_current": -0.6,       // current flowing into battery
        "charge_starting_range": null,
        "charge_starting_soc": null,
        "charger_voltage": 0,          // only has value while charging
        "charger_pilot_current": 40,   // max current allowed by charger & adapter
        "charger_actual_current": 0,   // current actually being drawn
        "charger_power": 0,            // kW (rounded down) of charger
        "time_to_full_charge": null,   // valid only while charging
        "charge_rate": -1.0,           // float mi/hr charging or -1 if not charging
        "charge_port_door_open": true
    }
  • Climate Settings
    {
        "inside_temp": 17.0,          // degC inside car
        "outside_temp": 9.5,          // degC outside car or null
        "driver_temp_setting": 22.6,  // degC of driver temperature setpoint
        "passenger_temp_setting": 22.6, // degC of passenger temperature setpoint
        "is_auto_conditioning_on": false, // apparently even if on
        "is_front_defroster_on": null, // null or boolean as integer?
        "is_rear_defroster_on": false,
        "fan_status": 0               // fan speed 0-6 or null
      }
  • Driving and Position
    {
        "shift_state": null,          //
        "speed": null,                //
        "latitude": 33.794839,        // degrees N of equator
        "longitude": -84.401593,      // degrees W of the prime meridian
        "heading": 4,                 // integer compass heading, 0-359
        "gps_as_of": 1359863204       // Unix timestamp of GPS fix
      }
  • GUI Settings
    {
        "gui_distance_units": "mi/hr",
        "gui_temperature_units": "F",
        "gui_charge_rate_units": "mi/hr",
        "gui_24_hour_time": false,
        "gui_range_display": "Rated"
      }
  • Vehicle State
    {
        "df": false,                  // driver's side front door open
        "dr": false,                  // driver's side rear door open
        "pf": false,                  // passenger's side front door open
        "pr": false,                  // passenger's side rear door open
        "ft": false,                  // front trunk is open
        "rt": false,                  // rear trunk is open
        "car_verson": "1.19.42",      // car firmware version
        "locked": true,               // car is locked
        "sun_roof_installed": false,  // panoramic roof is installed
        "sun_roof_state": "unknown",
        "sun_roof_percent_open": 0,   // null if not installed
        "dark_rims": false,           // gray rims installed
        "wheel_type": "Base19",       // wheel type installed
        "has_spoiler": false,         // spoiler is installed
        "roof_color": "Colored",      // "None" for panoramic roof
        "perf_config": "Base"
      }

After digging in a little further, the real fun begins, as the following items would be what in Nagios terms we could use as event handlers, to take an action on any of the vehicles in the fleet we are monitoring.

  • Wake Up Car
  • Set Valet Mode
  • Reset Valet PIN
  • Open Charge Port
  • Set Charge Limit to Standard
  • Set Charge Limit to Max Range
  • Set Charge Limit
  • Start Charging
  • Stop Charging
  • Flash Lights
  • Honk Horn
  • Unlock Doors
  • Lock Doors
  • Set Temperature
  • Start HVAC System
  • Stop HVAC System
  • Move Pano Roof
  • Remote Start

 

I must say, it looks like a ton of fun, and there is some great information in there.  Collecting these metrics with software like Nagios XI would be quite useful for fleet operators, they would have all the detail about where each vehicle is in the fleet and it’s current status.

@TeslaMotors or @elonmusk send a demo Model S, and I promise this will be built!