public override SensorResult Read(string sensorType, string sensorName) { sensorType = string.IsNullOrWhiteSpace(sensorType) ? "Time" : sensorType; sensorName = string.IsNullOrWhiteSpace(sensorName) ? DefaultTimeZone.Id : sensorName; SensorResult result = base.Read(sensorType, sensorName); try { EnsureSupported(sensorType, sensorName); var tz = DateTimeZoneProviders.Tzdb.GetZoneOrNull(sensorName); result.Attribute = tz.Id; result.Result = SystemClock.Instance.GetCurrentInstant().InZone(tz); result.IsSuccessful = true; } catch (Exception ex) { result.Exception = ex; result.Message = ex.Message; } return(result); }
public virtual SensorResult Read(string sensorType, string sensorName) { var result = new SensorResult() { Sensor = this._mapper.Map <SensorPoco>(this) }; return(result); }