MattJeanes / TeslaMateAgile

Integration to automatically fill in prices for charge data captured by TeslaMate for smart energy providers
MIT License
75 stars 9 forks source link

Unable to reflect plunge pricing. #10

Closed StuFull closed 4 years ago

StuFull commented 4 years ago

From what I can see the tool has a difficulty to manage negative pricing occasionally offered with the Agile tariff.

84B90800-F511-486D-9EDC-E12C98C3DC30 63206F11-9068-4165-A3BE-993345B3C535

MattJeanes commented 4 years ago

Hey, thanks for raising on GitHub just a bit easier to track!

I've ran some tests against your agile costs here and assuming full power charging at 240v / 30a between 00:00 and 06:00 I've calculated a value of £-0.09

Do you have the exact data from the Charges data in the TeslaMate database I can use for testing? I need specifically the columns Date, ChargerPhases, ChargerPower, ChargerActualCurrent and ChargerVoltage

If you're not sure how to access the database directly, if you edit the docker-compose (assuming you followed default setup) to expose ports and use something like pgAdmin to access the database:


  database:
    image: postgres:12
    restart: always
    environment:
      - POSTGRES_USER=teslamate
      - POSTGRES_PASSWORD=secret
      - POSTGRES_DB=teslamate
    ports:
      - 5432:5432 # this is the new bit
    volumes:
      - teslamate-db:/var/lib/postgresql/data
MattJeanes commented 4 years ago

I've just realised those prices you've put there are already calculated and not the base agile prices! I've pulled the prices for this date and ran the calculation and calculated exactly -£2.00 - looking at your figure there this looks reasonable and my calculations calculated total 36.74 kWh energy used just as TeslaMate calculated in your first screenshot.

The total energy in your second screenshot is 44.447kWh and has a total of -£2.514, which makes sense as I assume your second screenshot is Octopus global energy readings rather than just the car, and it sounds reasonable that a reduction of 19% from 44.447kWh to 36.74kWh applied to -£2.514 gives -£2.03, a very close approximate figure to the actual calculated one.

So now we need to work out why it decided to put £3.11 in there, sounds very strange - first of all can you update TeslaMateAgile to latest by using docker-compose pull then docker-compose up -d can you use the pgAdmin to delete the cost value for this charging process (clear the field, it will go to null) and save, TeslaMate will regenerate the data within 5 minutes. Happy to walk you through this process on Facebook if you like.

StuFull commented 4 years ago

Will do.

Do you want me to delete the cost values for every data charged or just the one date we’ve been focussed on?

StuFull commented 4 years ago

I have done the above and it appears to have resolved it. Thanks.

MattJeanes commented 4 years ago

That's great to hear, glad we got it resolved and as an aside we now have a unit test to make sure this functionality doesn't break in the future!