Git Product home page Git Product logo

Comments (6)

MattJeanes avatar MattJeanes commented on July 18, 2024 1

Hey @ObJuanK, I have now fixed this in v1.12.1 🙂

If you're interested, it was caused by the final price having the exact same time as the final charge entry, down to the millisecond. This combined with my usage of charge.Date < price.ValidTo instead of charge.Date <= price.ValidTo was the issue!

That charge you supplied worked out as 5.88 cost by the way in case the Home Assistant data has expired by now and you need to enter it manually.

Also I hope you don't mind, I have added your data to some unit tests to help prevent this issue re-occurring in future, but please let me know if this is an issue and you want me to remove it.

from teslamateagile.

MattJeanes avatar MattJeanes commented on July 18, 2024

Hey, first of all many thanks for the detailed report - super appreciated!

Can I ask you to please run this call against the Home Assistant API and tell me the results?

GET <home-assistant-url>/api/history/period/2023-08-24T23:43:53Z?end_time=2023-08-25T03:19:42Z&filter_entity_id=input_number.re_import_price

Ensure you set the header Authorization: Bearer <home-assistant-token> as well!

What appears to be happening is when querying HA, the dates of the returned data don't line up with the charges in the CSV you sent me for some reason, as there is a matching step to designate all charges to a relevant price from the returned data. I suspect it may be a timezone related issue or perhaps something off by a second or minute etc.

For your bonus question, you can run it as infrequently as you like, but make sure your lookback days and HA history will work with what you set. In your particular scenario this would be fine because HA history would still be available which is where it gets the price data from, it doesn't really matter when it runs as long as the charge is within the lookback days and HA history is available for the date/time range 🙂

from teslamateagile.

ObJuanK avatar ObJuanK commented on July 18, 2024

Sorry for the late reply, has been a busy few days and glad you liked the detail. I suffer from a lack of detail in reported problems at work every day so I know the struggle :)

Sure thing, here is the output of that get request

[[{"entity_id":"input_number.re_import_price","state":"0.2748","attributes":{"initial":null,"unit_of_measurement":"AUD/kWh","icon":"mdi:lightning-bolt","friendly_name":"red_energy_import_price"},"last_changed":"2023-08-24T23:43:53+00:00","last_updated":"2023-08-24T23:43:53+00:00"}]]

I suspected it may be time based thing, I do have my HA set to UTC+10 but I dont think I configured TMA to any timezone (not sure if its possible)

Thanks for the info on the bonus question, i'll back this off to run once a day then as I am only charging every other day. At first read of the doco it appeared that you may need to run this constantly to keep a running tally so I tried to space it out to the average of my charge sessions

from teslamateagile.

MattJeanes avatar MattJeanes commented on July 18, 2024

Thank you! It looks like there was just one price of 0.2748 AUD/kWh for the duration of that charge, does that sound correct?

I'll run it through the debugger when I'm back home next week, I'm on holiday at the moment 🙂

If there's a particular section of the docs which implies TeslaMateAgile needs to run often to track charging within a charge session let me know and I'll try and reword it to be be clearer (or you could submit a PR of course!)

from teslamateagile.

ObJuanK avatar ObJuanK commented on July 18, 2024

Hey Matt,

Thanks for looking into it and taking the time to reply on holidays.
Ive been on holidays myself but did not have the luxury of being anywhere with any form of reception, I guess thats a good thing 😄

I came home to find a myriad of failed calculations after my initial report, I have those logs if you are interested and can pull the data for those session if it helps you, just let me know.
But I pulled down v1.12.1 and when the container started it was able to calculate everything correctly as far back as HA could see, so looks like it did the trick! thank you 🙏
No issues with you using my data.

On the doco implying it needed to be run regularly: It was not anything specific and it could possibly be how I interpret things, but I inferred from context a little when reading the Required Environment Variables section.

  • The variable to check is in seconds, suggesting this can be configured to run near real time.
  • The example showing a default of 5 minutes,
  • The comment Check for completed charges without a set cost every x seconds to me, suggest you need to check for a completed charge regularly otherwise you'll miss it. Could be the every x seconds bit that did it for me.

What I think might help would be adding some subtext under Required Environment Variables with the explanation you provided me in your original reply.
Set the refresh value as in/frequent as you like. Ensure this does not exceed lookback days or HA data
I'd make a PR but I have not looked at how this works very much with other provides so can only offer my 2 cents on HA.

Thanks again and keep up the awesome work :)

from teslamateagile.

MattJeanes avatar MattJeanes commented on July 18, 2024

Thank you, glad to hear it's all working for you now, and thanks for letting me use your data in the tests.

I've made a little commit here to change the wording and increase the example to an hour, hopefully this will make the purpose of it clearer: 1ebe629

🙂

from teslamateagile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.