public override void Process(UponorResponseContainer values)
        {
            // Average temperature
            if (!values.TryGetValue(UponorObjects.System(UponorSystem.AverageRoomTemperature),
                                    UponorProperties.Value, out object val))
            {
                return;
            }

            string           deviceId = HassUniqueIdBuilder.GetUhomeDeviceId();
            ISensorContainer sensor   = HassMqttManager.GetSensor(deviceId, "average_temperature");

            MqttStateValueTopic sender = sensor.GetValueSender(HassTopicKind.State);

            sender.Value = val;
        }
Exemplo n.º 2
0
        public override void Process(UponorResponseContainer values)
        {
            // Outdoor sensors
            foreach (int controller in _systemDetails.GetAvailableOutdoorSensors())
            {
                if (!values.TryGetValue(UponorObjects.Controller(UponorController.MeasuredOutdoorTemperature, controller),
                                        UponorProperties.Value, out object val))
                {
                    continue;
                }

                string           deviceId = HassUniqueIdBuilder.GetControllerDeviceId(controller);
                ISensorContainer sensor   = HassMqttManager.GetSensor(deviceId, "outdoor_sensor");

                MqttStateValueTopic sender = sensor.GetValueSender(HassTopicKind.State);

                sender.Value = val;
            }
        }
Exemplo n.º 3
0
        public override void Process(UponorResponseContainer values)
        {
            // Software versions
            foreach (int controller in _systemDetails.GetAvailableControllers())
            {
                if (!values.TryGetValue(UponorObjects.Controller(UponorController.ControllerSwVersion, controller),
                                        UponorProperties.Value, out object val))
                {
                    continue;
                }

                string           deviceId = HassUniqueIdBuilder.GetControllerDeviceId(controller);
                ISensorContainer sensor   = HassMqttManager.GetSensor(deviceId, "controller");

                MqttStateValueTopic sender     = sensor.GetValueSender(HassTopicKind.State);
                MqttAttributesTopic attributes = sensor.GetAttributesSender();

                sender.Value = "discovered";
                attributes.SetAttribute("sw_version", val);
            }
        }
Exemplo n.º 4
0
        public override void Process(UponorResponseContainer values)
        {
            foreach ((int controller, int thermostat) in _systemDetails.GetAvailableThermostats())
            {
                string deviceId = HassUniqueIdBuilder.GetThermostatDeviceId(controller, thermostat);

                // Temperature
                ISensorContainer    sensor = HassMqttManager.GetSensor(deviceId, "temperature");
                MqttStateValueTopic sender = sensor.GetValueSender(HassTopicKind.State);

                if (values.TryGetValue(UponorObjects.Thermostat(UponorThermostats.RoomTemperature, controller, thermostat),
                                       UponorProperties.Value, out float floatVal))
                {
                    if (IsValid.Temperature(floatVal))
                    {
                        sender.Value = floatVal;
                    }
                    else
                    {
                        _logger.LogWarning("Received an invalid temperature of {Value} for {Device}", floatVal, deviceId);
                    }
                }
            }
        }
Exemplo n.º 5
0
 public static ISensorContainer SetValue(this ISensorContainer sensor, HassTopicKind topicKind, object value)
 {
     sensor.GetValueSender(topicKind).Value = value;
     return(sensor);
 }