All Projects → MattJeanes → TeslaMateAgile

MattJeanes / TeslaMateAgile

Licence: other
Integration to automatically fill in prices for charge data captured by TeslaMate for smart energy providers

Programming Languages

C#
18002 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to TeslaMateAgile

teslamateapi
TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON
Stars: ✭ 47 (+17.5%)
Mutual labels:  tesla, teslamate
TeslaPy
A Python module to use the Tesla Motors Owner API
Stars: ✭ 216 (+440%)
Mutual labels:  tesla
openpilot
FOR PRE-AP/AP1/AP2 TESLA CARS ONLY: open source driving agent. You can help development by donating @ https://github.com/sponsors/BogGyver
Stars: ✭ 30 (-25%)
Mutual labels:  tesla
teslaapi.io
Unofficial Tesla API Documentation
Stars: ✭ 29 (-27.5%)
Mutual labels:  tesla
alexa-tesla
Alexa Skills Kit (ASK) project - Tesla monitoring and control for Amazon Echo devices
Stars: ✭ 23 (-42.5%)
Mutual labels:  tesla
hassio-addon-teslamate
Teslamate addon for Home Assistant
Stars: ✭ 37 (-7.5%)
Mutual labels:  teslamate
tesla
Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.
Stars: ✭ 145 (+262.5%)
Mutual labels:  tesla
hashcat-benchmark-comparison
Hashcat Benchmark Comparison
Stars: ✭ 22 (-45%)
Mutual labels:  tesla
OctopusTentacle
| Public | The secure, lightweight, cross-platform agent for Octopus Server which turns any computer into a worker or deployment target for automated deployments and operations runbooks.
Stars: ✭ 25 (-37.5%)
Mutual labels:  octopus
tesla.dart
Tesla Client Library for Dart
Stars: ✭ 28 (-30%)
Mutual labels:  tesla
node-tesla-data
App which pulls and stores Tesla data in a MySQL database
Stars: ✭ 28 (-30%)
Mutual labels:  tesla
Animated-Tesla-Car-App-using-Flutter
No description or website provided.
Stars: ✭ 141 (+252.5%)
Mutual labels:  tesla
teslausb
Steps and scripts for turning a Raspberry Pi into a useful USB drive for a Tesla
Stars: ✭ 1,426 (+3465%)
Mutual labels:  tesla
ha-config-ataraxis
My Home Assistant Configs. If you like what you see, please ⭐️my repo. It would encourage me a lot 🤘
Stars: ✭ 146 (+265%)
Mutual labels:  tesla
tesla auth
Securely generate API tokens for third-party access to your Tesla.
Stars: ✭ 114 (+185%)
Mutual labels:  tesla
tesla powerwall
Python API for Tesla Powerwall
Stars: ✭ 43 (+7.5%)
Mutual labels:  tesla
testube
fullscreen entertainment options for your tesla
Stars: ✭ 23 (-42.5%)
Mutual labels:  tesla
TeslaKit
Elegant Tesla API in Swift
Stars: ✭ 47 (+17.5%)
Mutual labels:  tesla
tesla api
Lightweight Python API client for the Tesla API.
Stars: ✭ 73 (+82.5%)
Mutual labels:  tesla
tesla-api
Unofficial API Wrapper for Tesla Model S and X. #follows-javascript-conventions #es6 #es7
Stars: ✭ 24 (-40%)
Mutual labels:  tesla

TeslaMateAgile

Description

This app will automatically update your cost for charge sessions in TeslaMate within a specified geofence (usually home) using data from your smart electricity tariff.

Supported energy providers / tarriffs:

How to use

You can either use it in a Docker container or go to the releases and download the zip of the latest one and run it on the command line using ./TeslaMateAgile.

If you have used the TeslaMate Docker install guide you can simply add this section to the services: section of the docker-compose.yml file and change the variables as required:

services:

  teslamateagile:
    image: mattjeanes/teslamateagile:latest
    restart: always
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=secret
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
      - TeslaMate__UpdateIntervalSeconds=300
      - TeslaMate__GeofenceId=1
      - TeslaMate__EnergyProvider=Octopus
      - Octopus__RegionCode=A # Octopus Energy only
      - Tibber__AccessToken=abc123 # Tibber only

See below for how to configure the environment variables appropriately

Required environment variables

- TeslaMate__UpdateIntervalSeconds=300 # Check for completed charges without a set cost every x seconds
- TeslaMate__GeofenceId=1 # You can get this by editing the Geofence inside TeslaMate and getting it from the url 

Octopus Energy

- TeslaMate__EnergyProvider=Octopus
- Octopus__RegionCode=A # See below Octopus Region Code section

Tibber

- TeslaMate__EnergyProvider=Tibber
- Tibber__AccessToken=abc123 # See below Tibber Access Token section

Fixed Price

- TeslaMate__EnergyProvider=FixedPrice
- FixedPrice__TimeZone=Europe/London # IANA (tz database) time zone code, used for below times 
- FixedPrice__Prices__0=08:00-13:00=0.1559 # Cost is in your currency e.g. pounds, euros, dollars (not pennies, cents, etc)
- FixedPrice__Prices__1=13:00-20:00=0.05 # You can have as many as these as you need
- FixedPrice__Prices__2=20:00-03:30=0.04
- FixedPrice__Prices__3=03:30-06:00=0.035
- FixedPrice__Prices__4=06:00-08:00=0.02

aWATTar

- TeslaMate__EnergyProvider=Awattar
- Awattar__VATMultiplier=1.00 # Optional (default: 1.19), you should not need to set this unless your VAT differs from the default

Barry

- TeslaMate__EnergyProvider=Barry
- Barry__ApiKey=XXXXX # See below Barry Access Token section
- Barry__MPID=YYYYY # See below Barry MPID section

Optional environment variables

- Logging__LogLevel__Default=Debug # Enables debug logging, useful for seeing exactly how a charge was calculated
- Logging__Console__FormatterName=simple # This and the below env var will prepend a timestamp to every log message the same way TeslaMate does
- "Logging__Console__FormatterOptions__TimestampFormat=yyyy-MM-dd HH:mm:ss.fff " # See above env var
- TeslaMate__FeePerKilowattHour=0.25 # Adds a flat fee per kWh, useful for certain arrangements (default: 0)

Database connection

You also need to configure the database connection to the TeslaMate PostgreSQL database, you can do this either by supplying a PostgreSQL connection string directly or by using the same ones used by TeslaMate in the docker-compose.yml

- DATABASE_HOST=database
- DATABASE_NAME=teslamate
- DATABASE_USER=teslamate
- DATABASE_PASS=secret
- DATABASE_PORT=5432 # Optional (default: 5432)

OR (not recommended)

- ConnectionStrings__TeslaMate=Host=database;Database=teslamate;User Id=teslamate;Password=secret;

Energy provider setup

Octopus Region Code

Electricity tariffs in Octopus Energy are separated into multiple regions depending on where you live, in order to find your code you can use one of two methods:

  1. Go to https://octopus.energy/dashboard/developer/
  2. Under Unit Rates, just before 'standard-unit-rates' in the URL provided there is a letter, this is your region code
  3. For example in https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/E-1R-AGILE-18-02-21-A/standard-unit-rates/ your region code is A

Or if you're familar with curl / postman / etc

  1. Call GET https://api.octopus.energy/v1/industry/grid-supply-points?postcode=POSTCODEHERE
  2. You will get a response with "group_id": "_A" for example, A is your region code

Tibber Access Token

Tibber requires users to supply their access token to provide pricing information for their tarriff. It is only used to query tarriff information and at no point does TeslaMateAgile request or access any data related to consumption or any account details. You can find the related code here.

You can acquire this token here: https://developer.tibber.com/settings/accesstoken

Barry

Barry Access Token

Can be obtained from the app. Add-Ons -> barry API (BETA) -> Create a new token (green button at the bottom)

Barry MPID

Can be obtained from the app. Home & meter info -> Consumption metering point -> Metering point ID.

Throttling

  • Short Time Throttle - The current limit is set to 10 calls every minute.
  • Long Time Throttle - The current limit is set to 500 calls every 24 hours.

If you have a lot of charges that needs to be updated make sure that you set the interval to something bigger than 60 seconds and it will update 10 charges per minute (maximum 500 a day). Afterwards the interval could be increased to something like once an hour.

Troubleshooting

Recalculating charge costs

In some cases you may want to tell TeslaMateAgile to recalculate a particular charge, to do this you need to set the cost column in the charging_processes table in the TeslaMate PostgreSQL database to NULL for the charges you want to recalculate.

You should filter this by a particular charge id or by geofence_id if you want to recalculate everything. To find a particular charge id, look in the URL when viewing it in Grafana, it should be on the end of the URL: ...&var-charging_process_id=xxx.

TeslaMate has a guide on manually fixing data here: https://docs.teslamate.org/docs/maintenance/manually_fixing_data

Common SQL queries

Recalculate charge costs for a particular charge: UPDATE charging_processes SET cost=NULL WHERE id={ChargeId} Recalculate charge costs for all charges at your GeofenceId: UPDATE charging_processes SET cost=NULL WHERE geofence_id={GeofenceId}

Please be careful when running SQL queries against your TeslaMate database as they may result in permanent data loss. Take a backup of your database before if you're not sure.

Docker support

This project is available on Docker

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].