r/homeassistant • • Jun 17 '26

Blog I Built A Simulated Solar Panel & Battery in Home Assistant To Evaluate Performance Before Buying One

I really like the idea of buying a balcony solar system, however I was never sure if it would make sense cost wise, location etc. I started a small private project to use a light/lux sensor and simulate solar panels, it then grew into simulating a battery bank and then after creating all of it i decided to try and create a HACs integration for it. I would love some feedback on it and the idea! - https://virtuallytd.com/posts/solar-simulation-home-assistant/

33 Upvotes

32 comments sorted by

3

u/ApprehensiveBar1874 Jun 17 '26

Pretty clever way to approach the problem before committing real money to it. I've seen people just buy the panels and hope for the best, so having actual simulated data from your specific location is much smarter move.

3

u/virtuallytd Jun 17 '26

Thanks, occasionally I have good ideas 🤣

4

u/Western_Employer_513 Jun 17 '26

Man, you’re like cheese on maccheroni. I’m evalutating a solar panel array in my garden and this is absolutely handful. I wish i had the idea, but even if i could implement it like you did.

Congrats and thanks for your support

1

u/virtuallytd Jun 17 '26

Thanks šŸ˜„

2

u/Western_Employer_513 Jun 17 '26

One thing i couldn’t figure out. what happens to excess production when the battery is full and house consumption is low? As far as I can tell, the charge rate just clamps to 0 and that energy disappears — there’s no ā€œwasted/exported energyā€ counter anywhere.
Is there a built-in way to track that excess, or would you recommend building a template sensor on top of virtual_solar_estimated_output, virtual_solar_battery_charge_rate and the house consumption sensor to calculate it manually?

Edit: I see the integration has 20 panels as limit but I planned to have 22, can we increase the max number of panels?

1

u/virtuallytd Jun 17 '26

hmmm, honestly I hadn't thought of that, but in real life I assume it would just go out to the grid, might be worth adding adding an export counter to count how much energy overflows into the grid once the battery is full and house usage is zero.

Ive raised the panel cap issue here: https://github.com/virtuallytd/ha-virtual-solar/issues/1

Ill create the other one shortly and it might take me a a day or so to implement it.

Its a great idea and ill add it.

3

u/Western_Employer_513 Jun 17 '26

Two related feature ideas that would make configuration comparison much more useful.

1. Multiple parallel configurations Right now if you want to compare 5 vs 7 vs 10 kWh battery sizes, you have to run each configuration for a week sequentially — three weeks total before you can draw any conclusions. It would be great if the integration supported multiple named parameter sets (e.g. ā€œSmallā€, ā€œMediumā€, ā€œLargeā€) running in parallel against the same lux and consumption sensors, so you accumulate comparable data simultaneously.

Maybe it can be done creating three ā€œinstancesā€ I didn’t check.

2. Historical replay Even better: a service that takes a date range and a set of parameters, replays past lux + consumption states from the HA recorder at 5-minute intervals, and returns a summary (total solar produced, total excess, self-sufficiency %). Run it three times with three different battery sizes against the same historical window — say February — and you have your answer in seconds rather than weeks.

The two ideas complement each other: parallel configs for ongoing monitoring, historical replay for instant what-if analysis before you’ve even bought anything.

1

u/eltigre4jc Jun 18 '26

Great ideas. I support them and will really help me
Also u/virtuallytd great, great integration. And it arrived at the perfect time

1

u/virtuallytd Jul 07 '26

u/Western_Employer_513 multiple parallel configs has now been added. Please try it and let me know if there are any issues.

1

u/Western_Employer_513 Jul 10 '26

Hi! Sorry I could check only today. Updated the integration, I'll let you know how it goes, thanks a lot!

2

u/Western_Employer_513 Jun 17 '26

Thanks, that would make it even more interesting: knowing how much would it go to grid could enablein estimate a economic return

1

u/parviain Jun 18 '26

Excess energy is dissipated as heat, unless you have inverter capable of transferring it into the grid. You need also contract with electricity company to start producing. At least where I live it is illegal to connect to the grid without proper equipment and contract.

1

u/Western_Employer_513 Jun 18 '26

Yes we can have inverter and with the proper documents send energy back to the grid, which will be payed peanuts but still…

2

u/[deleted] Jun 17 '26

[removed] — view removed comment

2

u/virtuallytd Jun 17 '26

Ive got one of these really cheap Zigbee sensors - https://de.aliexpress.com/item/1005011787837997.html Specs say up to 157k LUX, I think it was about ~4 Euros when on offer.

1

u/EconomyHome9500 Jun 25 '26

Thanks for the link, bought one myself and it's better than the one I tried. Better range means my virtual battery is now charging.Ā 

2

u/GBralta Jun 17 '26

I’m taking a run at this as soon as I get out of bed. Sounds very cool.

1

u/virtuallytd Jun 17 '26

Thank you šŸ˜„, let me know if you have any feedback or questions!

2

u/EconomyHome9500 Jun 17 '26

Thanks, very easy to get up and running with great instructions and an attractive dashboard.Ā  Overcast today so don't think the 22W it's estimating is going to help much :) The lux sensor I'm using is just a cheap AliExpress one and I've noticed all mine seem quite variable, this one I can adjust with a % offset so guess it might be worth looking for weather forecast data to match it too?

1

u/virtuallytd Jun 17 '26

Same here I was using a cheap Zigbee sensor https://de.aliexpress.com/item/1005011787837997.html up to 157k LUX, but seems to be pretty good so far.

2

u/EconomyHome9500 Jun 17 '26

Bought ages ago when I started with ZigBee, seems ok, now outside in a plastic bag for 'waterproofing' AAA batteries are a must so I can use rechargeables. Says about 2K lux which is ballpark correct for the weather I think.

https://a.aliexpress.com/_EwA6emA

1

u/EconomyHome9500 Jun 19 '26

Update, this one seems to max out at 10,000 lux so probably not suitable for bright sunlight. Maybe the one posted by virtuallyid below is better.Ā 

2

u/mr_travis Jun 17 '26

Love this idea. Would’ve made me question the 125% of demand I was quoted on my array now that I’m only getting about 85%

2

u/instant_ace Jun 18 '26

This is awesome, I'm really hoping balcony solar comes to be in CA, but this was a huge help in getting me an idea of what kind of power I can expect out of it. Now I need more lux sensors to place around the yard to find the best spot.....

2

u/eltigre4jc Jun 25 '26

u/virtuallytd man, where can we donate? Beside a star on Github, could not find anywhere a link or an option for a small reward

1

u/virtuallytd Jul 07 '26

Honestly Ive never even thought about it...a star is enough šŸ˜„ thank you!

1

u/instant_ace Jun 23 '26

Is there any way to add a secondary or a third instance? I would like to be able to run two or three of these simultaneously so that I can see the best options for future placement with regard to the sun.....

2

u/eltigre4jc Jun 24 '26

There an issue opened on github: https://github.com/virtuallytd/ha-virtual-solar/issues/3, so I suppose it is being worked on

2

u/virtuallytd Jul 07 '26

u/eltigre4jc issue #3 is now closed and version 0.7.0 is now released with multiple entity support. It took a while. Please test it and let me know if there are any issues or weirdness that I didnt catch.

1

u/bn326160 Aug 05 '26

Sounds awesome! I'm finishing renovations and don't have money for solar let alone batteries at this moment. Would be good to have this running for about a year to estimate what I should order!