Automated Submission Guide
Add this rest_command to your config and restart Home Assistant.
rest_command: upload_solar_yield: url: "https://solarrank.scottbrookesdesigns.com/automate.php?key={{ key_pass }}" method: POST payload: "name={{ name_pass }}&size={{ size_pass }}&output={{ output_pass }}&dir={{ direction }}" content_type: "application/x-www-form-urlencoded"
Create a new automation and switch to YAML Mode to paste the following:
alias: "Push Daily Solar Data" description: "Uploads data after sunset" triggers: - trigger: sun event: sunset offset: "00:30:00" actions: - delay: minutes: "{{ range(0, 50) | random }}" seconds: "{{ range(0, 60) | random }}" - action: rest_command.upload_solar_yield data: key_pass: "YOUR_KEY" name_pass: "YOUR_SITE_NAME" size_pass: SITE_KW_SIZE output_pass: "{{ states('sensor.DAILY_KWH_SENSOR') }}" direction: "S"
Use the Enphase App to find your local details:
Alternative: If supported by your network, you can use envoy.local as the IP.
Login to Enlighten on your browser, then click this link (replace SERIAL with your serial):
Get My Security Token⚠️ Note: This token expires after 1 year. You must renew it annually.
Copy the code below into a new text file and save it as solar.py on your computer or server. Ensure you have the requests library installed (pip install requests).
Edit the "USER CONFIGURATION" section in the code with your specific details:
import requests import time import random # --- USER CONFIGURATION --- GATEWAY_IP = "192.168.x.x" # The IP from Step 1 TOKEN = "PASTE_TOKEN_HERE" # The Token from Step 2 API_KEY = "YOUR_RANK_KEY" # The Key from Step 01 above SITE_NAME = "Your System Name" SITE_SIZE = 10.5 DIRECTION = "S" # Delay 1-180 mins to stagger updates time.sleep(random.randint(1, 180) * 60) requests.packages.urllib3.disable_warnings() headers = {'Authorization': f'Bearer {TOKEN}'} try: r = requests.get(f"https://{GATEWAY_IP}/ivp/pdm/energy", headers=headers, verify=False, timeout=10) wh_today = r.json()['production']['pcu']['wattHoursToday'] kwh_today = round(wh_today / 1000, 3) payload = {'name': SITE_NAME, 'size': SITE_SIZE, 'output': kwh_today, 'dir': DIRECTION} requests.post("https://solarrank.scottbrookesdesigns.com/automate.php?key="+API_KEY, data=payload) except Exception as e: print(f"Error: {e}")
crontab -e) to run the file nightly: 0 21 * * * /usr/bin/python3 /path/to/solar.pyFor custom setups or non-Enphase gateways.
import requests payload = { 'name': 'Site Name', 'size': 10.5, 'output': 42.1, 'dir': 'S' } requests.post("https://solarrank.scottbrookesdesigns.com/automate.php?key=YOUR_KEY", data=payload)
curl -X POST -d "name=SITE" -d "size=10" -d "output=50" -d "dir=S" "URL?key=KEY"
Backfill data from a CSV export. You need a Bulk Key to use this form.
KEY IS ONLY VALID FOR 1 SUBMISSION