TeslaMateAgile
Integration to automatically fill in prices for charge data captured by TeslaMate for smart energy providers
Install / Use
/learn @AmyJeanes/TeslaMateAgileREADME
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:
- Octopus Energy: Agile Octopus
- Tibber
- Fixed Price (manually specify prices for different times of the day)
- aWATTar
- Energinet
- Home Assistant
- Monta
- EDF Tempo
- PGE (Pacific Gas & Electric) Day-Ahead Market
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.
Alternatively, if you are using Home Assistant OS (or supervised) @tougher has wrapped this project in a Home Assistant Addon: tougher/hassio-addon-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: ghcr.io/amyjeanes/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=3600 # Scan interval for finished charges, should not exceed lookback days if set
- 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
- Tibber__HomeId=c0693acc-567d-49d4-87d9-71a66d10f5c7 # Optional: See below Tibber Multiple Homes section
Fixed Price
The Fixed Price provider allows you to use TeslaMateAgile if you have a fixed price for electricity at different times of the day. This is useful if you have a simple time-of-use tariff that isn't supported by the other providers.
- 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
Fixed Price (Weekly)
The Fixed Price Weekly provider is similar to the Fixed Price provider but allows you to set different prices for different days of the week. This is useful if your electricity tariff changes on different days of the week but is consistent week-to-week, e.g. a weekday / weekend tariff.
- TeslaMate__EnergyProvider=FixedPriceWeekly
- FixedPriceWeekly__TimeZone=Europe/London # IANA (tz database) time zone code, used for below times
- FixedPriceWeekly__Prices__0=Mon-Wed=08:00-13:00=0.1559 # Cost is in your currency e.g. pounds, euros, dollars (not pennies, cents, etc)
- FixedPriceWeekly__Prices__1=Mon-Wed=13:00-08:00=0.05 # Day(s) of the week can be comma separated or a range (e.g. Mon-Fri or Mon,Wed,Fri)
- FixedPriceWeekly__Prices__2=Thu=0.22 # The time range is optional and will be used for the whole day if unspecified
- FixedPriceWeekly__Prices__3=Fri,Sat=08:00-18:00=0.1559 # You can have as many as these as you need
- FixedPriceWeekly__Prices__4=Fri,Sat=18:00-08:00=0.04
- FixedPriceWeekly__Prices__5=Sun=12:00-18:00=0.1559
- FixedPriceWeekly__Prices__6=Sun=18:00-08:00=0.04
- FixedPriceWeekly__Prices__7=Sun=08:00-12:00=0.1559
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
Energinet
- TeslaMate__EnergyProvider=Energinet
- Energinet__Region=YYYYY # See below Energinet regions section
- Energinet__Currency=DKK # See below Energinet currencies section
- Energinet__VAT=1.25 # Optional: VAT multiplier. In this example 25%
- Energinet__ClampNegativePrices=false # Optional: Clamp negative prices to 0 (default: false)
- Energinet__FixedPrices__TimeZone=Europe/Copenhagen # Optional: IANA (tz database) time zone code, used for below times
- Energinet__FixedPrices__Prices__0=00:00-17:00=0.1432 # Optional: You can have as many as these as you need
- Energinet__FixedPrices__Prices__1=17:00-20:00=0.3983
- Energinet__FixedPrices__Prices__2=20:00-00:00=0.1432
Home Assistant
- TeslaMate__EnergyProvider=HomeAssistant
- TeslaMate__LookbackDays=7 # Optional: Highly recommended, see below Optional environment variables section
- HomeAssistant__BaseUrl=http://homeassistant.local:8123 # URL to your Home Assistant instance
- HomeAssistant__AccessToken=abc123 # Long-lived access token for Home Assistant
- HomeAssistant__EntityId=input_number.energy_price # ID of the number-based entity containing price data in Home Assistant (Cost is in your currency e.g. pounds, euros, dollars (not pennies, cents, etc))
Monta
- TeslaMate__EnergyProvider=Monta
- Monta__ClientId=abc123 # Client ID of your Monta Public API app
- Monta__ClientSecret=abc123 # Client secret of your Monta Publiic API app
- Monta__ChargePointId=123 # Optional: Restrict searches to a particular charge point ID
EDF Tempo
The EDF Tempo provider allows you to use TeslaMateAgile with the EDF Tempo tariff, which offers different pricing based on day color (Blue, White, Red) and time of day (Peak/Off-peak hours).
- TeslaMate__EnergyProvider=EDFTempo
- EDFTempo__BaseUrl=https://www.api-couleur-tempo.fr/api/joursTempo # EDF Tempo API endpoint
- EDFTempo__BLUE_HP=0.1612 # Blue day peak hours price (€/kWh)
- EDFTempo__BLUE_HC=0.1325 # Blue day off-peak hours price (€/kWh)
- EDFTempo__WHITE_HP=0.1871 # White day peak hours price (€/kWh)
- EDFTempo__WHITE_HC=0.1499 # White day off-peak hours price (€/kWh)
- EDFTempo__RED_HP=0.7060 # Red day peak hours price (€/kWh)
- EDFTempo__RED_HC=0.1575 # Red day off-peak hours price (€/kWh)
Note: EDF Tempo pricing uses French time (Central European Time) and follows this schedule:
- Off-peak hours: 22:00-06:00
- Peak hours: 06:00-22:00
Important: The prices shown in this README may not reflect the current EDF Tempo rates. Please verify and use the latest pricing from EDF Tempo for your configuration.
PGE (Pacific Gas & Electric)
The PGE provider allows you to use TeslaMateAgile with Pacific Gas & Electric's day-ahead market pricing. The pricing is published at 6pm (18:00) Pacific Time and is valid for the following day.
- TeslaMate__EnergyProvider=PGE
- PGE__RateName=EV2A # Your specific PGE rate plan (e.g., EV2A, E-ELEC, etc.)
- PGE__RepresentativeCircuitId=123456789 # Your specific circuit identifier for your service territory
- PGE__BaseUrl=https://pge-pe-api.gridx.com # Optional: PGE API endpoint
- PGE__Utility=PGE # Optional: Utility name
- PGE__Market=DAM # Optional: Market type - Day-Ahead Market
- PGE__Program=CalFUSE # Optional: Program name
How to find your values:
RateName: Check your PGE bill or account online for your rate scheduleRepresentativeCircuitId: This identifies your local pricing zone - you may need to contact PGE customer service or check their website for your area's circuit ID
Note: Pricing is published daily at 6pm Pacific Time for the following day. Make sure your UpdateIntervalSeconds allows for regular updates to catch new pricing data.
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)
- TeslaMate__LookbackDays=7 # Only calculate charges started in the last x days (default: null, all charges)
- TeslaMate__Phases=1 # Number of phases your charger is connected to (default: null, auto-detect)
- TeslaMate__MatchingStartToleranceMinutes=30 # Tolerance in minutes for matching charge times for whole cost providers (default: 30)
- TeslaMate__MatchingEndToleranceMinutes=120 # Tolerance in minutes for matching charge times for whole cost providers (default: 30)
- TeslaMate__MatchingEnergyToleranceRatio=0.1 # Tolerance ratio for matching energy for whole cost providers that provide energy data (default: 0.1)
- TeslaMate__RateLimitMaxRequests=10 # Max requests per period for rate limiting, must also set RateLimitPeriodSeconds (default: 0 = no limit)
- TeslaMate__RateLimitPeriodSeconds=60 # Period in seconds for rate limiting, must also set RateLimitMaxReq
