Changing multiple gauge graph color based on second field of data source

Hello,

I’m not using grafana for long. I’m currently trying to create a dashboard for my home’s energy use. I transmit the inverter data via MQTT to Grafana.

I’d like to make it so that when power comes from the source (PV, battery, grid), the color of the source is blue, but when power goes to this source (charging or selling) the color is green.

In my data source, I have a “Status” field that indicates whether current is being generated (2) or consumed (1).

Here is the MQTT payload:
image

In my transformations, I use “Extract Fields” to extract Photovoltaic source, Battery Source and Grid Source. Then, I used “Organise by fields name” to hide unwanted fields.

How can I change the color of one of my graphs based on this second value?

Thank you in advance,

Valentin

can you post a table view of your data please?

Hello,

Thank you very much for your answer, here is the table view:

So actually you can read as so:

  • House load is 247W
  • PV produce (Status 2) 6615 W => I want to make the gauge color blue
  • Battery is full so nothing happen (Status 0) => I want to make the gauge color gray
  • We sell (Status 1) 6368 W => I want to make the gauge color green

The statuses are

  • 0 : Nothing happens
  • 1 : Incomming to source
  • 2 : Outgoing from source