Toyota Connect

I have a new Toyota Tacoma and would love to get some of the data from the connect in there. Like tire psi, errors, door locks, fuel consumption, etc… I saw that someone created something similar for the mercedes and its pretty nice!.. heres the mercedes plugin… Mercedes Me Component

and a screenshot…

image

Moved this to the feature requests section for you as there doesn’t seem to be anything like this out there so far. You can vote on it using the button at the very top of your post.

I got a new RAV4 a few months ago and would like this too.

1 Like

So just got a rav4 today. Tried to proxy the Android app and didn’t have any luck. I was able to decompile their app, but of course there is tons and tons to go through.

I’ll try digging in.

4 Likes

Found this python library on GitHub: https://github.com/calmjm/tojota

Maybe we can make use of it in combination with HA?

Thats cool, but looks like its just for europe. Not US.

That’s right. But maybe the data for American and Asian accounts can also be accessed via this library at “https://ssoms.toyota-europe.com/”?
Maybe someone could test this?

Since my Toyota Corolla TS is coming not until three weeks and I live in Germany, I can’t contribute much to it :wink:

Hello, tojota library author here. For those functions that now uses some europe domain should be interchangeable to myt-aggregator counterparts and after that compatible for whole world. That would just need some testing by someone in such country.

2 Likes

Hi @calmjm,

good to hear that.
Do you know if there is any official documentation on the API from Toyota anywhere?

Greetings and thanks in advance

Nope. Of course there is no public documentation for Toyota APIs.

Are you also planning to publish your library on PyPI so that it can also be imported for a sensor and used in Homeassitant?
Sorry if I misunderstand something, I’m not a developer.
But if your library could be easily installed and imported via “pip install”, I would try to make a toyota sensor for HA.

When I currently try to install it for test purposes, I get the following:

Yes is possible

Schermata da 2021-02-15 16-57-00

the way is to build command line sensors for reading values stored, by tojota.py, in JSON files. It’s very easy , thanks to the hard work done by Calmjm :smiley:

Hi @dr_jekyll , that looks cool!
Would you mind sharing your configuration with us?
Thanks in advance

1 Like

I’m looking for this too! Could you share the steps and configs you’ve done to get this running? Thanks.

If you want a step by step guide, i need some time. For sure the system needs a linux machine to run tojota.py.
In my hassio configuration i use this command line sensors:

toyota.yaml
automation:
  - alias: get_toyota_position
    trigger:
      - platform: state
        entity_id:
          - sensor.lat_chr
          - sensor.lon_chr
      - platform: homeassistant
        event: start
    action:
      - service: device_tracker.see
        data_template:
          dev_id: chr_location
          gps:
            - "{{ states('sensor.lat_chr') }}"
            - "{{ states('sensor.lon_chr') }}"

sensor:
  - platform: command_line
    name: Serbatoio CHR
    command: 'ssh -i /root/.ssh/id_rsa [email protected] python3 toyota/get_fuel.py'
    unit_of_measurement: "%"
  - platform: command_line
    name: Odo CHR
    command: 'ssh -i /root/.ssh/[email protected]  python3 toyota/get_odo.py'
    unit_of_measurement: "km"

  - platform: command_line
    name: Lat CHR
    command: 'ssh -i /root/.ssh/id_rsa [email protected]  python3 toyota/get_lat.py'
  - platform: command_line
    name: Lon CHR
    command: 'ssh -i /root/.ssh/id_rsa [email protected]  python3 toyota/get_lon.py'

That send shh request on linux machine to get the data, stored in JSON bu tojota.py

get_fuel.py
import os
import glob
import json
files= glob.glob('/home/cartman/toyota/tojota/cache/odometer/odometer*')
#print(files)
files.sort(key=os.path.getmtime)
#print(files)
with open(files[len(files)-1]) as f:
  data = json.load(f)
park = data[1]
print(park['value'])
get_odo.py
import os
import glob
import json
files= glob.glob('/home/cartman/toyota/tojota/cache/odometer/odometer*')
#print(files)
files.sort(key=os.path.getmtime)
#print(files)
with open(files[len(files)-1]) as f:
  data = json.load(f)
park = data[0]
print(park['value'])
get_lat.py
import os
import glob
import json
files= glob.glob('/home/cartman/toyota/tojota/cache/parking/parking*')
#print(files)
files.sort(key=os.path.getmtime)
#print(files)
with open(files[len(files)-1]) as f:
  data = json.load(f)

park = data['event']
print(park['lat'])
get_lon.py

import os
import glob
import json
files= glob.glob('/home/cartman/toyota/tojota/cache/parking/parking*')
#print(files)
files.sort(key=os.path.getmtime)
#print(files)
with open(files[len(files)-1]) as f:
  data = json.load(f)

park = data['event']
print(park['lon'])
1 Like

Ahhh, understood! Many thanks for the hint!
How do you run the “tojota.py” itself to generate the files?
Do you have a kind of cron job for this, or do you also trigger it from HomeAssistant?

Many greetings and many thanks

Yeah, call this bash script with crontab

Summary
#!/bin/bash
cd /home/cartman/toyota
source bin/activate
cd tojota
sleep 1
python3 tojota.py
sleep 5
deactivate

1 Like

Thank you very much. Now after a bit of trial and error it works wonderfully for me.
Looks like I just need to figure out a good way to process the data in the trips files. To be able to create a timeline like Google Maps in Home-Assistant with it. The information from the parking file is a bit too incomplete for that.
Thanks again for the tips @dr_jekyll and @calmjm for the great work!

1 Like

Processing trips data is one of my next goals in hassio. More than geolocalization history, I am interested in to get plot of consumption and EV time. But right now i don’t have time to do.

I think the problem will be that the data will always come as a bulk and not in real time at the respective event time :-/ Thus Homeassistant will probably not be able to process them properly to show a history.
Maybe I can find a way to load the data into my TimescaleDB to make a visualization in Grafana. Unfortunately, I do not use InfluxDB, to which the writing is seems already to be integrated.

Hi @dr_jekyll,

I have now managed to integrate average EV distance & share, total distance, average speed, maximum speed, number of total trips & night trips, as well as average fuel consumption.
The whole for daily, weekly and yearly basis :slight_smile:

I have only made a few changes to the statistics.py, so that only the unformatted floats are output, and call this via command line sensors and bash commands.

Works well so far :+1: