コード例 #1
0
        private async Task <UponorResponseContainer> AcquireDiscoveryDetails(CancellationToken stoppingToken)
        {
            SystemProperties systemInfo = await _uponorClient.GetSystemInfo(stoppingToken);

            // Update details container
            _detailsContainer.Update(systemInfo.AvailableControllers, systemInfo.AvailableThermostats, systemInfo.AvailableOutdoorSensors, systemInfo.HcMode);

            // Batch all Value properties
            IEnumerable <int> objects = new[] {
                UponorObjects.System(UponorSystem.DeviceLostAlarm),
                UponorObjects.System(UponorSystem.NoCommController1),
                UponorObjects.System(UponorSystem.NoCommController2),
                UponorObjects.System(UponorSystem.NoCommController3),
                UponorObjects.System(UponorSystem.NoCommController4),
                UponorObjects.System(UponorSystem.UhomeModuleId),
                UponorObjects.System(UponorSystem.DeviceLostAlarm),
            }
            .Concat(systemInfo.AvailableControllers.SelectMany(c => new[]
            {
                UponorObjects.Controller(UponorController.ControllerSwVersion, c)
            }))
            .Concat(systemInfo.AvailableOutdoorSensors.SelectMany(s => new[]
            {
                UponorObjects.Controller(UponorController.OutdoorSensorPresence, s)
            }))
            .Concat(_detailsContainer.GetAvailableThermostats().SelectMany(c => new[]
            {
                UponorObjects.Thermostat(UponorThermostats.RoomName, c.controller, c.thermostat),
                UponorObjects.Thermostat(UponorThermostats.MinSetpoint, c.controller, c.thermostat),
                UponorObjects.Thermostat(UponorThermostats.MaxSetpoint, c.controller, c.thermostat)
            }));

            UponorResponseContainer values = await _uponorClient.ReadValues(objects, new[] { UponorProperties.Value }, stoppingToken);

            // Batch other properties
            // Update some system properties
            objects = systemInfo.AvailableControllers.SelectMany(c => new[]
            {
                UponorObjects.System(UponorSystem.DeviceObject)
            });

            UponorResponseContainer systemValues = await _uponorClient.ReadValues(objects, new[]
            {
                UponorProperties.ApplicationVersion,
                UponorProperties.DeviceName,
                UponorProperties.DeviceId,
                UponorProperties.SerialNumber,
                UponorProperties.ProductName,
                UponorProperties.Supplier,
                UponorProperties.MacAddress
            }, stoppingToken);

            values.Merge(systemValues);

            return(values);
        }
コード例 #2
0
        private async Task PerformUpdate(CancellationToken stoppingToken)
        {
            // Update system & controller details
            IEnumerable <int> objects = _detailsContainer.GetAvailableThermostats().SelectMany(c => new[]
            {
                // Generic
                UponorObjects.Thermostat(UponorThermostats.RoomName, c.controller, c.thermostat),
                UponorObjects.Thermostat(UponorThermostats.RoomInDemand, c.controller, c.thermostat),
                // Humidity
                UponorObjects.Thermostat(UponorThermostats.RhValue, c.controller, c.thermostat),
                // Temperature
                UponorObjects.Thermostat(UponorThermostats.RoomSetpoint, c.controller, c.thermostat),
                UponorObjects.Thermostat(UponorThermostats.RoomTemperature, c.controller, c.thermostat),
                // Alarms
                UponorObjects.Thermostat(UponorThermostats.TamperIndication, c.controller, c.thermostat),
                UponorObjects.Thermostat(UponorThermostats.BatteryAlarm, c.controller, c.thermostat),
                UponorObjects.Thermostat(UponorThermostats.RfAlarm, c.controller, c.thermostat),
                UponorObjects.Thermostat(UponorThermostats.TechnicalAlarm, c.controller, c.thermostat)
            })
                                        .Concat(_detailsContainer.GetAvailableOutdoorSensors().SelectMany(c => new[]
            {
                // Outdoor sensor
                UponorObjects.Controller(UponorController.MeasuredOutdoorTemperature, c),
            }))
                                        .Concat(new[]
            {
                // Average temperature
                UponorObjects.System(UponorSystem.AverageRoomTemperature),
            });

            UponorResponseContainer values = await _uponorClient.ReadValues(objects, new[] { UponorProperties.Value }, stoppingToken);

            _featureManager.Process(values);
        }