Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add last trip as a sensor #145

Open
BertVereecke opened this issue Jun 20, 2023 · 2 comments
Open

Feature request: Add last trip as a sensor #145

BertVereecke opened this issue Jun 20, 2023 · 2 comments

Comments

@BertVereecke
Copy link

Would it perhaps be possible to add a sensor that holds information about the last trip?
The necessary functions are already present in the mytoyota python library, but this data is not retrieved by ha_toyota.

I think it would be nice to have a sensor, with:

  • timestamp of the last trip as the state
  • summary and statistics as extra attributes

I personally believe only the last trip should be added as a sensor, as adding older trips would become too messy.

Kind regards,
Bert

@CM000n CM000n changed the title Add last trip as a sensor Feature request: Add last trip as a sensor Jan 14, 2024
@CM000n
Copy link
Collaborator

CM000n commented Jan 15, 2024

Hello @BertVereecke, in principle that would be interesting.
The problem here, however, is that Toyota does not have an independent API for querying the last trip. You can only make requests to the Toyota Trips API that contain a from_date and to_date and then get back all trips that are within this period.

Now, of course, we don't know when your last trip took place, for example. You could have been travelling 3 days ago, but also 1 month or 1 year ago.

Toyota itself stores the trip data for 1 year. We would therefore have to retrieve all trip information for 1 year each time and filter for the last trip in it. In my initial opinion, this would probably cause too much load.

@Ishima
Copy link

Ishima commented Jun 6, 2024

It's possible. I already implemented that & currently testing with few other options, like sending remote commands. API takes offset & limit, so knowing the limitations, we can ask for 1 entry in the last 90 days (I thinks this period should have some entries). API seems to be sorting trips descending, so asking for only one will return the 'last trip' we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants