Using Saturn Cloud - TonyM1958/FoxESS-Cloud GitHub Wiki
This page describes how to setup a scheduled job to run in SaturnCloud and provides scripts for configuring and setting battery charge times and uploading data to PV Output.
Go to FoxESSCloud. Login and click on your account and select Account Profile and then API Management. Generate an API Key. Copy and save your API key. You will need this when you conifgure any scripts or apps that need access to your Fox account.

Go to SaturnCloud and register for a free Saturn Cloud Hosted account. You will recieve a free allocation of runtime per month and can link your exiting Google or Github accounts or create a new account.
Alternatively, sign up for Saturn Cloud Pro. The initial cost is just $5 and the cost to run a daily scheduled job is around $10 a year.
You can store personal information using the Secrets store in your account. This information is not shared with anyone else but can be made available when you run a scheduled job so it can do things like login to the Fox ESS Cloud account to retrieve data or update inverter settings.
Each secret has an upper case name and a parameter value must be enclosed in double quotes. You add Secrets by clicking on 'Secrets' in your account menu bar and then clicking 'New', entering the name and value and then clicking 'Add'. Add the following secrets:
- FOX_API_KEY the API key for your Fox ESS account. The value must be in double quotes e.g. "<your api key>"
- FOX_DEVICE_SN the serial number of your inverter e.g. "<your serial number>"
Optional:
- PV_API_KEY the API key created to allow data to be uploaded to your account in pvoutput.org e.g. "<your api key>"
- PV_SYSTEM_ID the System ID for your PV output data e.g. "<your system id>"
- SOLCAST_API_KEY the API key to access forecast data from the solcast.com account e.g. "<your api key>"
- PUSHOVER_USER_KEY the user key to send messages to your pushover.net account e.g. "<your user key>"
When you have finished, your Secrets should look like this:

Click on 'Resources' in your account and you will see the following options:
Click on New Job and then click 'Start from a recipe'. Go to this page and click 'copy raw file' (icon in the top right hand corner with 2 boxes) and then paste this (ctrl+V) in the Recipe window, give the job an owner and name and click 'Create'.
You should now be able to access the job in your Resource and see the overview:

The job is scheduled to run at 10pm and 11pm (note that times in Saturn Cloud are GMT, so the run times will be 1 hour later during BST). When the job runs, it will:
- configure your tariff, including working out the best charge times if you are using Agile
- check your battery charge, forecast generation and consumption and work out if you need to charge from grid
- download your complete generation data for yesterday and upload this to PV Ouptut
- download your partial generation data for today and uploads this to PV Output
If you go to Resources and click on the job foxess, there is an 'Edit' button in the top right hand corner. Click this and you will see Overview, Schedule, Environment Variables and Start Script (Bash) for your job. Under Start Script, you will see the script that will run:
#! /usr/bin/bash
cat > script.py <<EOF
import foxesscloud.openapi as f
f.api_key = ${FOX_API_KEY:-None}
f.device_sn = ${FOX_DEVICE_SN:-None}
f.pv_api_key = ${PV_API_KEY:-None}
f.pv_system_id = ${PV_SYSTEM_ID:-None}
f.solcast_api_key = ${SOLCAST_API_KEY:-None}
f.pushover_user_key = ${PUSHOVER_USER_KEY:-None}
f.plot_file = "plot###.png"
f.residual_handling = 1
f.set_tariff('go',region='H')
f.charge_needed(update_settings=1,charge_current=15,timed_mode=0,force_charge=0)
f.set_pvoutput(tou=1,push=2)
EOF
This creates the python script that will run. The script appears inline and loads the Fox ESS cloud module and secrets you previously configured before running various functions.
You can edit the script to configure your tariff and charging.
- f.residual_handling is explained here:
- f.set_tariff parameters are explained here.
- f.charge_needed() parameters are explained here.
- f.set_pvoutput parameters are explained here.
You may find it easier to configure and test the parameters you plan to use in Jupyter Lab and then copy these over to the script. After you have made any changes, click the 'Submit' button at the bottom of the page.
Go to the Overview.
Move the slider by 'Schedule' to On and click 'Start'. After a few minutes, the job should complete and look like this:

Click on 'Logs' and expand the main entry to see what happened:

If there is an error, check your Secrets have been entered correctly (username and password) and also any changes to your Environment Variables.
You can test your changes by going to Overview and clicking 'Start'.
The time that the job runs is set by the Cron Schedule in the job details. You can alter this if you wish:

The Cron Schedule consists of 5 elements, explained here. Saturn Cloud's Cron runs with UTC system time so the default schedule runs the job at 22:01 UTC every day. This means, in the UK, the job will run at 22:01 in Winter time and 23:01 in Summer time.
If you want the job to run at 22:01 in Summer time, change the Cron Schedule from 22 to 21 when the clocks go forward in Spring and revert to 22 when the clocks go back in Autumn.
Pushover is a short messaging app (up to 1024 characters) that can be installed on your Android or Apple phone or tablet. It looks like this:
You can register for an account at pushover.net and get a user key.
Download the Pushover app from the Google or Apple or App Stores for your phone or tablet. Pushover is a free 30-day trial with a cost of $5 per platform (up to 10 Android or 10 Apple devices) for a perpetual licence.
Once you install the app and setup your user key, the jobs you run will send a summary to your Pushover account when they run.
This happens if a parameter or secret is not configured correctly. Please ensure all of the values you entered for your Secrets are contained in double quotes.
This happens because access to the internet for jobs running under free accounts is blocked. Email [email protected] and ask them to unblock the following URLs:
https://www.foxesscloud.com/*
https://pvoutput.org/*
https://api.solcast.com.au/*
https://api.octopus.energy/*
Alternatively, signing up to Saturn Cloud Pro, unlocks internet access from jobs. The charges are low, with an initial payment of $5 and a charge of $0.06 for each hour of runtime (using a medium instance). Consuming 15 hours per month should cost $10 a year. You can also downgrade back to free if you wish.