Homey Community Forum

Charge car with solar panels

Hello, I have a solar installation (SolarEdge) and a car charger (go-eCharger HOMEfix). Both are compatible with Homey. I am about to set up some Flows to charge my vehicles as much as possible when there is enough sunlight. Basically, permission to charge should be given when there is enough sunlight, and permission should be withdrawn when there is not enough. Of course, the system should not be too sensitive and should not switch on/off every minute, for example when a single cloud passes by.
I already have several ideas on how to set this up myself, but I’m pretty sure it’s already been done by others. So I’m calling for your most interesting flows :wink: Thanks a lot in advance!

PS: This system replaces my old system based on a KEBA Connect charging station and a Smartfox Pro. This system worked well, but is relatively expensive and Homey is able to do exactly the same without additional hardware like a Smartfox Pro or any other optimizer.

1 Like

I would approach this with a sensor that measures the brightness and writes it to a variable.
I would query this variable every xx minutes and then trigger the flow with greater / less than.

If you are fit with variables, you can also calculate a variable.
For example, you measure the brightness 1x per minute and add the values ​​in a variable. After 15 minutes you divide the value by 15 and have the result written to a second variable.
So you get an average value every 15 minutes.

Thank you very much for your quick feedback and advice! There are lots of good ideas here! Actually, which app would you use to do an average calculation for example?

Personally, I wasn’t thinking of using a light sensor. Indeed, my SolarEdge solar system coupled with the SolarEdge app (congratulations to the developer Homey of this app by the way!) gives me a very accurate feedback of the solar energy produced, of the consumption of the house, and also of the available energy reinjected in the electrical network (Power Export). In this case, the “Power Export” value is in my opinion much more useful and precise than a luminosity sensor, even if it remains a possible way. So it’s more of an average of the “Power Export” that I would do over a few minutes to check that the production is stable

You can do calculations with variables.

As an example, here is my calculation of power consumption

The average is calculated after one hour

The result of the calculation is then displayed on my LaMetics and the variables are reset to zero. The game then starts all over again. This shows the average consumption every hour

Just remember that when your car is being charged, that value will drop significantly :wink:

You’re totally right, and that’s why we’ll certainly have to make another flow that takes this into account to stop the load. Another solution would be to take the “Solar Power” value with a margin for the house consumption. I don’t have the right solution yet, that’s why this topic exists :wink:
I just think that using a light sensor can potentially be misleading. Indeed, with equal luminosity, a solar installation produces much more if it is cold than if it is very hot outside.

Why use a seperate light sensor? Your solar panels are a big light sensor. Just average your solar output for e.g. 15 minutes. If this average is significantly above your normal household usage switch on the charger. When it drops below your normal household usage switch off the charger.

Or a different strategy when you want to prevent feeding to the grid: you need to know your actual solar production, your actual car charging usage, and your actual total house usage/production (from /to grid). If To Grid > 200W then start charging. If From Grid > (car charger + solar production) then stop charging.

I think a lot can be improved with above strategy, but it is a starting point to finetune.

This was a suggestion from another contributor, but all ideas are welcome!

I would be very interested to know how you get the value “Strom Durschnitt”. My idea: put three measurements separated in time into three different Logic variables, then regularly calculate the average of these three values and put the result into a fourth value in Logic. Do you do this?

It would work like this. The result would be similar to my example of average consumption.

You can get a rolling average with just one variable. The formula depends on the sample rate. E.g. for a 15 minute average with a sample every minute the formula is:

15minAvg = (15minAvg * 14/15) + powerSample / 15

Thank you very much, it would be perfect with only one variable! So you have to calculate only one Logic variable with this formula? Specifically, it would be {{(15minAvg*14/15)+Solar Power/15}} right? What if I want to do for 5 minutes for example (just to make sure I got it right)? {{(5minAvg*4/5)+Solar Power/5}} ? Where can we find these example formulas or explanations?


(Avg * (#samples - 1) / #samples) + (sampleValue / #samples)

Cant find the source anymore but I have used it for some years now to get average humidity in my bathroom to switch on/of the fan.

Which is the same as this:

(Avg * (#samples - 1) + sampleValue) / #samples

Intuitively, the previous average was based on #samples - 1 samples, so the total sum of the values would have been the old average times the old number of samples (Avg * (#samples - 1)).

To get the new average, add the new value to the total (+ sampleValue), then calculate the new average by dividing the total by the new number of samples (/ #samples).

Hi and thank you for all the informations. I tried with this flow, but the flow does not work. Any idea why?

Avg should be a tag pointing to the variable that you are using (in your case the variable name is Test Moyenne Avec Formule, you need to re-use that variable inside of the formula).

One question is also that how the used/produced energy is calculated for billing?

In Finland for example the energy will be mandatory to be billed with hour base net sum.

This means that all measured production and consumption during the hour in all phases is summed and the billing is based on that.

Rough example is that you can for example produce 400W in L1, 200W in L2 and 600W in L3 for first 30min of an hour, equals 0,6kWh. And then consume 1200W in L1 and 0W In L2 and L3 for the Last 30min, equals 0,6kWh. Then the net sum for the hour is 0kWh and nothing is billed.

This opens more possibilities to control the consumption of own production.

Other countries may have other kind of billing habits.

Thank you very much for the precision! Actually, I’m locking for a formula that calculate every 5 minutes the average of the LAST 5 minutes (or 10 minutes every 10 minutes…), and not the totality of the day. Is this formula effectively working in that way?

No, the suggested formula is a running moving average, I think. It will always take into account all the previous values, not just the last X values.

I’m not really into this, but just wondering, can’t you set like 12 number variables and use those ?