Homey Community Forum

Solar Panels prognosis with Homeyscript ☀

I wrote a script to get the production data of my Solar Panels, including day, month and year prognosis. The production of your solar panels will be updated with some better logic variables.The output will in this example be automatically forwarded tot your mobile. I use a picture from the Gallery app. But the output can also be emailed.

I am aware that I am certainly no programmer, therefore I tried to make the best of it. Hope you appreciate it.

Install Homeyscript and Better Logic. Read the remarks at the top of the script and make the variables as stated also at the top of the script. Copy the script from a computer(not mobile or tablet because of false copying of the quotation marks) and make a new script called Solar Panels. Paste the script and save.

Make three flows:
The first flow will give you the prognosis when your solar panels have stopped producing

The second flow is the actual flow to get the prognosis. I have made this flow a favorit in Homey. That way I can run the flow from a widget on Iphone.

The third flow is a flow to update the better logic variables

Because i have some issues with Homeyscript and memory I restart the Homeyscript app in every flow.

Example of the output:

Below you will find the download for my script. I have added the option to use two languages;
English and Dutch. Feel free to adjust the script, rewrite it and improve it. Would be nice if you post it in this topic. I wish you many sunny hours . :sunny: :sunny:

1 Like

You can download the complete file Here
I use the free app codelobster to save all my JS files and copy them into
Homeyscript. Codelobster is a Free cross-platform IDE for PHP/HTML/CSS/JavaScript development

Removed the two separate files which you had to compile, because I added a download link for the whole file. In case of adding functionality the download link will always been updated to the newest script.

New functionality I want;

Daylight saving settings
Database for all data

I’m no native English speaker and it’s super nitpicking, but shouldn’t it be “until” instead of “untill”?

:hugs:no am I. Will replace it asap.

Done! thx for imput

How do you get/calculate all prognosis values?

PS: I think “Case Sensitive” makes more sense than “Capital Sensitive”.

Thx and i have to admit, my english is not very good. Will adjust.

Just by using many many variables

Not sure we’re talking about the same thing…

I was asking about the initial values for all 12 months:

How does one get those values? (like 162.49 for January)

By looking at the historic production data of my panels, I guess?

Historic data is the most reliable option. I got the prognosis from the manufacturer. I suppose one can calculate the prognosis himself but therefore you have to search On the internet.

Probably it is something like; average sunhours in your region per month * max solarpanel capacity. Minus a percentage which degree the panel is mounted (south, north exact degree) and the angle the panel is mounted. Also shade can reduce the production

Maybe you can figure that out.

At this moment i have a problem when i update the variable SolarYear and SolarMonth. It looks like it has something to do with accountautoritation. Have to look into it. Working workaround is disable the update of those two variables in the script and adjust the flow which would update those. In the flow at the THEN part calculate a better logic, SolarYear. SolarYear + Powermeter, calculate better logic SolarMonth, SolarMonth + Powermeter.

I will adjust this until i found a reliable solution in the script( it worked for a week and yesterday for the first time disfunctioned)

For the prognosis I think it is better to use the real number of power you generated over the past years. So for example you have your solar system for 3 years now combine the 3 values of January and divided by 3. In my case 73+94+70/3=79kWh.
I think this make more sense to use for your specific location and setup.

I totally agrea👍