Operato Windrose panel - how to use it with separate queries for wind direction and speed?

I am trying to use the Operato Windrose plugin for my wind data (collected by Home Assistant and saved in InfluxDB).
I currently have the following two queries:
SELECT mean(“value”) FROM “km/h” WHERE (“entity_id”::tag = ‘gw1100a_wind_gust’) AND $timeFilter GROUP BY time($__interval) fill(null)
and
SELECT mean(“value”) FROM “°” WHERE (“entity_id”::tag = ‘gw1100a_wind_direction’) AND $timeFilter GROUP BY time($__interval) fill(null).

But I don’t know how to get it to the format required by the Operato Windrose plugin…

To use the Operato Windrose plugin, you need to ensure that your data is formatted correctly with the required field names: wind_speed and wind_direction. Since you have separate queries for wind speed and wind direction, you will need to combine them into a single query result that the plugin can use.

Here's how you can achieve this using InfluxDB's Flux language, which allows you to join data from different measurements:

  1. Convert your queries to Flux: If you're using InfluxQL, you might need to switch to Flux to perform the join operation. Here's an example of how you can do it:
// Query for wind speed
windSpeed = from(bucket: "your_bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "km/h" and r.entity_id == "gw1100a_wind_gust")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> keep(columns: ["_time", "_value"])
  |> rename(columns: {_value: "wind_speed"})

// Query for wind direction
windDirection = from(bucket: "your_bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "°" and r.entity_id == "gw1100a_wind_direction")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> keep(columns: ["_time", "_value"])
|> rename(columns: {_value: "wind_direction"})

// Join the two queries on time
join(
tables: {speed: windSpeed, direction: windDirection},
on: ["_time"]
)

  1. Ensure Correct Field Names: The joined result should have fields named wind_speed and wind_direction, which are required by the Operato Windrose plugin.

  2. Configure the Panel: Once you have the data in the correct format, configure your Grafana panel to use this query. Make sure the panel type is set to Operato Windrose.

  3. Adjust Settings: You may need to adjust the panel settings to fit your visualization needs, such as setting the correct wind speed unit if it's not in m/s.

By following these steps, you should be able to visualize your wind data using the Operato Windrose plugin. If you encounter any issues, feel free to ask for further assistance!

grot is still learning and improving, please let me know how I did by reacting below.

👍🏽 or 👎🏽

How could I do this witb Prometheus as data source?
My queries look like this:

{"sensor.gw1100a_wind_gust_value"}

And


{"sensor.gw1100a_wind_direction_value"}

To use the Operato Windrose plugin with Prometheus as your data source, you'll need to ensure that your data is formatted with the required field names: wind_speed and wind_direction. Since Prometheus doesn't natively support joining queries like SQL or Flux, you'll need to use Grafana's transformations to achieve this.

Here's how you can set it up:

  1. Create Two Queries: In your Grafana panel, create two separate queries for wind speed and wind direction.

  2. Query A (Wind Speed): promql sensor_gw1100a_wind_gust_value

  3. Query B (Wind Direction): promql sensor_gw1100a_wind_direction_value

  4. Apply Transformations: Use Grafana's transformation feature to combine these queries into a single dataset.

  5. Add a Transformation: After creating your queries, go to the "Transform" tab in the panel editor.

  6. Add a "Merge" Transformation: Use the "Merge" transformation to combine the two queries based on the time field. This will align the data points by time.

  7. Rename Fields: Use the "Organize fields" transformation to rename the fields to wind_speed and wind_direction. This is crucial because the Operato Windrose plugin expects these specific field names.

  8. Configure the Panel: Set the panel type to Operato Windrose and ensure that the data source is set to the transformed data.

  9. Adjust Settings: Configure the panel settings to match your visualization needs, such as setting the correct wind speed unit if it's not in m/s.

By following these steps, you should be able to visualize your wind data using the Operato Windrose plugin with Prometheus as your data source. If you encounter any issues or need further assistance, feel free to ask!

grot is still learning and improving, please let me know how I did by reacting below.

👍🏽 or 👎🏽

The Organize fields transformation only sets the display_name and does not really rename fields…

To effectively use the Operato Windrose plugin with Prometheus as your data source, you need to ensure that the data is formatted with the required field names: wind_speed and wind_direction. Since Prometheus doesn't support joining queries like SQL or Flux, you can use Grafana's transformation features to achieve this. Here's a step-by-step guide to help you:

  1. Create Two Queries: In your Grafana panel, create two separate queries for wind speed and wind direction.
  2. Query A (Wind Speed): promql sensor_gw1100a_wind_gust_value
  3. Query B (Wind Direction): promql sensor_gw1100a_wind_direction_value

  4. Apply Transformations: Use Grafana's transformation feature to combine these queries into a single dataset.

  5. Add a Transformation: After creating your queries, go to the "Transform" tab in the panel editor.
  6. Add a "Merge" Transformation: Use the "Merge" transformation to combine the two queries based on the time field. This will align the data points by time.

  7. Rename Fields: Since the "Organize fields" transformation only changes the display name and not the actual field name, you need to ensure that the fields are correctly named wind_speed and wind_direction. Unfortunately, Grafana's transformation capabilities might not directly rename fields in the dataset, but you can use the "Organize fields" transformation to ensure the display names are correct for visualization purposes.

  8. Configure the Panel: Set the panel type to Operato Windrose and ensure that the data source is set to the transformed data.

  9. Adjust Settings: Configure the panel settings to match your visualization needs, such as setting the correct wind speed unit if it's not in m/s.

If the transformation options in Grafana do not meet your needs for renaming fields, consider preprocessing the data outside of Grafana to ensure it matches the required format before it is ingested into Prometheus.

If you encounter any issues or need further assistance, feel free to ask!

grot is still learning and improving, please let me know how I did by reacting below.

👍🏽 or 👎🏽