private async Task PollHeatingValues()
        {
            var features = await _platformClient.GetDeviceFeatures(_config.InstallationId, _config.GatewayId);

            var time = features.GetTimestamp();

            var burnerHoursTotal  = (double)features.GetHeatingBurnerStatisticsHours();
            var burnerStartsTotal = (int)features.GetHeatingBurnerStatisticsStarts();
            var burnerModulation  = features.GetHeatingBurnerModulation();

            var outsideTemp    = features.GetHeatingSensorsTemperatureOutside();
            var boilerTemp     = features.GetHeatingBoilerTemperature();
            var boilerTempMain = features.GetHeatingBoilerSensorsTemperatureMain();
            var circuit0Temp   = features.GetHeatingCircuitsSensorsTemperature(FeatureName.Circuit.Circuit0);
            var circuit1Temp   = features.GetHeatingCircuitsSensorsTemperature(FeatureName.Circuit.Circuit1);
            var dhwTemp        = features.GetHeatingDhwSensorsTemperatureHotWaterStorage();

            var burnerActive = features.IsHeatingBurnerActive();
            var circuit0Pump = features.IsHeatingCircuitsCirculationPumpOn(FeatureName.Circuit.Circuit0);
            var circuit1Pump = features.IsHeatingCircuitsCirculationPumpOn(FeatureName.Circuit.Circuit1);
            var dhwPrimPump  = features.IsHeatingDhwPumpsPrimaryOn();
            var dhwCircPump  = features.IsHeatingDhwPumpsCirculationOn();

            var solarWhTotal       = features.GetHeatingSolarPowerProductionWhToday();
            var solarCollectorTemp = features.GetHeatingSolarSensorsTemperatureCollector();
            var solarHotwaterTemp  = features.GetHeatingSolarSensorsTemperatureDhw();
            var solarPumpState     = features.IsHeatingSolarPumpsCircuitOn();
            var solarSuppression   = features.IsHeatingSolarRechargeSuppressionOn();

            SaveHeatingValues(time, burnerHoursTotal, burnerStartsTotal, burnerModulation, outsideTemp, boilerTemp, boilerTempMain, circuit0Temp, circuit1Temp, dhwTemp, burnerActive, circuit0Pump, circuit1Pump, dhwPrimPump, dhwCircPump);

            ViessmannSolarPollingService.SaveSolarValues(_dbContext, time, solarWhTotal, solarCollectorTemp, solarHotwaterTemp, solarPumpState, solarSuppression);
        }
예제 #2
0
        public async Task <JsonResult> GetDeviceFeatures(long installationId, long gatewayId, long deviceId)
        {
            var features = await _viessmannClient.GetDeviceFeatures(installationId, gatewayId, deviceId);

            return(Json(new
            {
                features = features.Select(x => new
                {
                    name = x.Name,
                    properties = x.Properties?.GetProperties().Select(p => new
                    {
                        name = p.property,
                        p.value
                    })
                })
            }));
        }