Python Plugin: Toyota Topic is solved

Python and python framework

Moderator: leecollings

mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

I also updated the readme to address the other points you made :)
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

MQTT topic: OK, understood. I added the autodiscovery line in my domoticz hardware, and it now discovered and added the devices. So as you can see, learn something every day (even after 45 years in the ICT industry).

I will still use the switch to split off some values, since I want to store them in a file. I use a spreadsheet to keep track of my fuel consumption, and I use several readings to do the calculations. The excel spreadsheet reads from the file.

Lock status: I already use pytoyoda and altered the script to write all output to a file. I checked that file and see that the lock status is not correct.
I guess I will simply disable it.

As for pytoyoda: since I started using it, I have seen two failures. Apparently Toyota changes the interface periodically. The pytoyoda author has fixed the problem, but it does take manual action to upgrade to a new pytoyoda versio.n
Hans
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

Great that we got it working now.

I can add an "export to CSV" option in the trips history page so you can export the data directly without domoticz in the middle.

The logs you provided, did not contain any trips log, so i dont know if and how pytoyoda fetches the fuel consumption for your car. If you can send me such a log, I can integrate it. If pytoyoda does not get that data, we can probably still solve it either by hooking directly into the response from the toyota server (pytoyoda is not storing all data it gets) or by closely tracking the battery level before and after each trip, though this will be more prone to errors.

I can also add specific fuel consumption calculations to the web server if you let me know, what you are missing.
You can also click the histogram symbol to get the per trip values.
Untitled.png
Untitled.png (20.88 KiB) Viewed 677 times
Attachments
Untitled1.png
Untitled1.png (54.7 KiB) Viewed 675 times
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

I think I commented out that trip data request in my pytoyoda file, since it is quite a lot of data and I had no good use for it. What I can see now in your app is fine.
I'll give it some thought about what is missing, if anything.

As for the MQTT topic discussion: I found out I can still get all messages from one single listener by using the + wildcard. That is also a good way to discover in Node Red which data comes in.
Hans
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

I added the CSV export on the trips page under Filters&options.
I also addressed the issue with merge conflicts on git pull.
The user settings are henceforth saved in a separate user_config.yaml.
Before you do a git pull next time do this in the data folder:

Code: Select all

cp mytoyota_config.yaml user_config.yaml
git stash
git pull
After that, the problem should be gone as your settings will be stored into the user_config.yaml which is not part of the repo.

I added a lot of missing parameters from the API. You will need to do a "Fill Trip history" if you want to add them for your already synced trips.
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

You're on a roll! Good job.

On the update instructions: perhaps it is usefull to add a simple bash file to the install set, so the user can simply run the update procedure?

I do have a few nit-picking suggestions about the presentation on the dashboard. Keep in mind these are suggestions.
  • combine "range left"and "EV range" into:
    • Range:
      • EV
      • Fuel
      • Combined
  • combine "Fuel Level" and "EV level" into:
    • Level:
      • EV
      • Fuel
  • Change title "consumption" into "Avg. consumption"
  • Change title "Time driven" into "Total time driven"
Depending on what you use to display the information, this may be a slight challenge...
But the idea is to simplify the dashboard and still display as much info as possible.
Ordering of the information could also be changed, but that is the last step I guess, after all info is there.
Hans
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

I am looking into migrating from my own pytoyoda solution to your toyota-dashboard app.
Most of the data elements that I need are there: odometer, fuel level, battery level and battery range.

What's missing are lattitude and longitude.
Is there any chance of adding these two data elements to the MQTT feed?
Hans
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

manjh wrote: Wednesday 13 August 2025 11:56 I am looking into migrating from my own pytoyoda solution to your toyota-dashboard app.
Most of the data elements that I need are there: odometer, fuel level, battery level and battery range.

What's missing are lattitude and longitude.
Is there any chance of adding these two data elements to the MQTT feed?
Yes, no problem, I can add those. You want them in one sensor or 2 sensors, one for lat, one for long?
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

I added several new mqtt sensors which you can enable in the settings.

The address sensor doesn't seem to work yet, it's being send, but domoticz is ignoring it. All other sensors work though, including long/lat location.
Screenshot_20250813-235755.png
Screenshot_20250813-235755.png (175.84 KiB) Viewed 500 times
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

mxpwr wrote: Wednesday 13 August 2025 12:03
manjh wrote: Wednesday 13 August 2025 11:56 I am looking into migrating from my own pytoyoda solution to your toyota-dashboard app.
Most of the data elements that I need are there: odometer, fuel level, battery level and battery range.

What's missing are lattitude and longitude.
Is there any chance of adding these two data elements to the MQTT feed?
Yes, no problem, I can add those. You want them in one sensor or 2 sensors, one for lat, one for long?
separate or combined, does not matter for me. In all cases I will process in a node-red function node, so I can split or combine as needed.
Hans
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

mxpwr wrote: Wednesday 13 August 2025 23:57 I added several new mqtt sensors which you can enable in the settings.

The address sensor doesn't seem to work yet, it's being send, but domoticz is ignoring it. All other sensors work though, including long/lat location.

Screenshot_20250813-235755.png
I can have a look tonight. I can set up a Node-Red node that catches all incoming data using a wildcard, this allows me to see what comes in.
Will let you know.
Hans
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

Have you released the changes to git? I updated and restarted, but still only see the 7 fields in the MQTT list on the settings page!

Tip: add an "about" phrase somewhere, so we can see the version number.
Hans
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

Yes, you should see the same sensors as in my screenshot

https://github.com/stone17/mytoyota-das ... 1d392764cb
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

I removed the existing directory and re-installed from scratch, that has helped. New version is now running.

Checked if the address comes through: yes it does.
I set up a listener in Node-Red with a wildcard, it shows everything coming in from the toyota-dashboard, so it is very easy for me to check the msg coming in.
Hans
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

That's good. The message is send on my end as well, but domoticz logs only shows all the other sensors and does not create the sensor for the location address. Maybe it's just my domoticz installation that is scrambled.
Does the location address sensor get created for you?
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

A few findings after a quick test, some unexpected values:
  • score comes in with value 69, on the Toyota appI see 85
  • highway distance comes in with value 0
  • total ev distance shows 23
Hans
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

It will send the data that is stored in the vehicle_data.json which is also what is shown on the dashboard statistics panel.
You can cross check those, they should be identical.
If not, perform a refresh and check again.
At least on my end the numbers match up, but maybe something is different with the your type of car.
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

Found the reason for the strange values.
Although the trip history stull shows all, I needed to backfill all trips in order to get the value calculations OK.
So I'll have to re-examen and check again.
Hans
mxpwr
Posts: 30
Joined: Sunday 19 July 2015 10:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Toyota

Post by mxpwr »

I investigated a bit more and for some reason it doesn't work if I name the sensor location_address. Even sending the discovery message manually via mqtt_pub wouldn't create the sensor in domoticz. Any other name works fine. So I changed the name now and all sensors are working properly through mqtt now.
manjh
Posts: 783
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Toyota

Post by manjh »

Re-tested latest version, all is OK except for lock status. In my case it always comes back with `Locked`.
Hans
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest