This project has moved and is read-only. For the latest updates, please go here.

Solar Timer Scheduler

Topics: 1. General
Aug 18, 2015 at 2:26 AM
Great project SbfSpot team, thanks. Not sure if this is of any interest but I've been working on a web based multi-Solar timer which will allow scheduling of various appliances to be switched on and off throughout the day to make best use of solar power available. I've just added SBFspot to the Pi timer and extracted the current solar power available to be included on the display for intelligent application to the timer as well. It's a work in progress but all the timer functions and scheduling is working fine. It's open source on github as 'Rasptimer' under 'infinityab'.
If anyone is just interested in the current solar power available for their own use here's the code snippit below in PHP - one of many I'm sure. (crontab designed by leader21 pimatic project - thanks)

first the crontab type - crontab -e and add

*/5 * * * * /usr/local/bin/sbfspot.3/SBFspot -v -nocsv -nosql -finq | cut --complement -s -f79 > /home/pi/sbfspot.log

or change to 7 minutes if you don't want it to clash with the current crontab.
This will produce a very curtailed logfile. Then we just need to strip out the bit we want.

function getSmaPower() {
$source = "/home/pi/sbfspot.log";   // get the current solar power available
$handle = fopen($source, 'r');
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        if (substr($line,1,5) == 'Total') {
                   $powerNow = $line;
}   else {
    // error opening the file.
return $powerNow;
Add this function and then call the function -

print ("Current Power : " . substr( $powerAvailable = getSmaPower(),15));

You can of course do away with the function and amalgamate it all into a single piece of code if you only require one instance of it. As it stands the solar available will update every 5 minutes but you will have to call the function to see it. A meta refresh could do automatically if it's for display on a web page.
Aug 18, 2015 at 12:04 PM
Hi infinityab,

I would be very interested in something able to maximize the use of energy produced by the solar panels. I have some question, considering the I made SBFspot to run properly only due to proper instruction available and I'm not so skilled with PHP and similar.
1) Is your system based on production data of PV plant or is it based on power/energy sold to the network?
2) Does your sistem allow to switch on/off the socket power feeding a certain appliance or to communicate with them in order to start/stop/modulate? In any case it would be very useful for equipment like dish washer, washing machine, a/c unit et so, but, from what I see they are too intelligent (If you just turn on the power, they will not start until a further input command) and they are too few intelligent (i.e.: to get command signals from a control system)
3) recently I installed the online controller on my daikin a/c; now I can control it via manually with my mobile (even outside home) based on monitoring; I'm looking a solution in which, based on the amount of extra power delivered to the electrical network, activates automatically the a/c (maybe with domoticz). Do you think that your system can be helpful in this way?

thanks and ciao,
Aug 18, 2015 at 11:38 PM
Hi Gabriele
OK firstly my programming skills are also pretty poor and I learn as I go along, I only started this about 8 weeks ago and it has been a slog at times. What made it a lot easier was using an open source Pool Timer program on github written by a very high level programmer as a starting point
I have only just added the SBFspot instantaneous Power Output of the SMA inverter/PVpanels to the timer and now deciding the best way to use it. I did not think that the excess power fed back to the grid was available at the inverter?
So I am thinking that maybe there should be two entries that can be made for every appliance, the trigger power for the appliance with some hysteresis and a drop-out value - all suggestions welcome. I am aiming to complete the first go at that in the next few days. The exclusivity of an appliance has already been added as an option so when that appliance switches on all the other exclusive appliances will switch off.
There will be wireless switched mobile outlets (sockets) I am just waiting for those to arrive and then I will add the software and adapt them to be triggered by the Pi - I consider this part essential. The Pi can of course drive mains directly from it's relay board and optionally an added contactor but this requires switchboard wiring - not everyone's choice.
And yes while the manufacturers tell us this and that appliance is user friendly they have in fact gone the other way and it is more and more difficult to drive these devices by just putting the power on. Fortunately the big power hungry appliances - water heaters, ordinary heaters, pumps etc can still be done this way. Taking back control of these appliances is a whole new project but worth looking into - checkout PIMATIC they are doing a great job with their virtual tmer.