codecasternl / pvbridge Goto Github PK
View Code? Open in Web Editor NEWSync live and historic solar panel data from GoodWe to PVOutput.org and CSV, on Windows.
Home Page: https://codecasternl.github.io/PVBridge/
License: MIT License
Sync live and historic solar panel data from GoodWe to PVOutput.org and CSV, on Windows.
Home Page: https://codecasternl.github.io/PVBridge/
License: MIT License
New output provider.
EventLog.CreateEventSource("CodeCaster.PVBridge.Service", "Application");
Probably rename?
services.Configure<EventLogSettings>(settings =>
{
settings.SourceName = "PVBridge Service";
});
When a user has multiple inverters in their plant, we only send the data of the first.
Ideas:
Currently kinda works, but not good.
Assuming a valid configuration and a running service, refresh the API key or change the password.
Uninstall complains that the service is still running before we get the chance to stop and uninstall it through the command-line invocation of the service. If we commit before that step, there's no rolling back.
Stop and uninstall in two steps, restart on uninstall cancel?
Sync backlog since installation date of system.
For that we need to write a little JSON in AppData\PVBridge\PVBridge.Status.json
with where we are, or we'll poll more and more months the longer a system is installed (Schlemiel the Painter algorithm).
Also, the interval is currently hardcoded at 5, we can do a Math.Max(input.Resolution, output.Resolution)
. Could be 1 minute in PVOutput donation mode.
If the backlog sync for a day was not finished and we restart it, we now send the entire day again.
We might save some calls if we first query the details for the first day, then only send missing records.
https://pvoutput.org/help/api_specification.html#history-query, ?h=1&limit=288.
Only works for 5-minute intervals, not 1.
2022-06-21 21:28:35,648 [.NET ThreadPool Worker] WARN InputToOutputLoop+<SyncBacklogAsync>d__14 - No input summary data for GoodWe on 2022-06-15 (Wed), skipping
2022-06-21 21:30:39,257 [62] WARN PVOutputApiClient+<TryHandleAndLogRequest>d__15`1 - Bad Request
PVOutput.Net.Responses.PVOutputException: No system or data found
at PVOutput.Net.Requests.Handler.RequestHandler.ProcessHttpErrorResults(HttpResponseMessage response, Stream responseStream)
at PVOutput.Net.Requests.Handler.RequestHandler.ResponseIsErrorResponse(HttpResponseMessage responseMessage, Stream responseStream, PVOutputBaseResponse result)
at PVOutput.Net.Requests.Handler.RequestHandler.ExecuteArrayRequestAsync[TResponseContentType](IRequest request, Dictionary`2 loggingScope, CancellationToken cancellationToken)
at CodeCaster.PVBridge.PVOutput.PVOutputApiClient.TryHandleAndLogRequest[TResponse](Func`1 request, String jsonName)
2022-06-21 21:30:39,260 [62] WARN InputToOutputLoop+<SyncBacklogAsync>d__14 - No input summary data for GoodWe on 2022-06-15 (Wed), skipping
No summaries from GoodWe, nor on PVOutput for that day. Force-sync, then skip?
GoodWe API is down often. Sometimes it won't return summaries for some days, or reports for weeks, while at a later moment it will. The other scenario is that it's a new system for which no data is present yet, then it'll keep trying to sync that dataless day until it's outside our backlog sync period (> 14 days ago).
Solution: don't go into backlog sync mode when a day sync fails, go to live sync anyway, then retry the backlog sync after 1-2-4-8-... hours.
This happend after the PC running the service was off for a full day. Data is available on semsportal just fine. Restarting service wont fix it. According to the UI everything the plant/inverter can be found and accessed. Same as the PVoutput system. Log file:
2022-08-04 08:09:11,766 [1] INFO HostApplicationStartupLifetime+d__7 - Windows Service start requested
2022-08-04 08:09:11,808 [.NET ThreadPool Worker] INFO HostApplicationStartupLifetime - Windows Service OnStart() was called
2022-08-04 08:09:11,813 [.NET ThreadPool Worker] INFO WindowsServiceBackgroundService+d__6 - CodeCaster.PVBridge.Service.PvBridgeService.ExecuteAsync() called, calling TryExecuteAsync()
2022-08-04 08:09:11,820 [.NET ThreadPool Worker] INFO WindowsServiceLifetime - Application started. Hosting environment: Production; Content root path: C:\Program Files\PVBridge
2022-08-04 08:09:11,871 [.NET ThreadPool Worker] INFO ExtendedWindowsServiceLifetime - Windows Service session change event: 1, SessionLogon
2022-08-04 08:09:12,819 [.NET ThreadPool Worker] INFO PvBridgeService+d__15 - Loading configuration
2022-08-04 08:09:12,851 [.NET ThreadPool Worker] INFO PvBridgeService - Configuring GoodWe to PVOutput
2022-08-04 08:09:12,853 [.NET ThreadPool Worker] INFO PvBridgeService+d__12 - Entering main loop with 1 task
2022-08-04 08:09:16,278 [6] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:11:20,883 [4] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:13:25,354 [18] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:15:29,939 [18] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:17:34,738 [18] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:19:39,151 [31] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:21:43,934 [41] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:23:48,487 [41] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:25:53,101 [27] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
2022-08-04 08:27:57,792 [27] WARN InputToOutputWriter+d__8 - No input snapshot data from GoodWe on 2022-08-02 (Tue). Inverter offline, snowy day, maintenance?
To let the UI query service status or receive events, we need two-way gRPC over named pipes. That works now, but only in dev, because the named pipe server started by the service isn't global, hence inaccessible to the UI running in current user's session and not in that of the network service.
Then this can be implemented in the configuration/status UI:
When syncing into a new PVOutput system, it'll return a 400 Bad Request when querying summaries:
2022-07-20 12:08:12,328 [7] WARN InputToOutputWriter+d__5 - Could not retrieve input summaries from PVOutput between 07/07/2022 00:00:00 and 07/20/2022 12:08:10
https://gathering.tweakers.net/forum/list_message/72187580#72187580
Handle that as "no data" and sync anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.