SG57
Former Vendor
@stevelectric , for Android yes.
My app Dashboard for Tesla is the only one, as far as I know, that supports GCM push-notifications from Tesla. I'm in the process of adding these as triggers to my existing automatic behaviors feature, so things like "Honk Horn when charge interrupted" is a thing, or "Start HVAC when charge completes".
I reverse-engineered the official Tesla Motors Android app to get the GCM sender key (not posting), then to learn the APIs I had to disable certificate pinning in the app using a rooted Android device before sniffing the app traffic. You'll need to generate an InstanceID device token using the GCM sender key and this will register your device to receive GCM messages from Tesla, then register your device token with Tesla's servers using the POST APIs below to let Tesla's servers know they should be sending your device messages and for what account.
The following APIs are used to both configure which vehicles to subscribe to messages for, and what types of messages to receive. These requests all require the same Bearer token authentication header and the response bodies are straightforward enough so I won't detail those:
There are a number of known vehicle notifications that Tesla's notification_preferences API supports enabling/disabling the actual sending of the message to your device, such as charging started or car alarm. Then there are a number of vehicle notifications you cannot disable that will always be sent to your device once your device is registered with GCM and your device token is registered with Tesla, such as HomeLink or Summon (autopark) panic. How many of these there are or any details on these tyoes of messages are mostly unknown. Technically you could artificially disable these making them invisible to the user by not doing anything with them once you receive the push message, but I digress.
The actual data sent to you from Tesla in a push message can vary, but here is a sample of a charging started message:
Hopefully this gives you and everyone else a good overview.
My app Dashboard for Tesla is the only one, as far as I know, that supports GCM push-notifications from Tesla. I'm in the process of adding these as triggers to my existing automatic behaviors feature, so things like "Honk Horn when charge interrupted" is a thing, or "Start HVAC when charge completes".
I reverse-engineered the official Tesla Motors Android app to get the GCM sender key (not posting), then to learn the APIs I had to disable certificate pinning in the app using a rooted Android device before sniffing the app traffic. You'll need to generate an InstanceID device token using the GCM sender key and this will register your device to receive GCM messages from Tesla, then register your device token with Tesla's servers using the POST APIs below to let Tesla's servers know they should be sending your device messages and for what account.
The following APIs are used to both configure which vehicles to subscribe to messages for, and what types of messages to receive. These requests all require the same Bearer token authentication header and the response bodies are straightforward enough so I won't detail those:
- GET: api/1/notification_preferences
QUERY: ?device_token={INSERT HERE}&device_type=android&platform=android&app_version=3.2.1-334&locale=en
- POST: api/1/notification_preferences
BODY:
{
"device_token":"{INSERT HERE}",}
"device_type":"android",
"platform":"android",
"app_version":"3.2.1-334",
"locale":"en",
"notification_preferences":{
"alarm":true,}
"autopark_forward_started":true,
"autopark_completed_success":true,
"autopark_unavailable_plugged_in":true,
"charging_started":true,
"charging_interrupted":true,
"charging_complete":true,
"key_added":true,
"key_removed":true,
"update_available":true,
"climate_keeper_ended_soc":true,
"car_active":true,
"refer_friend":true,
"secret_level":true,
"please_move_car":true,
"grid_fault_contactor_trip":true,
"grid_resync_success":true
- GET: api/1/vehicle_subscriptions
QUERY: ?device_token={INSERT HERE}&device_type=android&bigint=false
- POST: api/1/vehicle_subscriptions
BODY:
{
"device_token":"{INSERT HERE}",}
"device_type":"android",
"vehicle_subscriptions":[
"1237331239112123"],
"bigint":"false"
There are a number of known vehicle notifications that Tesla's notification_preferences API supports enabling/disabling the actual sending of the message to your device, such as charging started or car alarm. Then there are a number of vehicle notifications you cannot disable that will always be sent to your device once your device is registered with GCM and your device token is registered with Tesla, such as HomeLink or Summon (autopark) panic. How many of these there are or any details on these tyoes of messages are mostly unknown. Technically you could artificially disable these making them invisible to the user by not doing anything with them once you receive the push message, but I digress.
The actual data sent to you from Tesla in a push message can vary, but here is a sample of a charging started message:
Code:
google.sent_time=1510049591636,
delivery_confirmation=false,
vehicle_id=12307332123114123,
txid=123e7185bbc5d15f47a471123f6d124d,
view=CHARGE,
google.message_id=0:1231239591639270%d36240681cbfb536,
product_type=vehicle,
alert_id=ALERT_CHARGING_STARTED,
product_id=1237332679123123,
override_string=Charging started at 2:13 am with battery at 163 mi.,
collapse_key=ALERT_CHARGING_STARTED,
alert_args=["Cordette","2:13 am"],
alert_time=1510049591
Hopefully this gives you and everyone else a good overview.
Last edited: