Solarmon is a web application for monitoring the status of your solar panel array. It is easily deployable for free on Cloudflare Workers and R2.
- Monitoring of historical solar panel statistics
- View collected solar panel data
- Installable on mobile (as a PWA)
- Create an R2 bucket in your Cloudflare account.
- Take note of the bucket name, access key ID, secret access key, and R2 endpoint. You'll need these later.
- Also connect a Wi-Fi dongle (if Wi-Fi is not built in) and connect your device to a network with internet access.
- Connect a computer to the LAN port on the SunPower device.
- Ensure the computer has DHCP enabled to automatically obtain an IP address.
-
Copy the
collector.pyscript to the collector machine usingscp. For example:scp collector.py user@your_host:/home/user/collector.py
This script fetches data from the SunPower's local API and uploads the results to Cloudflare R2.
-
Edit the
collector.pyscript and replace the placeholder values with your actual R2 bucket credentials and SunPower device IP address. These values are secret, so don't share them anywhere!
-
Open the crontab editor by running:
crontab -e
-
Add a line to schedule the
collector.pyscript to run daily. Adjust the timing as needed. For example, to run it at midnight:
0 0 * * * python3 /home/user/collector.pyThis line tells cron to execute the collector.py script using python3 at 00:00 (midnight) every day. Be sure to replace /home/user/collector.py with the actual path to your script (it doesn't need to run as root).
Be careful with running the script too often, as it may cause excessive wear on the SunPower's internal storage.
