private void Execute(Site site)
        {
            var powerFlow = _apiClient.CurrentPowerflow(site);

            var entry = new[]
            {
                Create("Grid",
                       site,
                       powerFlow.SiteCurrentPowerFlow.Grid,
                       powerFlow.SiteCurrentPowerFlow.Connections.Any(x => x.To.Equals("Grid", StringComparison.InvariantCultureIgnoreCase))),
                Create("Load",
                       site,
                       powerFlow.SiteCurrentPowerFlow.Load,
                       false),
                Create("Pv",
                       site,
                       powerFlow.SiteCurrentPowerFlow.Pv,
                       false),
                CreateStorage("Storage",
                              site,
                              powerFlow.SiteCurrentPowerFlow.Storage,
                              powerFlow.SiteCurrentPowerFlow.Connections.Any(x => x.From.Equals("Storage", StringComparison.InvariantCultureIgnoreCase)))
            };

            _influxDbUpload.QueueWrite(entry, 5, _solarEdgeSetting.TargetDatabase, "week_one");
        }
        private void Execute(Site site)
        {
            var now          = TimeZoneInfo.ConvertTime(DateTime.Now, site.Location.TimeZoneInfo);
            var nowMinus1Day = now.AddDays(-1);
            var from         = nowMinus1Day > _lastRequest ? nowMinus1Day : _lastRequest;

            var energyData = ProcessEnergyDetails(site, from, now);

            _influxDbUpload.QueueWrite(energyData.ToArray(), 5, _solarEdgeSetting.TargetDatabase);

            var powerData = ProcessPowerDetails(site, from, now);

            _influxDbUpload.QueueWrite(powerData.ToArray(), 5, _solarEdgeSetting.TargetDatabase);

            var storageData = ProcessStorageData(site, from, now);

            _influxDbUpload.QueueWrite(storageData.ToArray(), 5, _solarEdgeSetting.TargetDatabase);

            _lastRequest = now;
        }
Esempio n. 3
0
 private void UploadPrices(TankstellenPreis[] prices)
 => _influxDbUpload.QueueWrite(CreateInfluxDbEntries(prices).ToArray(), 5, _setting.Database);