Example #1
0
 public EntityTypeData(string name, IEnumerable <string> components = null)
 {
     Name       = name;
     Components = new ComponentList();
     if (components != null)
     {
         Components.AddRange(components);
     }
 }
        public WorkerABN03(string deviceId, ILogger <WorkerABN03> logger, IOptions <WorkersConfiguration> workersConfiguration, IOptions <MqttConfiguration> mqttConfiguration, IMqttClientForMultipleSubscribers mqttClient)
            : base(deviceId, logger, workersConfiguration, mqttConfiguration, mqttClient)
        {
            var sensorFactory = new SensorFactory();
            var device        = new Device
            {
                Name         = "ABN03",
                Model        = "ABSensor N03",
                Manufacturer = "April Brother",
                ViaDevice    = WorkersConfiguration.ServiceName,
                Identifiers  = new() { DeviceId },
                Connections  = new() { new() { "mac", DeviceId } }
            };

            ComponentList.AddRange(new List <Sensor>
            {
                sensorFactory.CreateSensor(DeviceClassDescription.Temperature, device: device),
                sensorFactory.CreateSensor(DeviceClassDescription.Humidity, device: device),
                sensorFactory.CreateSensor(DeviceClassDescription.IlluminanceLux, device: device),
                sensorFactory.CreateSensor(DeviceClassDescription.Battery, device: device)
            });
        }