static async Task Main(string username = "******", string password = "******", string baseUri = "http://64.227.77.146:8080") { while (true) { var thingsboard = new ThingsboardHelper(baseUri, new System.Net.NetworkCredential(username, password)); await thingsboard.Login(); var equalizer = new Equalizer(thingsboard); await equalizer.DoEqualizeAsync(); await Task.Delay(TimeSpan.FromMinutes(10)); } }
private async Task <Telemetry> GetTelemetry(string key, Device device) { Console.Write(device.Name); var telemetryResponse = await Helper.GetResponse($"/api/plugins/telemetry/{device.Id.entityType}/{device.Id.Id}/values/timeseries?keys={key}"); dynamic content = await ThingsboardHelper.DeserializeJson(telemetryResponse); var measurement = content[key][0]; var telemetry = new Telemetry { Ts = measurement.ts, RawValue = measurement.value, Key = key }; Console.WriteLine($" {telemetry.Timestamp} {telemetry.Key} {telemetry.Value:0.00}"); return(telemetry); }
public Equalizer(ThingsboardHelper helper) { Helper = helper; }