Skip to content

Haselmaier/Suncatcher

Repository files navigation

Suncatcher

Capabilities Summary

  • During the day Suncatcher (on a 10 min interval) 1/ determines if electricty is being pulled from the grid (consumption in the home is greater than current solar production) or being pushed to the grid (current solar production is greater than electricity consumption).
  • Suncatcher adjusts the Tesla charging rate based on how much electricity is being pushed to or pulled from the grid - with the goal being to have all solar output either being consumed by the home or sent to the car. When electricity is being pulled from the grid the car charging rate is reduced. When electricity is being sent to the grid the car charging rate is increased.
  • Suncatcher will charge the car at night (from the grid) to a minimum level - as specified by the user. The intent/assumption is that a minimum charge is desired to be had at the end of the day in case of unexpected emergencies. (e.g. drive to the hospital in the middle of the night). The author's use case causes this to be set to 50%.
  • Suncatcher will stop car charging during the day when a certain battery percentage has been reached. Ex: The author rarely needs more than 15% of battery for normal, daily driving. Suncatcher will stop charging during the day when battery charge is 15% higher than the minimum required night time charge. The presumption is any amount needed over what is needed for daily driving is best sold back to the utility for bill credit.
  • A detailed log is written every 10 minutes to /home/pi/Desktop/Tesla/Logs - with each day (starting at 5:00am) having it's own log file.
Requirements
  • Eagle-200 energy gateway from Rainforest Automation. Connects wirelessly (via zigbee) to consumer's smart electric meter. Connecting the Eagle-200 with the smart meter reuires coordination with the utility. The utility goes through a procurement process to permit the meter to connect with the energy gateway. This process can take 3-8 days total.
  • Device that can run Python. (PC, Linux system, Raspberry Pi)
  • Solaredge solar panel inverter. Having this inverter isn't really a requirement. The software is set up to capture current solar panel output - which gets written to the log file every 10 minutes. This information isn't essential to effective Tesla charging control, but it is interesting information to have in order to track solar production along with charging rate. If the user does not have a Solaredge inverter calls to the 'solar' function can commented out. If this is done adjustments will need to be made to the write_log() function to account for the fact solar data will not be available to be logged.
Configuration (assumes Raspberry Pi)
  • Create directory: /home/pi/Desktop/Tesla
  • Create directory: /home/pi/Desktop/Tesla/Logs
  • Install Python packages: teslapy, ast, requests
  • Place commands.xml in /home/pi/Desktop/Tesla. This file contains the commands needed for the Eagle-200 energy gateway.
  • Place Suncatcher source in /home/pi/Desktop/Tesla
  • Make necessary changes to Suncatcher source:
    • Line 13: Enter email address for Tesla account that contains car to be charged using Suncatcher.
    • Line 50: Enter local IP address for Eagle-200.
    • Line 52: Enter 32-character authorization token for Eagle-200. The most reliable way to generate the token is using the Advanced REST Client. Enter Eagle-200 cloudID as the username and its install code as the password. The REST Client will generate the token - which can be entered into the Suncatcher code.
    • Line 117: Solaredge Inverter API key. This can be obtained from Solaredge or your solar panel installer.
    • Line 118: Solaredge Site ID: This can be found in your Solaredge account.
    • Line 159: Adjust location where logs are to be written as desired.
    • Line 173: Minimum car battery % Suncatcher should charge to at night - using electricity from the grid.
    • Line 174: Maximum car battery % Suncatcher should charge to during the day.
    • Line 175: Latitude of user's home.
    • Line 176: Longitude of user's home.
    • Line 177: Hour peak electric pricing begins.
    • Line 178: Hour peak electric pricing ends.
    • Line 179: Minimum amount of electricity that is being pulled from the grid to cause a re-calculation of car charging rate to be done. (pulling less than this amount will cause the car charging rate to not be changed.)
    • Line 180: Minimum amount of electricity that is being pushed to the grid to cause a re-calculation of car charging rate to be done. (pushing less than this amount will cause the car charging rate to not be changed.)

First Use
The Tesla API requires authorization tokens in order to get information from the car as well as change car settings. When the program is first run a web browser will be launched with fields to enter Tesla account credentials (email and password). The resulting web page will have an error displayed. However the URL in the browser needs to be copied in its entirety and pasted into the field presented by the software. The resulting tokens will be written to a file. This login sequence will only need to be done the first time the software is run.

Stability / Bugs
The code is reasonably stable. Error checking has not been implemented in some areas (such as getting status from the Eagle-200) which can cause the software to crash. It needs to be monitored to see if it has crashed. No auto-restart capability has yet been implemented in the event of a crash.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages