(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{1083:function(n,e,t){"use strict";t.d(e,"a",(function(){return i})),t.d(e,"b",(function(){return r}));const i={},r=n=>Object.values(i).filter(e=>e.name.toLowerCase().includes(n.toLowerCase())).sort((n,e)=>n.name.toLowerCase().localeCompare(e.name.toLowerCase())),a=t(1629);a.keys().forEach(n=>{a(n).default(n=>{if(i.hasOwnProperty(n.id))throw new Error(`Client of type [${n.id}] has already been registered`);i[n.id]=Object.assign({},n)})})},1629:function(n,e,t){var i={"./Arduino/index.ts":2077,"./CSharp/index.ts":2064,"./Go/index.ts":2071,"./Java/index.ts":2065,"./Javascript/index.ts":2078,"./Kotlin/index.ts":2083,"./PHP/index.ts":2066,"./Python/index.ts":2067,"./Ruby/index.ts":2059,"./Scala/index.ts":2084,"./Swift/index.ts":2068};function r(n){var e=a(n);return t(e)}function a(n){if(!t.o(i,n)){var e=new Error("Cannot find module '"+n+"'");throw e.code="MODULE_NOT_FOUND",e}return i[n]}r.keys=function(){return Object.keys(i)},r.resolve=a,n.exports=r,r.id=1629},1630:function(n,e,t){n.exports=t.p+"d282b5dc2d.svg"},1631:function(n,e,t){n.exports=t.p+"6a035ca694.svg"},1632:function(n,e,t){n.exports=t.p+"d831880c7d.svg"},1633:function(n,e,t){n.exports=t.p+"5f2c6d9067.svg"},1634:function(n,e,t){n.exports=t.p+"ed5875c592.svg"},1635:function(n,e,t){n.exports=t.p+"b4105a4388.svg"},1636:function(n,e,t){n.exports=t.p+"057f237d97.svg"},1637:function(n,e,t){n.exports=t.p+"3dabdf9fea.svg"},1638:function(n,e,t){n.exports=t.p+"586aa8f23c.svg"},1639:function(n,e,t){n.exports=t.p+"8c756c1e65.svg"},1640:function(n,e,t){n.exports=t.p+"74ba2b9c36.svg"},2059:function(n,e,t){"use strict";t.r(e);var i=t(1638),r=t.n(i);e.default=n=>n({id:"ruby",name:"Ruby",featureFlag:"client-library--ruby",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-ruby" target="_blank"  rel="noreferrer">GitHub Repository</a>\n\n##### Install the Gem\n\n```\ngem install influxdb-client\n```\n',logo:r.a,initialize:"require 'influxdb-client'\n\n# You can generate a Token from the \"Tokens Tab\" in the UI\ntoken = '<%= token %>'\norg = '<%= org %>'\nbucket = '<%= bucket %>'\n\nclient = InfluxDB2::Client.new('<%= server %>', token,\n  precision: InfluxDB2::WritePrecision::NANOSECOND)\n\n",write:[{title:"Use InfluxDB Line Protocol to write data",code:"write_api = client.create_write_api\n\ndata = 'mem,host=host1 used_percent=23.43234543'\nwrite_api.write(data: data, bucket: bucket, org: org)\n\n"},{title:"Use a Data Point to write data",code:"point = InfluxDB2::Point.new(name: 'mem')\n  .add_tag('host', 'host1')\n  .add_field('used_percent', 23.43234543)\n  .time(Time.now.utc, InfluxDB2::WritePrecision::NANOSECOND)\n\nwrite_api.write(data: point, bucket: bucket, org: org)\n\n"},{title:"Use a Hash to write data",code:"hash = {name: 'h2o',\n  tags: {host: 'aws', region: 'us'},\n  fields: {level: 5, saturation: '99%'},\n  time: Time.now.utc}\n\nwrite_api.write(data: hash, bucket: bucket, org: org)\n\n"},{title:"Use a Batch Sequence to write data",code:"point = InfluxDB2::Point.new(name: 'mem')\n  .add_tag('host', 'host1')\n  .add_field('used_percent', 23.43234543)\n  .time(Time.now.utc, InfluxDB2::WritePrecision::NANOSECOND)\n\nhash = {name: 'h2o',\n  tags: {host: 'aws', region: 'us'},\n  fields: {level: 5, saturation: '99%'},\n  time: Time.now.utc}\n\ndata = 'mem,host=host1 used_percent=23.23234543'\n\nwrite_api.write(data: [point, hash, data], bucket: bucket, org: org)\n\n"}],execute:'query = "from(bucket: \\"<%= bucket %>\\") |> range(start: -1h)"\ntables = client.create_query_api.query(query: query, org: org)\n\n'})},2064:function(n,e,t){"use strict";t.r(e);var i=t(1631),r=t.n(i);e.default=n=>n({id:"csharp",name:"C#",featureFlag:"client-library--csharp",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-csharp" target="_blank" rel="noreferrer">GitHub Repository</a>\n\n##### Install Package\n\nLibrary Manager\n\n```\nInstall-Package InfluxDB.Client\n```\n\n.NET CLI\n\n```\ndotnet add package InfluxDB.Client\n```\n\nPackage Reference\n\n```\n<PackageReference Include="InfluxDB.Client" />\n```\n',logo:r.a,initialize:'using System;\nusing System.Threading.Tasks;\nusing InfluxDB.Client;\nusing InfluxDB.Client.Api.Domain;\nusing InfluxDB.Client.Core;\nusing InfluxDB.Client.Writes;\n\nnamespace Examples\n{\n  public class Examples\n  {\n    public static async Task Main(string[] args)\n    {\n      // You can generate a Token from the "Tokens Tab" in the UI\n      const string token = "<%= token %>";\n      const string bucket = "<%= bucket %>";\n      const string org = "<%= org %>";\n\n      var client = InfluxDBClientFactory.Create("<%= server %>", token.ToCharArray());\n    }\n  }\n}\n\n',write:[{title:"Use InfluxDB Line Protocol to write data",code:'const string data = "mem,host=host1 used_percent=23.43234543";\nusing (var writeApi = client.GetWriteApi())\n{\n  writeApi.WriteRecord(bucket, org, WritePrecision.Ns, data);\n}\n\n'},{title:"Use a Data Point to write data",code:'var point = PointData\n  .Measurement("mem")\n  .Tag("host", "host1")\n  .Field("used_percent", 23.43234543)\n  .Timestamp(DateTime.UtcNow, WritePrecision.Ns);\n\nusing (var writeApi = client.GetWriteApi())\n{\n  writeApi.WritePoint(bucket, org, point);\n}\n\n'},{title:"Use POCO and corresponding class to write data",code:'var mem = new Mem { Host = "host1", UsedPercent = 23.43234543, Time = DateTime.UtcNow };\n\nusing (var writeApi = client.GetWriteApi())\n{\n  writeApi.WriteMeasurement(bucket, org, WritePrecision.Ns, mem);\n}\n\n\n// Public class\n[Measurement("mem")]\nprivate class Mem\n{\n  [Column("host", IsTag = true)] public string Host { get; set; }\n  [Column("used_percent")] public double? UsedPercent { get; set; }\n  [Column(IsTimestamp = true)] public DateTime Time { get; set; }\n}\n'}],execute:'var query = $"from(bucket: \\"<%= bucket %>\\") |> range(start: -1h)";\nvar tables = await client.GetQueryApi().QueryAsync(query, org)\n'})},2065:function(n,e,t){"use strict";t.r(e);var i=t(1633),r=t.n(i);e.default=n=>n({id:"java",name:"Java",featureFlag:"client-library--java",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-java" target="_blank" rel="noreferrer">GitHub Repository</a>\n\n##### Add Dependency\n\nBuild with Maven\n\n```\n<dependency>\n  <groupId>com.influxdb</groupId>\n  <artifactId>influxdb-client-java</artifactId>\n  <version>2.0.0</version>\n</dependency>\n```\n\nBuild with Gradle\n\n```\ndependencies {\n  compile "com.influxdb:influxdb-client-java:2.0.0"\n}\n```\n',logo:r.a,initialize:'package example;\n\nimport java.time.Instant;\nimport java.util.List;\n\nimport com.influxdb.annotations.Column;\nimport com.influxdb.annotations.Measurement;\nimport com.influxdb.client.InfluxDBClient;\nimport com.influxdb.client.InfluxDBClientFactory;\nimport com.influxdb.client.WriteApi;\nimport com.influxdb.client.domain.WritePrecision;\nimport com.influxdb.client.write.Point;\nimport com.influxdb.query.FluxTable;\n\npublic class InfluxDB2Example {\n  public static void main(final String[] args) {\n\n    // You can generate a Token from the "Tokens Tab" in the UI\n    String token = "<%= token %>";\n    String bucket = "<%= bucket %>";\n    String org = "<%= org %>";\n\n    InfluxDBClient client = InfluxDBClientFactory.create("<%= server %>", token.toCharArray());\n  }\n}\n\n',write:[{title:"Use InfluxDB Line Protocol to write data",code:'String data = "mem,host=host1 used_percent=23.43234543";\ntry (WriteApi writeApi = client.getWriteApi()) {\n  writeApi.writeRecord(bucket, org, WritePrecision.NS, data);\n}\n\n'},{title:"Use a Data Point to write data",code:'Point point = Point\n  .measurement("mem")\n  .addTag("host", "host1")\n  .addField("used_percent", 23.43234543)\n  .time(Instant.now(), WritePrecision.NS);\n\ntry (WriteApi writeApi = client.getWriteApi()) {\n  writeApi.writePoint(bucket, org, point);\n}\n\n'},{title:"Use POJO and corresponding class to write data",code:'Mem mem = new Mem();\nmem.host = "host1";\nmem.used_percent = 23.43234543;\nmem.time = Instant.now();\n\ntry (WriteApi writeApi = client.getWriteApi()) {\n  writeApi.writeMeasurement(bucket, org, WritePrecision.NS, mem);\n}\n\n\n\n@Measurement(name = "mem")\npublic static class Mem {\n  @Column(tag = true)\n  String host;\n  @Column\n  Double used_percent;\n  @Column(timestamp = true)\n  Instant time;\n}\n\n'}],execute:'String query = "from(bucket: \\"<%= bucket %>\\") |> range(start: -1h)";\nList<FluxTable> tables = client.getQueryApi().query(query, org);\n\n'})},2066:function(n,e,t){"use strict";t.r(e);var i=t(1636),r=t.n(i);e.default=n=>n({id:"php",name:"PHP",featureFlag:"client-library--php",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-php" target="_blank"  rel="noreferrer">GitHub Repository</a>\n\n##### Install via Composer\n\n```\ncomposer require influxdata/influxdb-client-php\n```\n',logo:r.a,initialize:'use InfluxDB2\\\\Client;\nuse InfluxDB2\\\\Model\\\\WritePrecision;\nuse InfluxDB2\\\\Point;\n\n# You can generate a Token from the "Tokens Tab" in the UI\n$token = \'<%= token %>\';\n$org = \'<%= org %>\';\n$bucket = \'<%= bucket %>\';\n\n$client = new Client([\n    "url" => "<%= server %>",\n    "token" => $token,\n]);\n\n',write:[{title:"Use InfluxDB Line Protocol to write data",code:'$writeApi = $client->createWriteApi();\n\n$data = "mem,host=host1 used_percent=23.43234543";\n\n$writeApi->write($data, WritePrecision::S, $bucket, $org);\n\n'},{title:"Use a Data Point to write data",code:"$point = Point::measurement('mem')\n  ->addTag('host', 'host1')\n  ->addField('used_percent', 23.43234543)\n  ->time(microtime(true));\n\n$writeApi->write($point, WritePrecision::S, $bucket, $org);\n\n"},{title:"Use Array structure to write data",code:"$dataArray = ['name' => 'cpu',\n  'tags' => ['host' => 'server_nl', 'region' => 'us'],\n  'fields' => ['internal' => 5, 'external' => 6],\n  'time' => microtime(true)];\n\n$writeApi->write($dataArray, WritePrecision::S, $bucket, $org);\n\n"}],execute:'$query = "from(bucket: \\"<%= bucket %>\\") |> range(start: -1h)";\n$tables = $client->createQueryApi()->query($query, $org);\n\n'})},2067:function(n,e,t){"use strict";t.r(e);var i=t(1637),r=t.n(i);e.default=n=>n({id:"python",name:"Python",featureFlag:"client-library--python",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-python" target="_blank"  rel="noreferrer">GitHub Repository</a>\n\n##### Install Package\n\n```\npip install influxdb-client\n```\n',logo:r.a,initialize:'from datetime import datetime\n\nfrom influxdb_client import InfluxDBClient, Point, WritePrecision\nfrom influxdb_client.client.write_api import SYNCHRONOUS\n\n# You can generate a Token from the "Tokens Tab" in the UI\ntoken = "<%= token %>"\norg = "<%= org %>"\nbucket = "<%= bucket %>"\n\nclient = InfluxDBClient(url="<%= server %>", token=token)\n\n',write:[{title:"Use InfluxDB Line Protocol to write data",code:'write_api = client.write_api(write_options=SYNCHRONOUS)\n\ndata = "mem,host=host1 used_percent=23.43234543"\nwrite_api.write(bucket, org, data)\n\n'},{title:"Use a Data Point to write data",code:'point = Point("mem") \\\n  .tag("host", "host1") \\\n  .field("used_percent", 23.43234543) \\\n  .time(datetime.utcnow(), WritePrecision.NS)\n\nwrite_api.write(bucket, org, point)\n\n'},{title:"Use a Batch Sequence to write data",code:'sequence = ["mem,host=host1 used_percent=23.43234543",\n            "mem,host=host1 available_percent=15.856523"]\nwrite_api.write(bucket, org, sequence)\n\n'}],execute:"query = f'from(bucket: \"<%= bucket %>\") |> range(start: -1h)'\ntables = client.query_api().query(query, org=org)\n\n"})},2068:function(n,e,t){"use strict";t.r(e);var i=t(1640),r=t.n(i);e.default=n=>n({id:"swift",name:"Swift",featureFlag:"client-library--swift",description:'For more detailed and up to date information check out the [GitHub Repository](https://github.com/influxdata/influxdb-client-swift/)\n\n##### Install via Swift Package Manager\n\nAdd this line to your `Package.swift`:\n\n```swift\n// swift-tools-version:5.3\nimport PackageDescription\n\nlet package = Package(\n    name: "MyPackage",\n    dependencies: [\n        .package(name: "influxdb-client-swift", url: "https://github.com/influxdata/influxdb-client-swift", from: "0.2.0"),\n    ],\n    targets: [\n        .target(name: "MyModule", dependencies: [\n          .product(name: "InfluxDBSwift", package: "influxdb-client-swift"),\n          // or InfluxDBSwiftApis for management API\n          .product(name: "InfluxDBSwiftApis", package: "influxdb-client-swift")\n        ])\n    ]\n)\n```\n',logo:r.a,initialize:'import Foundation\nimport InfluxDBSwift\n\nlet url = "<%= server %>"\nlet token = "<%= token %>"\nlet bucket = "<%= bucket %>"\nlet org = "<%= org %>"\n\nlet client = InfluxDBClient(url: url, token: token)\n\n// always close client at the end\nclient.close()\n\n',write:[{title:"Use InfluxDB Line Protocol to write data",code:'let recordString = "demo,type=string value=1i"\n\nclient.makeWriteAPI().write(record: recordString) { result, error in\n    // For handle error\n    if let error = error {\n        print("Error:\\n\\n\\(error)")\n    }\n\n    // For Success write\n    if result != nil {\n        print("Successfully written data:\\n\\n\\(recordString)")\n    }\n}\n\n'},{title:"Use a Data Point to write data",code:'let recordPointDate = InfluxDBClient\n        .Point("demo")\n        .addTag(key: "type", value: "point-timestamp")\n        .addField(key: "value", value: .int(2))\n        .time(time: .date(Date()))\n\nclient.makeWriteAPI().write(points: [recordPoint, recordPointDate]) { result, error in\n    // For handle error\n    if let error = error {\n        print("Error:\\n\\n\\(error)")\n    }\n\n    // For Success write\n    if result != nil {\n        print("Successfully written data:\\n\\n\\([recordPoint, recordPointDate])")\n    }\n}\n\n'},{title:"Use Tuple to write data",code:'let recordTuple: InfluxDBClient.Point.Tuple\n        = (measurement: "demo", tags: ["type": "tuple"], fields: ["value": .int(3)], time: nil)\n\nclient.makeWriteAPI().write(tuple: recordTuple) { result, error in\n    // For handle error\n    if let error = error {\n        print("Error:\\n\\n\\(error)")\n    }\n\n    // For Success write\n    if result != nil {\n        print("Successfully written data:\\n\\n\\(recordTuple)")\n    }\n}\n\n'}],execute:'let query = """\n            from(bucket: "\\(self.bucket)")\n                |> range(start: -10m)\n                |> filter(fn: (r) => r["_measurement"] == "cpu")\n                |> filter(fn: (r) => r["cpu"] == "cpu-total")\n                |> filter(fn: (r) => r["_field"] == "usage_user" or r["_field"] == "usage_system")\n                |> last()\n            """\n\nprint("\\nQuery to execute:\\n\\n\\(query)")\n\nclient.getQueryAPI().query(query: query) { response, error in\n  // For handle error\n  if let error = error {\n    print("Error:\\n\\n\\(error)")\n  }\n\n  // For Success response\n  if let response = response {\n\n    print("\\nSuccess response...\\n")\n    print("CPU usage:")\n    do {\n      try response.forEach { record in\n        print("\\t\\(record.values["_field"]!): \\(record.values["_value"]!)")\n      }\n    } catch {\n       print("Error:\\n\\n\\(error)")\n    }\n  }\n}\n\n'})},2071:function(n,e,t){"use strict";t.r(e);var i=t(1632),r=t.n(i);e.default=n=>n({id:"go",name:"GO",featureFlag:"client-library--go",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-go" target="_blank" rel="noreferrer">GitHub Repository</a>\n',logo:r.a,initialize:'package main\n\nimport (\n  "context"\n  "fmt"\n  "github.com/influxdata/influxdb-client-go/v2"\n  "time"\n)\n\nfunc main() {\n  // You can generate a Token from the "Tokens Tab" in the UI\n  const token = "<%= token %>"\n  const bucket = "<%= bucket %>"\n  const org = "<%= org %>"\n\n  client := influxdb2.NewClient("<%= server %>", token)\n  // always close client at the end\n  defer client.Close()\n}\n\n',write:[{title:"Use InfluxDB Line Protocol to write data",code:'// get non-blocking write client\nwriteAPI := client.WriteAPI(org, bucket)\n\n// write line protocol\nwriteAPI.WriteRecord(fmt.Sprintf("stat,unit=temperature avg=%f,max=%f", 23.5, 45.0))\nwriteAPI.WriteRecord(fmt.Sprintf("stat,unit=temperature avg=%f,max=%f", 22.5, 45.0))\n// Flush writes\nwriteAPI.Flush()\n\n'},{title:"Use a Data Point to write data",code:'p := influxdb2.NewPoint("stat",\n  map[string]string{"unit": "temperature"},\n  map[string]interface{}{"avg": 24.5, "max": 45},\n  time.Now())\n// write point asynchronously\nwriteAPI.WritePoint(p)\n// create point using fluent style\np = influxdb2.NewPointWithMeasurement("stat").\n  AddTag("unit", "temperature").\n  AddField("avg", 23.2).\n  AddField("max", 45).\n  SetTime(time.Now())\n// write point asynchronously\nwriteAPI.WritePoint(p)\n// Flush writes\nwriteAPI.Flush()\n\n'}],execute:'query := fmt.Sprintf("from(bucket:\\"%v\\")|> range(start: -1h) |> filter(fn: (r) => r._measurement == \\"stat\\")", bucket)\n// Get query client\nqueryAPI := client.QueryAPI(org)\n// get QueryTableResult\nresult, err := queryAPI.Query(context.Background(), query)\nif err == nil {\n  // Iterate over query response\n  for result.Next() {\n    // Notice when group key has changed\n    if result.TableChanged() {\n      fmt.Printf("table: %s\\n", result.TableMetadata().String())\n    }\n    // Access data\n    fmt.Printf("value: %v\\n", result.Record().Value())\n  }\n  // check for an error\n  if result.Err() != nil {\n    fmt.Printf("query parsing error: %\\n", result.Err().Error())\n  }\n} else {\n  panic(err)\n}\n\n'})},2077:function(n,e,t){"use strict";t.r(e);var i=t(1630),r=t.n(i);e.default=n=>n({id:"arduino",name:"Arduino",featureFlag:"client-library--arduino",description:'For more detailed and up to date information check out the <a href="https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino" target="_blank" rel="noreferrer">GitHub Repository</a>\n\n##### Install Library\n\nLibrary Manager\n\n```\n1. Open the Arduino IDE and click to the "Sketch" menu and then Include Library > Manage Libraries.\n2. Type \'influxdb\' in the search box\n3. Install the \'InfluxDBClient for Arduino\' library\n```\n\nManual Installation\n\n```\n1. cd <arduino-sketch-location>/library.\n2. git clone https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino\n3. Restart the Arduino IDE\n```\n',logo:r.a,initialize:'#if defined(ESP32)\n#include <WiFiMulti.h>\nWiFiMulti wifiMulti;\n#define DEVICE "ESP32"\n#elif defined(ESP8266)\n#include <ESP8266WiFiMulti.h>\nESP8266WiFiMulti wifiMulti;\n#define DEVICE "ESP8266"\n#endif\n\n#include <InfluxDbClient.h>\n#include <InfluxDbCloud.h>\n\n// WiFi AP SSID\n#define WIFI_SSID "SSID"\n// WiFi password\n#define WIFI_PASSWORD "PASSWORD"\n// InfluxDB v2 server url, e.g. https://eu-central-1-1.aws.cloud2.influxdata.com (Use: InfluxDB UI -> Load Data -> Client Libraries)\n#define INFLUXDB_URL "<%= server %>"\n// InfluxDB v2 server or cloud API authentication token (Use: InfluxDB UI -> Data -> Tokens -> <select token>)\n#define INFLUXDB_TOKEN "<%= token %>"\n// InfluxDB v2 organization id (Use: InfluxDB UI -> User -> About -> Common Ids )\n#define INFLUXDB_ORG "<%= org %>"\n// InfluxDB v2 bucket name (Use: InfluxDB UI ->  Data -> Buckets)\n#define INFLUXDB_BUCKET "<%= bucket %>"\n\n// Set timezone string according to https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html\n// Examples:\n//  Pacific Time: "PST8PDT"\n//  Eastern: "EST5EDT"\n//  Japanesse: "JST-9"\n//  Central Europe: "CET-1CEST,M3.5.0,M10.5.0/3"\n#define TZ_INFO "CET-1CEST,M3.5.0,M10.5.0/3"\n\n// InfluxDB client instance with preconfigured InfluxCloud certificate\nInfluxDBClient client(INFLUXDB_URL, INFLUXDB_ORG, INFLUXDB_BUCKET, INFLUXDB_TOKEN, InfluxDbCloud2CACert);\n\n// Data point\nPoint sensor("wifi_status");\n\nvoid setup() {\n  Serial.begin(115200);\n\n  // Setup wifi\n  WiFi.mode(WIFI_STA);\n  wifiMulti.addAP(WIFI_SSID, WIFI_PASSWORD);\n\n  Serial.print("Connecting to wifi");\n  while (wifiMulti.run() != WL_CONNECTED) {\n    Serial.print(".");\n    delay(100);\n  }\n  Serial.println();\n\n  // Add tags\n  sensor.addTag("device", DEVICE);\n  sensor.addTag("SSID", WiFi.SSID());\n\n  // Accurate time is necessary for certificate validation and writing in batches\n  // For the fastest time sync find NTP servers in your area: https://www.pool.ntp.org/zone/\n  // Syncing progress and the time will be printed to Serial.\n  timeSync(TZ_INFO, "pool.ntp.org", "time.nis.gov");\n\n  // Check server connection\n  if (client.validateConnection()) {\n    Serial.print("Connected to InfluxDB: ");\n    Serial.println(client.getServerUrl());\n  } else {\n    Serial.print("InfluxDB connection failed: ");\n    Serial.println(client.getLastErrorMessage());\n  }\n}\n\n',write:'void loop() {\n  // Clear fields for reusing the point. Tags will remain untouched\n  sensor.clearFields();\n\n  // Store measured value into point\n  // Report RSSI of currently connected network\n  sensor.addField("rssi", WiFi.RSSI());\n\n  // Print what are we exactly writing\n  Serial.print("Writing: ");\n  Serial.println(sensor.toLineProtocol());\n\n  // If no Wifi signal, try to reconnect it\n  if ((WiFi.RSSI() == 0) && (wifiMulti.run() != WL_CONNECTED)) {\n    Serial.println("Wifi connection lost");\n  }\n\n  // Write point\n  if (!client.writePoint(sensor)) {\n    Serial.print("InfluxDB write failed: ");\n    Serial.println(client.getLastErrorMessage());\n  }\n\n  //Wait 10s\n  Serial.println("Wait 10s");\n  delay(10000);\n}\n\n',execute:'void loop() {\n  // Construct a Flux query\n  // Query will find the worst RSSI for last hour for each connected WiFi network with this device\n  String query = "from(bucket: \\"" INFLUXDB_BUCKET "\\") |> range(start: -1h) |> filter(fn: (r) => r._measurement == \\"wifi_status\\" and r._field == \\"rssi\\"";\n  query += " and r.device == \\""  DEVICE  "\\")";\n  query += "|> min()";\n\n  // Print ouput header\n  Serial.print("==== ");\n  Serial.print(selectorFunction);\n  Serial.println(" ====");\n\n  // Print composed query\n  Serial.print("Querying with: ");\n  Serial.println(query);\n\n  // Send query to the server and get result\n  FluxQueryResult result = client.query(query);\n\n  // Iterate over rows. Even there is just one row, next() must be called at least once.\n  while (result.next()) {\n    // Get converted value for flux result column \'SSID\'\n    String ssid = result.getValueByName("SSID").getString();\n    Serial.print("SSID \'");\n    Serial.print(ssid);\n\n    Serial.print("\' with RSSI ");\n    // Get converted value for flux result column \'_value\' where there is RSSI value\n    long value = result.getValueByName("_value").getLong();\n    Serial.print(value);\n\n    // Get converted value for the _time column\n    FluxDateTime time = result.getValueByName("_time").getDateTime();\n\n    // Format date-time for printing\n    // Format string according to http://www.cplusplus.com/reference/ctime/strftime/\n    String timeStr = time.format("%F %T");\n\n    Serial.print(" at ");\n    Serial.print(timeStr);\n\n    Serial.println();\n  }\n\n  // Check if there was an error\n  if(result.getError() != "") {\n    Serial.print("Query result error: ");\n    Serial.println(result.getError());\n  }\n\n  // Close the result\n  result.close();\n}\n\n'})},2078:function(n,e,t){"use strict";t.r(e);var i=t(1634),r=t.n(i);e.default=n=>n({id:"javascript-node",name:"JavaScript/Node.js",featureFlag:"client-library--javascript",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-js" target="_blank"  rel="noreferrer">GitHub Repository</a>\n\n##### Install via NPM\n\n```\nnpm i @influxdata/influxdb-client\n```\n',logo:r.a,initialize:"const {InfluxDB} = require('@influxdata/influxdb-client')\n\n// You can generate a Token from the \"Tokens Tab\" in the UI\nconst token = '<%= token %>'\nconst org = '<%= org %>'\nconst bucket = '<%= bucket %>'\n\nconst client = new InfluxDB({url: '<%= server %>', token: token})\n\n",write:"const {Point} = require('@influxdata/influxdb-client')\nconst writeApi = client.getWriteApi(org, bucket)\nwriteApi.useDefaultTags({host: 'host1'})\n\nconst point = new Point('mem')\n  .floatField('used_percent', 23.43234543)\nwriteApi.writePoint(point)\nwriteApi\n    .close()\n    .then(() => {\n        console.log('FINISHED')\n    })\n    .catch(e => {\n        console.error(e)\n        console.log('Finished ERROR')\n    })\n\n",execute:"const queryApi = client.getQueryApi(org)\n\nconst query = `from(bucket: \"<%= bucket %>\") |> range(start: -1h)`\nqueryApi.queryRows(query, {\n  next(row, tableMeta) {\n    const o = tableMeta.toObject(row)\n    console.log(\n      `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`\n    )\n  },\n  error(error) {\n    console.error(error)\n    console.log('Finished ERROR')\n  },\n  complete() {\n    console.log('Finished SUCCESS')\n  }\n})\n\n"})},2083:function(n,e,t){"use strict";t.r(e);var i=t(1635),r=t.n(i);e.default=n=>n({id:"kotlin",name:"Kotlin",featureFlag:"client-library--kotlin",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-java/tree/master/client-kotlin" target="_blank"  rel="noreferrer">GitHub Repository</a>\n\n##### Add Dependency\n\nBuild with Maven\n\n```\n<dependency>\n  <groupId>com.influxdb</groupId>\n  <artifactId>influxdb-client-kotlin</artifactId>\n  <version>2.0.0</version>\n</dependency>\n```\n\nBuild with Gradle\n\n```\ndependencies {\n  compile "com.influxdb:influxdb-client-kotlin:2.0.0"\n}\n```\n',logo:r.a,initialize:'package example\n\nimport com.influxdb.client.kotlin.InfluxDBClientKotlinFactory\nimport kotlinx.coroutines.channels.consumeEach\nimport kotlinx.coroutines.channels.filter\nimport kotlinx.coroutines.channels.take\nimport kotlinx.coroutines.runBlocking\n\nfun main() = runBlocking {\n\n    // You can generate a Token from the "Tokens Tab" in the UI\n    val token = "<%= token %>"\n    val org = "<%= org %>"\n    val bucket = "<%= bucket %>"\n\n    val client = InfluxDBClientKotlinFactory.create("<%= server %>", token.toCharArray(), org)\n}\n\n',execute:'val query = ("from(bucket: \\"<%= bucket %>\\")"\n  + " |> range(start: -1d)"\n  + " |> filter(fn: (r) => (r[\\"_measurement\\"] == \\"cpu\\" and r[\\"_field\\"] == \\"usage_system\\"))")\n\n// Result is returned as a stream\nval results = client.getQueryKotlinApi().query(query)\n\n// Example of additional result stream processing on client side results\n  // filter on client side using `filter` built-in operator\n  .filter { "cpu0" == it.getValueByKey("cpu") }\n  // take first 20 records\n  .take(20)\n  // print results\n  .consumeEach { println("Measurement: ${it.measurement}, value: ${it.value}") }\n\nclient.close()\n\n'})},2084:function(n,e,t){"use strict";t.r(e);var i=t(1639),r=t.n(i);e.default=n=>n({id:"scala",name:"Scala",featureFlag:"client-library--scala",description:'For more detailed and up to date information check out the <a href="https://github.com/influxdata/influxdb-client-java/tree/master/client-scala" target="_blank"  rel="noreferrer">GitHub Repository</a>\n\n##### Add Dependency\n\nBuild with sbt\n\n```\nlibraryDependencies += "com.influxdb" % "influxdb-client-scala" % "2.0.0"\n```\n\nBuild with Maven\n\n```\n<dependency>\n  <groupId>com.influxdb</groupId>\n  <artifactId>influxdb-client-scala</artifactId>\n  <version>2.0.0</version>\n</dependency>\n```\n\nBuild with Gradle\n\n```\ndependencies {\n  compile "com.influxdb:influxdb-client-scala:2.0.0"\n}\n```\n',logo:r.a,initialize:'package example\n\nimport akka.actor.ActorSystem\nimport akka.stream.scaladsl.Sink\nimport com.influxdb.client.scala.InfluxDBClientScalaFactory\nimport com.influxdb.query.FluxRecord\n\nimport scala.concurrent.Await\nimport scala.concurrent.duration.Duration\n\nobject InfluxDB2ScalaExample {\n\n  implicit val system: ActorSystem = ActorSystem("it-tests")\n\n  def main(args: Array[String]): Unit = {\n\n    // You can generate a Token from the "Tokens Tab" in the UI\n    val token = "<%= token %>"\n    val org = "<%= org %>"\n    val bucket = "<%= bucket %>"\n\n    val client = InfluxDBClientScalaFactory.create("<%= server %>", token.toCharArray, org)\n  }\n}\n\n',execute:'val query = (s"""from(bucket: "<%= bucket %>")"""\n  + " |> range(start: -1d)"\n  + " |> filter(fn: (r) => (r[\\"_measurement\\"] == \\"cpu\\" and r[\\"_field\\"] == \\"usage_system\\"))")\n\n// Result is returned as a stream\nval results = client.getQueryScalaApi().query(query)\n\n// Example of additional result stream processing on client side\nval sink = results\n  // filter on client side using \\`filter\\` built-in operator\n  .filter(it => "cpu0" == it.getValueByKey("cpu"))\n  // take first 20 records\n  .take(20)\n  // print results\n  .runWith(Sink.foreach[FluxRecord](it => println(s"Measurement: ${it.getMeasurement}, value: ${it.getValue}")\n  ))\n\n// wait to finish\nAwait.result(sink, Duration.Inf)\n\nclient.close()\nsystem.terminate()\n\n'})}}]);
//# sourceMappingURL=11.4f9ab9f3ec.js.map