Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Influx 2.0 beta support #30

Open
wz2b opened this issue Jan 29, 2020 · 2 comments
Open

Influx 2.0 beta support #30

wz2b opened this issue Jan 29, 2020 · 2 comments

Comments

@wz2b
Copy link

wz2b commented Jan 29, 2020

Is there any reason this plugin wouldn't work with influxdb 2.0 ? I attempted this:

from(bucket: "powermon")
  |> range(start: -1h)
  |> filter(fn: (r) => r._measurement == "modbus")
  |> filter(fn: (r) => r._field == "pv1")
  |> last()
  |> yield(name: "value")

That gets the last value of field 'pv1' and returns it with the name 'value' which is what I think PictureIt wants to see. The metric name is A while the configuration calls it "A-Series" but I think that's the same thing.

The result of this query is

,result,table,_start,_stop,_time,_value,_field,_measurement,address,gateway,register
,value,0,2020-01-29T21:38:20.148301123Z,2020-01-29T22:38:20.148301123Z,2020-01-29T22:38:14.259Z,0,pv1,modbus,28,10.7.4.131,1252

Should this work? I have a feeling the result of the query is something that the plugin just doesn't understand.

@wz2b
Copy link
Author

wz2b commented Jan 29, 2020

The problem is right here:

if(sensors[sensor].name == valueMaps[valueMap].name) {

The result that comes back from that query has a 'name' field that's the concatenation of a bunch of the tags. This plugin thinks the names don't match, so it never updates the value. I proved this by just eliminating that test

if(true || sensors[sensor].name == valueMaps[valueMap].name) {

and it works. Obviously, though, that's not really a solution. The right thing to do is somehow figure out how to manipulate the data source so that things come back with a name the plugin understands. I don't know how to do that.

@wz2b
Copy link
Author

wz2b commented Jan 29, 2020

Maybe this helps as well. This is what comes in as datList into onDataReceived. Note that the 'target' and 'alias' are both crazy ... it made those strings out of all the tags on that measurement.

[
  {
    "alias": "modbus pv1 address=28 gateway=10.7.4.131 register=1252",
    "target": "modbus pv1 address=28 gateway=10.7.4.131 register=1252",
    "datapoints": [
      [
        0.74,
        1580327424260
      ]
    ]
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant