From b1f1b9174e37369a10b5590da2cfcb798b205e51 Mon Sep 17 00:00:00 2001 From: livehybrid Date: Wed, 2 Nov 2022 16:49:08 +0000 Subject: [PATCH] Uplift to v1.1.0 --- README.md | 729 ++++++++++++++++++++----------------- globalConfig.json | 905 ++++++++++++++++++++++++++++++++-------------- 2 files changed, 1039 insertions(+), 595 deletions(-) diff --git a/README.md b/README.md index 652fc9b..3b21a68 100644 --- a/README.md +++ b/README.md @@ -1,364 +1,427 @@ -![Splunkbase Downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fsplunkbasebadge.livehybrid.com%2Fv1%2Fdownloads%2F4660?1) ![Splunkbase Installs](https://img.shields.io/endpoint?url=https%3A%2F%2Fsplunkbasebadge.livehybrid.com%2Fv1%2Finstalls%2F4660?1) ![Splunkbase AppInspect](https://img.shields.io/endpoint?url=https%3A%2F%2Fsplunkbasebadge.livehybrid.com%2Fv1%2Fappinspect%2F4660?1) ![Splunkbase Compatibility](https://img.shields.io/endpoint?url=https%3A%2F%2Fsplunkbasebadge.livehybrid.com%2Fv1%2Flatest_compat%2F4660) +![Splunkbase Downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fsplunkbasebadge.livehybrid.com%2Fv1%2Fdownloads%2F4660?1) ![Splunkbase AppInspect](https://img.shields.io/endpoint?url=https%3A%2F%2Fsplunkbasebadge.livehybrid.com%2Fv1%2Fappinspect%2F4660?1) ![Splunkbase Compatibility](https://img.shields.io/endpoint?url=https%3A%2F%2Fsplunkbasebadge.livehybrid.com%2Fv1%2Flatest_compat%2F4660) # Introduction This app collects data from the Tesla owners API. Can be configured for multiple vehicles and accounts - Perfect for visualising your usage, or fleets of cars. -After installing the app, please go to the app's Configuration page and enter the API Key/Secret key which can be found at https://akrion.docs.apiary.io/#reference/authentication +Note: The Car/Charging data collection require your Tesla to be awake, if vehicle is not awake the API returns a HTTP 408 with "Vehicle Unavailable". The script will not wake the vehicle, *however* if the vehicle is awake then running the script may keep it awake. This can cause "Phantom Drain" as various car computer systems remain online. -Note: The Car/Charging data collection require your Tesla to be awake, if vehicle is not awake the API returns a HTTP 408 with "Vehicle Unavailable". The script will not wake the vehicle, *however* if the vehicle is awake then running the script may keep it awake. This can cause "Phantom Drain" as various car computer systems remain online. +## What's in the box? +### Configuration -## Whats in the App? -* Input - List Cars in Tesla Account -* Input - Collect data on availability of nearest Superchargers -* Input - Collect data from the car (incl Mileage, Charging, Climate - see below for more info) -* Sample Dashboards - Historic Journeys/Charging, current status, driving efficiency over time. +### Inputs +The app contains 5 modular inputs which can be used for pulling data from the Tesla API relating to your vehicle(s): +1. **Vehicle Data Collector** - This collects a wealth of data from the vehicle API, such as charge state, vehicle state, vehicle configurations and more. See the sample data below for more info. +2. **Vehicle List** - A list of vehicles in your account, this was originally helpful for detecting your vehicle ID for use in other inputs, but does show other helpful information such as if the vehicle is online. +3. **Nearby SuperCharger Stats** - This returns the Supercharger and Destination chargers that are displayed within the Tesla App, along with availability (where possible), helpful for determining when chargers nearby are quiet/busy. +4. **Token Refresher** - This critical component refreshes the *access_token* and stores it for use by other components. Run one of these per Account configured. +5. **GraphQL Supercharger data collection** - This returns information from Tesla's GraphQL API service and shows the availability and further information about Superchargers which are open for [Non-Tesla charging](https://www.tesla.com/en_GB/support/non-tesla-supercharging), currently being pilotted in selected UK and European locations. -# Data Retrieved +### Dashboards +1. Tesla Car Overview (/en-US/app/TA-tesla-data/tesla_car) +2. Tesla - Non-Tesla Capable Superchargers (/en-US/app/TA-tesla-data/tesla_nontes_supercharging) -## List Vehicles Data -Returns a *list* of cars in your account. -You will need the `id_s` value for setting up the Car data collector. +## Recommended additional apps: +* [Maps+ for Splunk](https://splunkbase.splunk.com/app/3124) +* [Location Tracker - Custom Visualization](https://splunkbase.splunk.com/app/3164) -``` -[{ - "id": , - "vehicle_id": , - "vin": "", - "display_name": "MyTeslasName", - "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", - "color": null, - "access_type": "OWNER", - "tokens": ["", ""], - "state": "asleep", - "in_service": false, - "id_s": "", - "calendar_enabled": true, - "api_version": 14, - "backseat_token": null, - "backseat_token_updated_at": null, - "vehicle_config": null -}] -``` +These apps are used to display location visualisations on the Car overview and Supercharger dashboards. + +## Configuration +The first thing you will need to do is head over to the configuration page and hit the **green** "Add" button to setup access to your Tesla account. + +You need to give your Tesla account a unique name and add your *refresh* and *access* token. Strictly speaking you do not need to add the access token, as this can be retrieved with the `Token Refresher` modinput but it will speed up your setup to include it here. These tokens are [stored securely](https://www.splunk.com/en_us/blog/tips-and-tricks/store-encrypted-secrets-in-a-splunk-app.html) on your Splunk instance. + +**Wait, how do I find my Tesla authentication tokens?** +The easiest way to get your authentication tokens is using an app (below), but can also be extracted [other ways](https://tesla-info.com/tesla-token.php). + +### Auth Token apps: -## Car Data -```{ - "response": { - "id": , - "user_id": , - "vehicle_id": , - "vin": "", - "display_name": "MyTeslasName", - "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", - "color": null, - "access_type": "OWNER", - "tokens": ["", ""], - "state": "online", - "in_service": false, - "id_s": "", - "calendar_enabled": true, - "api_version": 14, - "backseat_token": null, - "backseat_token_updated_at": null, - "vehicle_config": { - "can_accept_navigation_requests": true, - "can_actuate_trunks": true, - "car_special_type": "base", - "car_type": "model3", - "charge_port_type": "CCS", - "default_charge_to_max": false, - "ece_restrictions": true, - "eu_vehicle": true, - "exterior_color": "DeepBlue", - "exterior_trim": "Chrome", - "has_air_suspension": false, - "has_ludicrous_mode": false, - "key_version": 2, - "motorized_charge_port": true, - "plg": false, - "rear_seat_heaters": 1, - "rear_seat_type": null, - "rhd": true, - "roof_color": "Glass", - "seat_type": null, - "spoiler_type": "Passive", - "sun_roof_installed": null, - "third_row_seats": "", - "timestamp": 1610786032732, - "use_range_badging": true, - "wheel_type": "Stiletto20" - }, - "charge_state": { - "battery_heater_on": false, - "battery_level": 61, - "battery_range": 164.52, - "charge_current_request": 16, - "charge_current_request_max": 16, - "charge_enable_request": true, - "charge_energy_added": 3.77, - "charge_limit_soc": 90, - "charge_limit_soc_max": 100, - "charge_limit_soc_min": 50, - "charge_limit_soc_std": 90, - "charge_miles_added_ideal": 15.5, - "charge_miles_added_rated": 15.5, - "charge_port_cold_weather_mode": false, - "charge_port_door_open": false, - "charge_port_latch": "Engaged", - "charge_rate": 0.0, - "charge_to_max_range": false, - "charger_actual_current": 0, - "charger_phases": null, - "charger_pilot_current": 16, - "charger_power": 0, - "charger_voltage": 1, - "charging_state": "Disconnected", - "conn_charge_cable": "", - "est_battery_range": 86.96, - "fast_charger_brand": "", - "fast_charger_present": false, - "fast_charger_type": "", - "ideal_battery_range": 164.52, - "managed_charging_active": false, - "managed_charging_start_time": null, - "managed_charging_user_canceled": false, - "max_range_charge_counter": 0, - "minutes_to_full_charge": 0, - "not_enough_power_to_heat": null, - "scheduled_charging_pending": false, - "scheduled_charging_start_time": null, - "time_to_full_charge": 0.0, - "timestamp": 1610786032732, - "trip_charging": false, - "usable_battery_level": 56, - "user_charge_enable_request": null - }, - "climate_state": { - "battery_heater": false, - "battery_heater_no_power": null, - "climate_keeper_mode": "off", - "defrost_mode": 0, - "driver_temp_setting": 20.0, - "fan_status": 0, - "inside_temp": 0.3, - "is_auto_conditioning_on": false, - "is_climate_on": false, - "is_front_defroster_on": false, - "is_preconditioning": false, - "is_rear_defroster_on": false, - "left_temp_direction": 1009, - "max_avail_temp": 28.0, - "min_avail_temp": 15.0, - "outside_temp": 0.5, - "passenger_temp_setting": 20.0, - "remote_heater_control_enabled": false, - "right_temp_direction": 1009, - "seat_heater_left": 0, - "seat_heater_rear_center": 0, - "seat_heater_rear_left": 0, - "seat_heater_rear_right": 0, - "seat_heater_right": 0, - "side_mirror_heaters": false, - "timestamp": 1610786032732, - "wiper_blade_heater": false - }, - "drive_state": { - "gps_as_of": 1610785841, - "heading": 304, - "latitude": , - "longitude": , - "native_latitude": , - "native_location_supported": 1, - "native_longitude": , - "native_type": "wgs", - "power": 0, - "shift_state": null, - "speed": null, - "timestamp": 1610786032732 - }, - "gui_settings": { - "gui_24_hour_time": true, - "gui_charge_rate_units": "kW", - "gui_distance_units": "mi/hr", - "gui_range_display": "Rated", - "gui_temperature_units": "C", - "show_range_units": false, - "timestamp": 1610786032732 - }, - "vehicle_state": { - "api_version": 14, - "autopark_state_v2": "unavailable", - "calendar_supported": true, - "car_version": "2020.48.30 040912887bad", - "center_display_state": 0, - "df": 0, - "dr": 0, - "fd_window": 0, - "fp_window": 0, - "ft": 0, - "is_user_present": false, - "locked": true, - "media_state": { - "remote_control_enabled": true - }, - "notifications_supported": true, - "odometer": 10972.046274, - "parsed_calendar_supported": true, - "pf": 0, - "pr": 0, - "rd_window": 0, - "remote_start": false, - "remote_start_enabled": true, - "remote_start_supported": true, - "rp_window": 0, - "rt": 0, - "sentry_mode": false, - "sentry_mode_available": true, - "software_update": { - "download_perc": 0, - "expected_duration_sec": 2700, - "install_perc": 1, - "status": "", - "version": "2020.48.30" - }, - "speed_limit_mode": { - "active": false, - "current_limit_mph": 50.0, - "max_limit_mph": 90, - "min_limit_mph": 50, - "pin_code_set": true - }, - "timestamp": 1610786032732, - "valet_mode": false, - "vehicle_name": "MyTeslasName" - } - } +[Auth app for Tesla (iOS, macOS)](https://apps.apple.com/us/app/auth-app-for-tesla/id1552058613) +[Tesla Tokens (Android)](https://play.google.com/store/apps/details?id=net.leveugle.teslatokens) +[Tesla Auth (macOS, Linux, Windows)](https://github.com/adriankumpf/tesla_auth) + +## Setup Inputs +Go to the Inputs page to setup your data collectors. + +**Important** - The Token Refresher input should be setup first in order to ensure that your *access_token* is updated and available for use by the other inputs. Typically tokens last for 8 hours but the default refresh interval is set to 1 hour in the Splunk input config. + +Most of the inputs configuration is straight forward, the "Vehicle Data Collector" and "Nearby SuperCharger Stats" requires you to enter your Vehicle ID, however after selecting your Tesla account from the dropdown the modal will update with a dropdown list of your vehicles using the API to populate the list, making it simple to select your vehicle and continue. + +The "GraphQL Supercharger data collection" inputs require additional parameters, the Center point is typically what is used as your "current location" (or the center of the area you want to search), the North-West is the top-left of a square area you want to cover, and South-East is the bottom-right of the square area to cover. The value of these fields should be `lat,long`, comma-separated with no space. +Two example inputs for the UK and Europe have been configured but need updating to select your Tesla Account for authentication. + +# Data Retrieved + +## "Vehicle Data Collector" +## tesla:vehicle:vehicle_state +```json +{ + account: MyTeslaAccountName + api_version: 45 + autopark_state_v2: unavailable + calendar_supported: true + car_version: 2022.28.1 f69f4df0ff1f + center_display_state: 0 + dashcam_clip_save_available: true + dashcam_state: Recording + df: 0 + dr: 0 + fd_window: 0 + feature_bitmask: b9ff,0 + fp_window: 0 + ft: 0 + is_user_present: false + locked: true + media_state: { + remote_control_enabled: true + } + notifications_supported: true + odometer: 23648.004545 + parsed_calendar_supported: true + pf: 0 + pr: 0 + rd_window: 0 + remote_start: false + remote_start_enabled: true + remote_start_supported: true + rp_window: 0 + rt: 0 + santa_mode: 0 + sentry_mode: true + sentry_mode_available: true + service_mode: false + service_mode_plus: false + software_update: { + download_perc: 100 + expected_duration_sec: 1500 + install_perc: 10 + status: available + version: 2022.36.6 } + speed_limit_mode: { + active: false + current_limit_mph: 50 + max_limit_mph: 120 + min_limit_mph: 50 + pin_code_set: true + } + timestamp: 1667383461962 + tpms_hard_warning_fl: false + tpms_hard_warning_fr: false + tpms_hard_warning_rl: false + tpms_hard_warning_rr: false + tpms_last_seen_pressure_time_fl: 1667381602 + tpms_last_seen_pressure_time_fr: 1667381606 + tpms_last_seen_pressure_time_rl: 1667381606 + tpms_last_seen_pressure_time_rr: 1667381606 + tpms_pressure_fl: 2.525 + tpms_pressure_fr: 2.55 + tpms_pressure_rl: 2.7 + tpms_pressure_rr: 2.625 + tpms_rcp_front_value: 2.9 + tpms_rcp_rear_value: 2.9 + tpms_soft_warning_fl: false + tpms_soft_warning_fr: false + tpms_soft_warning_rl: false + tpms_soft_warning_rr: false + valet_mode: false + valet_pin_needed: true + vehicle: 12345678910111213 + vehicle_name: MyCarsName + vehicle_self_test_progress: 0 + vehicle_self_test_requested: false + webcam_available: true +} +``` + +## tesla:vehicle:charge_state +```json +{ + account: MyTeslaAccountName + battery_heater_on: false + battery_level: 69 + battery_range: 198.31 + charge_amps: 16 + charge_current_request: 16 + charge_current_request_max: 16 + charge_enable_request: true + charge_energy_added: 15.5 + charge_limit_soc: 70 + charge_limit_soc_max: 100 + charge_limit_soc_min: 50 + charge_limit_soc_std: 90 + charge_miles_added_ideal: 63.5 + charge_miles_added_rated: 63.5 + charge_port_cold_weather_mode: false + charge_port_color: + charge_port_door_open: false + charge_port_latch: Engaged + charge_rate: 0 + charge_to_max_range: false + charger_actual_current: 0 + charger_phases: null + charger_pilot_current: 16 + charger_power: 0 + charger_voltage: 2 + charging_state: Disconnected + conn_charge_cable: + est_battery_range: 110.31 + fast_charger_brand: + fast_charger_present: false + fast_charger_type: + ideal_battery_range: 198.31 + managed_charging_active: false + managed_charging_start_time: null + managed_charging_user_canceled: false + max_range_charge_counter: 0 + minutes_to_full_charge: 0 + not_enough_power_to_heat: null + off_peak_charging_enabled: false + off_peak_charging_times: all_week + off_peak_hours_end_time: 360 + preconditioning_enabled: false + preconditioning_times: all_week + scheduled_charging_mode: Off + scheduled_charging_pending: false + scheduled_charging_start_time: null + scheduled_charging_start_time_app: 0 + scheduled_departure_time: 1603958400 + scheduled_departure_time_minutes: 480 + supercharger_session_trip_planner: false + time_to_full_charge: 0 + timestamp: 1667383041781 + trip_charging: false + usable_battery_level: 68 + user_charge_enable_request: null + vehicle: 12345678910111213 +} ``` -# Local* Supercharger Data -Returns your nearest 4 Superchargers and Destination Chargers, along with availability information for the Superchargers (Stalls/Availability). +## tesla:vehicle:vehicle_config +```json +{ + account: MyTeslaAccountName + aux_park_lamps: Eu + badge_version: 0 + can_accept_navigation_requests: true + can_actuate_trunks: true + car_special_type: base + car_type: model3 + charge_port_type: CCS + dashcam_clip_save_supported: true + default_charge_to_max: false + driver_assist: TeslaAP3 + ece_restrictions: true + efficiency_package: Default + eu_vehicle: true + exterior_color: DeepBlue + exterior_trim: Chrome + exterior_trim_override: Chrome + has_air_suspension: false + has_ludicrous_mode: false + has_seat_cooling: false + headlamp_type: Premium + interior_trim_type: Black + key_version: 2 + motorized_charge_port: true + paint_color_override: 0,9,26,0.9,0.01 + performance_package: Performance + plg: false + pws: false + rear_drive_unit: PM216MOSFET + rear_seat_heaters: 1 + rear_seat_type: 0 + rhd: true + roof_color: RoofColorGlass + seat_type: null + spoiler_type: Passive + sun_roof_installed: null + supports_qr_pairing: false + third_row_seats: None + timestamp: 1667383041781 + trim_badging: p74d + use_range_badging: true + utc_offset: 3600 + vehicle: 1492931016169247 + webcam_supported: true + wheel_type: Stiletto20 +} +``` -```$xslt +## tesla:vehicle:climate_state +```json { - "response": { - "congestion_sync_time_utc_secs": 1610794377, - "destination_charging": [{ - "location": { - "lat": 53.802178, - "long": -1.543019 - }, - "name": "CitiPark Merrion Centre", - "type": "destination", - "distance_miles": 4.684237 - }, { - "location": { - "lat": 53.790416, - "long": -1.530348 - }, - "name": "CitiPark Leeds Dock", - "type": "destination", - "distance_miles": 5.635666 - }, { - "location": { - "lat": 53.973773, - "long": -1.492644 - }, - "name": "Rudding Park Hotel", - "type": "destination", - "distance_miles": 9.87527 - }, { - "location": { - "lat": 53.996658, - "long": -1.540473 - }, - "name": "The Camberley", - "type": "destination", - "distance_miles": 10.493266 - }], - "superchargers": [{ - "location": { - "lat": 53.784556, - "long": -1.532498 - }, - "name": "Leeds-Whitehouse Street, UK", - "type": "supercharger", - "distance_miles": 5.894953, - "available_stalls": 6, - "total_stalls": 8, - "site_closed": false - }, { - "location": { - "lat": 53.732774, - "long": -1.585622 - }, - "name": "Leeds, UK", - "type": "supercharger", - "distance_miles": 8.377563, - "available_stalls": 0, - "total_stalls": 2, - "site_closed": false - }, { - "location": { - "lat": 53.489393, - "long": -1.486223 - }, - "name": "Barnsley, UK", - "type": "supercharger", - "distance_miles": 25.666967, - "available_stalls": 2, - "total_stalls": 2, - "site_closed": false - }, { - "location": { - "lat": 53.430272, - "long": -2.179346 - }, - "name": "Manchester-South, UK", - "type": "supercharger", - "distance_miles": 37.071037, - "available_stalls": 6, - "total_stalls": 8, - "site_closed": false - }], - "timestamp": 1610794545215 - } + account: MyTeslaAccountName + allow_cabin_overheat_protection: true + auto_seat_climate_left: true + auto_seat_climate_right: true + battery_heater: false + battery_heater_no_power: null + cabin_overheat_protection: Off + cabin_overheat_protection_actively_cooling: false + climate_keeper_mode: off + defrost_mode: 0 + driver_temp_setting: 20.5 + fan_status: 0 + hvac_auto_request: On + inside_temp: 10.5 + is_auto_conditioning_on: false + is_climate_on: false + is_front_defroster_on: false + is_preconditioning: false + is_rear_defroster_on: false + left_temp_direction: 0 + max_avail_temp: 28 + min_avail_temp: 15 + outside_temp: 8.5 + passenger_temp_setting: 20.5 + remote_heater_control_enabled: false + right_temp_direction: 0 + seat_heater_left: 0 + seat_heater_rear_center: 0 + seat_heater_rear_left: 0 + seat_heater_rear_right: 0 + seat_heater_right: 0 + side_mirror_heaters: false + supports_fan_only_cabin_overheat_protection: true + timestamp: 1667383041781 + vehicle: 12345678910111213 + wiper_blade_heater: false } ``` +## tesla:vehicle:gui_settings +```json +{ + account: MyTeslaAccountName + gui_24_hour_time: true + gui_charge_rate_units: kW + gui_distance_units: mi/hr + gui_range_display: Rated + gui_temperature_units: C + gui_tirepressure_units: Psi + show_range_units: false + timestamp: 1667383041781 + vehicle: 1492931016169247 +} +``` -# Installation -Download the latest release from [SplunkBase](https://splunkbase.splunk.com/app/4660/) or [Github](https://github.com/livehybrid/TA-tesla-data/releases). -The app was designed to run on a single Splunk instance or a single Search Head as part of a bigger system, however other deployment combinations will work. +## tesla:vehicle:data +```json +{ + access_type: OWNER + api_version: 45 + backseat_token: null + backseat_token_updated_at: null + calendar_enabled: true + color: null + display_name: MyCarsName + id: 12345678910111213 + id_s: 12345678910111213 + in_service: false + option_codes: AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0 + state: online + tokens: [ + xxxxxxxxxxxxxxxx + yyyyyyyyyyyyyyyy + ] + user_id: 123456 + vehicle_id: 0123456789 + vin: 5YJ3F7EBXKF123456 +} +``` -Once installed, visit https://akrion.docs.apiary.io/#reference/authentication to get the latest API Client Key/Secret and enter this in the Application's configuration page->Add-On Settings (http://yourSplunkInstance:8000/en-US/app/TA-tesla-data/configuration#add-on-settings). +## "GraphQL Supercharger data" +## tesla:suc:locations +```json +{ + activeOutages: [ + ] + availableStalls: 2 + centroid: { + latitude: 50.928282 + longitude: 1.811838 + } + drivingDistanceMiles: null + entryPoint: { + latitude: 50.929973 + longitude: 1.813182 + } + haversineDistanceMiles: 281.7208162123432 + id: 20e3945e-ae3f-409a-b23f-c74bd77d5d1f + localizedSiteName: Tesla Supercharger Eurotunnel, France - Flexiplus Lounge + maxPowerKw: 125 + totalStalls: 2 +} +``` -Create a new app from the Inputs screen and select "Vehicle List" to collect basic details about the vehicle(s) in your account. -Once setup it will run immediately, after ~30 seconds you should see the data in the index you selected when creating the input. Search this index for the newly collected data and obtain the value of the `id_s` field. +## "Nearby SuperCharger Stats" +## tesla:suc:locations +```json +{ + activeOutages: [ + ] + availableStalls: 2 + centroid: { + latitude: 50.928282 + longitude: 1.811838 + } + drivingDistanceMiles: null + entryPoint: { + latitude: 50.929973 + longitude: 1.813182 + } + haversineDistanceMiles: 281.7208162123432 + id: 20e3945e-ae3f-409a-b23f-c74bd77d5d1f + localizedSiteName: Tesla Supercharger Eurotunnel, France - Flexiplus Lounge + maxPowerKw: 125 + totalStalls: 2 +} +``` -Now create a new input for `Specific Vehicle Data` and/or `Specific Vehicle Supercharger details` depending on your requirements. +## tesla:vehicle:destinationcharger +```json +{ + distance_miles: 9.874345 + location: { + lat: 53.973773 + long: -1.492644 + } + name: Rudding Park Hotel + type: destination +} +``` -# Dashboards -The dashboards within the app are Work-In-Progress and do not necessarily follow best practice. -Further work is required to make better use of base searches -Some dashboards make use of the [Location Tracker App](https://splunkbase.splunk.com/app/3164/) +## "Vehicle List" +## tesla:vehicle:list +```json +{ + access_type: OWNER + api_version: 45 + backseat_token: null + backseat_token_updated_at: null + calendar_enabled: true + color: null + display_name: MyCarsName + id: 12345678910111213 + id_s: 12345678910111213 + in_service: false + option_codes: AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0 + state: online + tokens: [ [+] + ] + vehicle_id: 1234567890 + vin: 5YJ3F7EBXKF123456 +} +``` ## Screenshots #### Overview ![Overview](https://user-images.githubusercontent.com/5527349/104831042-eb315580-587c-11eb-840f-eff44f7524dd.png) -#### Charging Events -Click-through to see single event -![Charging Events](https://user-images.githubusercontent.com/5527349/104831030-b7563000-587c-11eb-9212-f08aae94b17b.png) - -#### Single Charging Event -![Single Charging Event](https://user-images.githubusercontent.com/5527349/104831039-db197600-587c-11eb-9604-a4db96e7b1f3.png) - - # ToDo -New modular input to write only metrics, this will improve performance of searches. -Additional Journey plotting dashboard(s) -Battery Health / Efficiency Dashboard -Use base searches within Dashboards -Use Macros within the Dashboards +* Props to extract specific metrics into metrics index +* Additional Journey plotting dashboard(s) +* Battery Health / Efficiency Dashboard diff --git a/globalConfig.json b/globalConfig.json index 5ee3545..9495523 100644 --- a/globalConfig.json +++ b/globalConfig.json @@ -1,68 +1,217 @@ { "pages": { - "inputs": { - "table": { - "moreInfo": [ - { - "field": "name", - "label": "Name" - }, - { - "field": "interval", - "label": "Interval" - }, - { - "field": "index", - "label": "Index" - }, - { - "field": "disabled", - "label": "Status" - }, - { - "field": "tesla_email", - "label": "Tesla Email/Username" - }, - { - "field": "tesla_password", - "label": "Tesla Password" - }, - { - "field": "data_collector", - "label": "Data Collector" - }, - { - "field": "vehicle_id", - "label": "Vehicle ID" - } - ], - "header": [ - { - "field": "name", - "label": "Name" - }, - { - "field": "interval", - "label": "Interval" + "configuration": { + "tabs": [ + { + "name": "account", + "table": { + "actions": [ + "edit", + "delete", + "clone" + ], + "header": [ + { + "label": "Name", + "field": "name" + } + ] }, - { - "field": "index", - "label": "Index" + "entity": [ + { + "type": "text", + "label": "Name", + "validators": [ + { + "type": "string", + "errorMsg": "Length of ID should be between 1 and 50", + "minLength": 1, + "maxLength": 50 + }, + { + "type": "regex", + "errorMsg": "Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.", + "pattern": "^[a-zA-Z]\\w*$" + } + ], + "options": { + "placeholder": "Required" + }, + "field": "name", + "help": "Enter a unique name for this account.", + "required": true + }, + { + "type": "text", + "field": "refresh_token", + "label": "Refresh Token", + "required": true, + "encrypted": true, + "help": "Enter your Tesla Refresh Token." + }, + { + "type": "text", + "field": "access_token", + "label": "Access Token", + "required": false, + "encrypted": true, + "help": "Enter your Tesla Account Token." + }, + { + "field": "help_link", + "label": "", + "type": "helpLink", + "options": { + "text": "Configuration help", + "link": "/en-US/app/TA-tesla-data/tesla__welcome" + } + } + ], + "title": "Account" + }, + { + "name": "proxy", + "entity": [ + { + "type": "checkbox", + "label": "Enable", + "field": "proxy_enabled" + }, + { + "type": "singleSelect", + "label": "Proxy Type", + "options": { + "disableSearch": true, + "autoCompleteFields": [ + { + "value": "http", + "label": "http" + }, + { + "value": "socks4", + "label": "socks4" + }, + { + "value": "socks5", + "label": "socks5" + } + ] + }, + "defaultValue": "http", + "field": "proxy_type" + }, + { + "type": "text", + "label": "Host", + "validators": [ + { + "type": "regex", + "errorMsg": "Proxy Host should not have special characters", + "pattern": "^[a-zA-Z]\\.\\w*$" + }, + { + "type": "string", + "errorMsg": "Max host length is 4096", + "minLength": 0, + "maxLength": 4096 + } + ], + "field": "proxy_url" + }, + { + "type": "text", + "label": "Port", + "validators": [ + { + "type": "number", + "range": [ + 1, + 65535 + ] + } + ], + "field": "proxy_port" + }, + { + "type": "text", + "label": "Username", + "validators": [ + { + "type": "string", + "errorMsg": "Max length of username is 50", + "minLength": 0, + "maxLength": 50 + } + ], + "field": "proxy_username" + }, + { + "type": "text", + "label": "Password", + "validators": [ + { + "type": "string", + "errorMsg": "Max length of password is 8192", + "minLength": 0, + "maxLength": 8192 + } + ], + "encrypted": true, + "field": "proxy_password" + }, + { + "type": "checkbox", + "label": "Reverse DNS resolution", + "field": "proxy_rdns" + } + ], + "options": { + "saveValidator": "function(formData) { if(!formData.proxy_enabled || formData.proxy_enabled === '0') {return true; } if(!formData.proxy_url) { return 'Proxy Host can not be empty'; } if(!formData.proxy_port) { return 'Proxy Port can not be empty'; } if(!formData.proxy_type) {return 'Proxy type can not be empty'; } return true; }" }, - { - "field": "disabled", - "label": "Status" - } - ], - "actions": [ - "edit", - "enable", - "delete", - "clone" - ] - }, - "description": "Manage your data inputs", - "title": "Inputs", + "title": "Proxy" + }, + { + "name": "logging", + "entity": [ + { + "type": "singleSelect", + "label": "Log level", + "options": { + "disableSearch": true, + "autoCompleteFields": [ + { + "value": "DEBUG", + "label": "DEBUG" + }, + { + "value": "INFO", + "label": "INFO" + }, + { + "value": "WARNING", + "label": "WARNING" + }, + { + "value": "ERROR", + "label": "ERROR" + }, + { + "value": "CRITICAL", + "label": "CRITICAL" + } + ] + }, + "defaultValue": "INFO", + "field": "loglevel" + } + ], + "title": "Logging" + } + ], + "title": "Configuration", + "description": "Set up your add-on" + }, + "inputs": { "services": [ { "entity": [ @@ -86,20 +235,6 @@ "label": "Name", "type": "text" }, - { - "required": true, - "help": "Time interval of input in seconds.", - "field": "interval", - "validators": [ - { - "pattern": "^\\-[1-9]\\d*$|^\\d*$", - "errorMsg": "Interval must be an integer.", - "type": "regex" - } - ], - "label": "Interval", - "type": "text" - }, { "required": true, "defaultValue": "default", @@ -121,278 +256,524 @@ "type": "singleSelect" }, { - "required": true, - "options": { - "placeholder": "your@email.com" - }, - "help": "This is the email used to login to your Tesla app", - "field": "tesla_email", + "field": "interval", + "label": "Interval (in seconds)", + "type": "text", + "defaultValue": 120, "validators": [ { - "maxLength": 8192, - "minLength": 0, - "errorMsg": "Max length of text input is 8192", - "type": "string" + "type": "number", + "range": [ + 0, + 31536000 + ] } - ], - "label": "Tesla Email/Username", - "type": "text" + ] }, { - "required": true, - "encrypted": true, - "help": "This is the password used to login to your Tesla app", - "field": "tesla_password", - "validators": [ - { - "maxLength": 8192, - "minLength": 0, - "errorMsg": "Max length of password is 8192", - "type": "string" - } - ], - "label": "Tesla Password", - "type": "text" + "type": "singleSelect", + "label": "Tesla Account", + "options": { + "referenceName": "account" + }, + "help": "", + "field": "account", + "required": true }, { + "type": "singleSelect", + "label": "Vehicle", "required": true, - "defaultValue": "vehicle_data", - "help": "Select the type of data to collect", - "field": "data_collector", "options": { - "autoCompleteFields": [ + "dependencies": [ + "account" + ], + "placeholder": "Select a vehicle", + "endpointUrl": "ta_tesla_data_tesla_select_vehicle", + "labelField": "vehicle_name" + }, + "field": "vehicle_id" + }, + { + "type": "multipleSelect", + "label": "Data to log", + "options": { + "items": [ + { + "label": "Vehicle State", + "value": "vehicle_state" + }, + { + "label": "Vehicle Config", + "value": "vehicle_config" + }, + { + "label": "GUI Settings", + "value": "gui_settings" + }, { - "label": "Specific Vehicle Data", - "value": "vehicle_data" + "label": "Drive State", + "value": "drive_state" }, { - "label": "Specific Vehicle Supercharger details", - "value": "supercharger" + "label": "Climate State", + "value": "climate_state" }, { - "label": "Vehicle List", - "value": "vehicle_list" + "label": "Charge State", + "value": "charge_state" } - ], - "disableSearch": true + ] }, - "label": "Data Collector", - "type": "singleSelect" - }, + "help": "If none selected, all will be logged under different sourcetypes. See Help page for more info", + "field": "sections" + } + ], + "title": "Vehicle Data Collector", + "name": "tesla_vehicle_data" + }, + { + "entity": [ { - "required": false, - "defaultValue": "01234567890", - "help": "Required for Specific Vehicle collectors - If you dont know your vehicle ID, first use the vehicle list collector and then check the collected response.", - "field": "vehicle_id", + "required": true, + "help": "Enter a unique name for the data input", + "field": "name", "validators": [ { - "maxLength": 8192, - "minLength": 0, - "errorMsg": "Max length of text input is 8192", + "pattern": "^[a-zA-Z]\\w*$", + "errorMsg": "Input Name must start with a letter and followed by alphabetic letters, digits or underscores.", + "type": "regex" + }, + { + "maxLength": 100, + "minLength": 1, + "errorMsg": "Length of input name should be between 1 and 100", "type": "string" } ], - "label": "Vehicle ID", + "label": "Name", "type": "text" - } - ], - "title": "Tesla Car Api", - "name": "tesla_car_api" - } - ] - }, - "configuration": { - "description": "Set up your add-on", - "title": "Configuration", - "tabs": [ - { - "entity": [ - { - "field": "proxy_enabled", - "label": "Enable", - "type": "checkbox" }, { - "field": "proxy_type", + "required": true, + "defaultValue": "default", + "field": "index", "options": { - "autoCompleteFields": [ - { - "label": "http", - "value": "http" - }, - { - "label": "socks4", - "value": "socks4" - }, - { - "label": "socks5", - "value": "socks5" - } - ], - "disableSearch": true + "createSearchChoice": true, + "blackList": "^_.*$", + "endpointUrl": "data/indexes" }, - "defaultValue": "http", - "label": "Proxy Type", - "type": "singleSelect" - }, - { - "field": "proxy_url", "validators": [ { - "maxLength": 4096, - "minLength": 0, - "errorMsg": "Max host length is 4096", + "maxLength": 80, + "minLength": 1, + "errorMsg": "Length of index name should be between 1 and 80.", "type": "string" } ], - "label": "Host", - "type": "text" + "label": "Index", + "type": "singleSelect" }, { - "field": "proxy_port", + "type": "singleSelect", + "label": "Tesla Account", + "options": { + "referenceName": "account" + }, + "help": "", + "field": "account", + "required": true + }, + { + "field": "interval", + "label": "Interval (in seconds)", + "type": "text", + "defaultValue": 3600, "validators": [ { + "type": "number", "range": [ - 1, - 65535 - ], - "type": "number" + 0, + 31536000 + ] } - ], - "label": "Port", - "type": "text" - }, + ] + } + ], + "title": "Vehicle List", + "name": "tesla_vehicle_list" + }, + { + "entity": [ { - "field": "proxy_username", + "required": true, + "help": "Enter a unique name for the data input", + "field": "name", "validators": [ { - "maxLength": 50, - "minLength": 0, - "errorMsg": "Max length of username is 50", + "pattern": "^[a-zA-Z]\\w*$", + "errorMsg": "Input Name must start with a letter and followed by alphabetic letters, digits or underscores.", + "type": "regex" + }, + { + "maxLength": 100, + "minLength": 1, + "errorMsg": "Length of input name should be between 1 and 100", "type": "string" } ], - "label": "Username", + "label": "Name", "type": "text" }, { - "field": "proxy_password", - "encrypted": true, + "field": "interval", + "label": "Interval (in seconds)", + "type": "text", + "defaultValue": 900, "validators": [ { - "maxLength": 8192, - "minLength": 0, - "errorMsg": "Max length of password is 8192", + "type": "number", + "range": [ + 0, + 31536000 + ] + } + ] + }, + { + "required": true, + "defaultValue": "default", + "field": "index", + "options": { + "createSearchChoice": true, + "blackList": "^_.*$", + "endpointUrl": "data/indexes" + }, + "validators": [ + { + "maxLength": 80, + "minLength": 1, + "errorMsg": "Length of index name should be between 1 and 80.", "type": "string" } ], - "label": "Password", - "type": "text" + "label": "Index", + "type": "singleSelect" }, { - "field": "proxy_rdns", - "label": "Remote DNS resolution", - "type": "checkbox" + "type": "singleSelect", + "label": "Tesla Account", + "options": { + "referenceName": "account" + }, + "help": "", + "field": "account", + "required": true + }, + { + "type": "singleSelect", + "label": "Vehicle", + "required": true, + "options": { + "dependencies": [ + "account" + ], + "placeholder": "Select a vehicle", + "endpointUrl": "ta_tesla_data_tesla_select_vehicle", + "labelField": "vehicle_name" + }, + "field": "vehicle_id" } ], - "options": { - "saveValidator": "function(formData) { if(!formData.proxy_enabled || formData.proxy_enabled === '0') {return true; } if(!formData.proxy_url) { return 'Proxy Host can not be empty'; } if(!formData.proxy_port) { return 'Proxy Port can not be empty'; } return true; }" - }, - "title": "Proxy", - "name": "proxy" + "title": "Nearby SuperCharger Stats", + "name": "tesla_nearby_suc" }, { + "hook": { + "src": "Hook" + }, + "name": "tesla_token_refresher", "entity": [ { - "field": "loglevel", + "type": "text", + "label": "Name", + "validators": [ + { + "type": "regex", + "errorMsg": "Input Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.", + "pattern": "^[a-zA-Z]\\w*$" + }, + { + "type": "string", + "errorMsg": "Length of input name should be between 1 and 100", + "minLength": 1, + "maxLength": 100 + } + ], + "field": "name", + "help": "A unique name for the data input.", + "required": true + }, + { + "field": "interval", + "label": "Interval (in seconds)", + "type": "text", + "defaultValue": 3600, + "validators": [ + { + "type": "number", + "range": [ + 0, + 31536000 + ] + } + ] + }, + { + "type": "singleSelect", + "label": "Tesla Account", "options": { - "autoCompleteFields": [ - { - "label": "DEBUG", - "value": "DEBUG" - }, - { - "label": "INFO", - "value": "INFO" - }, - { - "label": "WARNING", - "value": "WARNING" - }, - { - "label": "ERROR", - "value": "ERROR" - }, - { - "label": "CRITICAL", - "value": "CRITICAL" - } - ], - "disableSearch": true + "referenceName": "account" }, - "defaultValue": "INFO", - "label": "Log level", - "type": "singleSelect" + "help": "", + "field": "account", + "required": true + }, + { + "field": "help_link", + "label": "", + "type": "helpLink", + "options": { + "text": "Help Link", + "link": "/en-US/app/TA-tesla-data/tesla__welcome" + } } ], - "title": "Logging", - "name": "logging" + "title": "Token Refresher" }, { + "name": "tesla_collect_tp_suc_data", "entity": [ { - "required": true, - "defaultValue": "", - "help": "Found at https://akrion.docs.apiary.io", - "field": "api_clientid", + "type": "text", + "label": "Name", "validators": [ { - "maxLength": 8192, - "minLength": 0, - "errorMsg": "Max length of text input is 8192", - "type": "string" + "type": "regex", + "errorMsg": "Input Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.", + "pattern": "^[a-zA-Z]\\w*$" + }, + { + "type": "string", + "errorMsg": "Length of input name should be between 1 and 100", + "minLength": 1, + "maxLength": 100 } ], - "label": "API ClientID", - "type": "text" + "field": "name", + "help": "A unique name for the data input.", + "required": true }, { - "required": true, - "defaultValue": "", - "encrypted": true, - "help": "Found at https://akrion.docs.apiary.io", - "field": "api_client_secret", + "type": "singleSelect", + "label": "Index", "validators": [ { - "maxLength": 8192, - "minLength": 0, - "errorMsg": "Max length of password is 8192", - "type": "string" + "type": "string", + "errorMsg": "Length of index name should be between 1 and 80.", + "minLength": 1, + "maxLength": 80 } ], - "label": "API Client Secret", - "type": "text" + "defaultValue": "default", + "options": { + "endpointUrl": "data/indexes", + "createSearchChoice": true, + "denyList": "^_.*$" + }, + "field": "index", + "required": true }, { - "required": false, - "defaultValue": true, - "help": "Enforce trusted SSL certificate verification", - "field": "verify_ssl", - "label": "Verify SSL", - "type": "checkbox" + "field": "interval", + "label": "Interval (in seconds)", + "type": "text", + "defaultValue": 900, + "validators": [ + { + "type": "number", + "range": [ + 0, + 31536000 + ] + } + ] + }, + { + "type": "singleSelect", + "label": "Tesla Account", + "options": { + "referenceName": "account" + }, + "help": "", + "field": "account", + "required": true + }, + { + "type": "text", + "label": "Center Lat,Long", + "validators": [ + { + "type": "regex", + "errorMsg": "Invalid date and time format", + "pattern": "^([0-9\\.]+\\,[0-9\\.\\-]+)$" + } + ], + "field": "user_lat_long", + "help": "Should be in form Lat,Long (Comma Delimited).", + "tooltip": "This is the center point of the map to search.", + "required": true + }, + { + "type": "text", + "label": "North-West Lat,Long", + "validators": [ + { + "type": "regex", + "errorMsg": "Invalid Lat,Long value", + "pattern": "^([0-9\\.\\-]+\\,[0-9\\.\\-]+)$" + } + ], + "field": "northwest_lat_long", + "help": "Should be in form Lat,Long (Comma Delimited).", + "tooltip": "This is the top left point of the map to search.", + "required": true + }, + { + "type": "text", + "label": "South-East Lat,Long", + "validators": [ + { + "type": "regex", + "errorMsg": "Invalid Lat,Long value", + "pattern": "^([0-9\\.\\-]+\\,[0-9\\.\\-]+)$" + } + ], + "field": "southeast_lat_long", + "help": "Should be in form Lat,Long (Comma Delimited).", + "tooltip": "This is the bottom right point of the map to search.", + "required": true + }, + { + "field": "help_link", + "label": "", + "type": "helpLink", + "options": { + "text": "Help Link", + "link": "/en-US/app/TA-tesla-data/tesla__welcome" + } } ], - "title": "Add-on Settings", - "name": "additional_parameters" + "title": "GraphQL Supercharger data collection" } - ] + ], + "title": "Inputs", + "description": "Manage your data inputs", + "table": { + "actions": [ + "edit", + "enable", + "delete", + "clone" + ], + "header": [ + { + "field": "input", + "label": "Input Type", + "customCell": { + "src": "CustomInputCell", + "type": "external" + } + }, + { + "label": "Name", + "field": "name" + }, + { + "label": "Account", + "field": "account" + }, + { + "label": "Interval", + "field": "interval" + }, + { + "label": "Index", + "field": "index" + }, + { + "label": "Status", + "field": "disabled" + } + ], + "moreInfo": [ + { + "label": "Name", + "field": "name" + }, + { + "label": "Interval", + "field": "interval" + }, + { + "label": "Index", + "field": "index" + }, + { + "label": "Status", + "field": "disabled", + "mapping": { + "true": "Disabled", + "false": "Enabled" + } + }, + { + "label": "Tesla Account", + "field": "account" + }, + { + "label": "Vehicle ID", + "field": "vehicle_id" + }, + { + "label": "Object", + "field": "object" + }, + { + "label": "Object Fields", + "field": "object_fields" + }, + { + "label": "Order By", + "field": "order_by" + }, + { + "label": "Query Start Date", + "field": "start_date" + }, + { + "label": "Limit", + "field": "limit" + } + ] + } } }, "meta": { - "displayName": "Tesla data", - "version": "1.0.0", - "restRoot": "TA_tesla_data", "name": "TA-tesla-data", - "apiVersion": "3.0.0" + "restRoot": "ta_tesla_data", + "version": "1.1.0", + "displayName": "Tesla app for Splunk", + "schemaVersion": "0.0.3" } -} +} \ No newline at end of file