Page 1 of 1

Report & Email management in scripts/123solar.php

Posted: Sat Nov 12, 2016 7:29 pm
by sovking
It's possibile to put every report code section outside script/123solar.php ?
And in general any email activity.
So could be interesting leave in the mai loop, the main activities, event detection and so on, while the part of code regarding report procedures, or preparing for mail warning/alarm could be put in separate snippets of code, maybe in programs.

That could improve 123solar.php script in some way: easier to read, easier to find bug or to modify to add new functions, and to replace some functions like the reporting, alarm and warnings with some code that could fit better some user needs.

For example: for a particular plant with several inverters, I would like to rewrite the report because I want sent to the user only one report with the data of all inverters, maybe with some extra information like the peak value of the day, the main alarms and warning registered, and maybe I would like to highlight if there are significative differences betweeing Array production.

Do you think it could be reasonable ?


Re: Report & Email management in scripts/123solar.php

Posted: Sat Nov 12, 2016 7:38 pm
by jeanmarc
I believe the code is simple enough.. at least for me :)
But rather tell me what kind of new functions and reporting are you expecting ?.

Re: Report & Email management in scripts/123solar.php

Posted: Sat Nov 12, 2016 7:40 pm
by sovking
Sorry Jean Marc I was editing, the previous message.
The cumulative report is one. Look at my previous message.

Another is to have multiple recipients email.
Usually one recipient is the owner, one is who has the maintenance of the plant (typically an elettrician).

Re: Report & Email management in scripts/123solar.php

Posted: Sat Nov 12, 2016 7:43 pm
by sovking
Take into account that I want keep the upgradability of your code, so I don't want modify any part of your code.
So, the ideal approach is calling some script that I can manage and will survive to your updates.

It could be like a sort of "comapps" a la meterN style. :D

Re: Report & Email management in scripts/123solar.php

Posted: Sun Nov 13, 2016 8:18 am
by jeanmarc
Hi sovking,
Now I understand your will. But the main difference between 123s and mN is that 123s cover something like +90% of the inverter's market share, unlike mN which won't even cover 1% with the comapps inside...
So i believe it is wiser to keep protocol_checks bundle, i believe it's simple enough.

For reporting, there might be some exception where you wish to have more flexibility... As you know, I don't want to overcomplicate the setup. I then think it's wiser to create a separated script, i don't know the best way.. maybe taking a look on events file or much better checking the memory (/dev/shm/123s_MEMORY.json)

[invtstat1] => Global State: Run Inverter State: Run Channel 1 Dc/Dc State: MPPT Channel 2 Dc/Dc State: MPPT Alarm State: No Alarm [5minflag1] => [mailq1] => 0 [AWt1] => 1479021240 [AWriso1] => 20 [AWileak1] => 4.4

Re: Report & Email management in scripts/123solar.php

Posted: Mon Nov 14, 2016 12:16 am
by sovking
Hi Jeanmarc,
I agree that most of the time 123s more popular than mN, and probably usually the main setup is for one inverter with two string at most. Very few installation are made with two or more inverters, and a solar field with several inverters probably is very less than 1%.
However such minority, I think is quite interesting case.
I agree that the setup should remain simple and even simpler than now.

Focusing on the report.
Now for each inverter I've to fill data regarding recipient mail, pushover, frequency of report and so on, but I think that at list for recipient email and pushover these data should be general, maybe part of the Main Configuration setup, because I don't think that could be a case with different email recipient for different inverters monitored by 123s. The same apply for frequency of report: usually it's the same for all active inverters So this could be a semplification.

Regarding the email report: why multiple mail for different inverters ?
The only reason I could see, could be for external parsing.
For the end-user or the maintener of the plant a single email give the proper description of the sitution should be the better solution.
Looking at the code I see that just after the infinite loop (and beyond... :) ), the script loop between every inverter, so it's quite natural sending report for each inverter. But for the reason described I think could be more useful having such code in a separate script, as you suggested.
This is at least for the report.

Alarms and warning is a separate matter. Naturally they are per inverter, and if the user ask to be alert when alarm is rising, then have to be done immediately.
But at the end of the day when the report is prepared, could be interesting write some piece of code that summarize the alarms of the day.

Of course for everything, it's possibile the user can disable the 123s reporting and then he/she can write its own report script running once a day outside 123s, reading from memory or from csv, etc..
But having a new feature in 123s... it's priceless :lol:

Re: Report & Email management in scripts/123solar.php

Posted: Mon Nov 14, 2016 9:15 am
by jeanmarc
Hi sovking,
When i said 123s cover +90% of the market, i meant support 90% of the inverters type ;)

Well, i know a system with 7 inverters that have different users (i guess it's apartments)... :roll:
Putting the email settings in main config is also no sense, each inverters may have different threshold, filter, and so on..
But i have a solution, I believe it fit your needs. You could receive emails for two or more people. Currently it's no allowed for the email check you need to tweak config/invt_configX.php

Code: Select all

I don't like the idea to summarize alarms of the day, i think it's the kind of email that isn't be read after a while.. Also you can still set "Log all measures & alarms/warnings" to on.

Re: Report & Email management in scripts/123solar.php

Posted: Mon Nov 14, 2016 6:21 pm
by sovking
A a system with 7 inverters that have different users: that's a very special case!

Regarding the main confing settings: I mean, not all the settings in the main config: the email and eventually pushover only. Threshold, filter, and so on should remain per inverter of course, because they can be different per each inverter.

Regarding the tweak yout suggest, I know it, but it does not survive to inverter configuration page, so if I need to change something in inverter page, even if it has loaded the email tweaked, it don't let me to submit the page because the email check.

Regarding the summarize alarms, you are right. I mean to highlith some data that is not really an alarm.
For example. Let's think about a two array solar system with no shades. If at the end of the day, the first array has produced half of the energy of the first array probably there is something which is not working. That's not an alarm but maybe it's a simple post production warning, which cannot be output while system is running.

Finally I attach a simple output of Aurora communicator mail, which in part show you an email report of the full system:


That's is just an example of email report. 123solar know all these data, and probably more, and can access them easily from the memory. I don't want copy that template of repart: that can be improved.

Re: Report & Email management in scripts/123solar.php

Posted: Mon Nov 14, 2016 8:05 pm
by jeanmarc
I could arrange the admin interface to allow more than one email.

I am really not fond of mail report, especially based on production data, i won't go that way :? I think it's more efficient to report real alarms from the inverter, that's what warned me in the 5' when my inverter crashed (E031). I don't bother with other messages like Sun Low W001.

At the end, if you are stressed, you should check your logger daily like i do :lol: