Parameters for dashboard sub variable values

Hey folks,

I am currently having trouble figuring the following setup out (and on top not sure how to google it properly).

I have an energy dashboard showing my power consumption, solar production etc. I want to configure a switch or selection to easily switch between my home consumption and a second flat with the same setup. The issue I have, I can configure as dedicated variables the inverter, the smartmeter and the battery.

However I actually only want to have a selection like “Home” and “SecondPlace”, when one gets selected the corresponding matching values for the inverter, smartmeter and battery are taken. Before some one asks no the data structure does not know “home” or “SecondPlace” :wink: we are looking at three different measurements.

Outlining the desired setup:

  1. Select “Home”
    Inverter value for all queries related is “111”
    Smartmeter value for all queries related is “ZZZ”
    Battery value for all queries related is “BBB”

  2. Select “SecondPlace”
    Inverter value for all queries related is “999”
    Smartmeter value for all queries related is “YYY”
    Battery value for all queries related is “None”

Appreciate any hint or push in the right direction. I am using grafana Open Source + InfluxDB 1.8

This is not copy&paste solution, but idea which you need to polish (e.g. syntax, quotes, …).

Create visible dashboard variable inverter (key/value, e.g. home=>111,secondplace=>999) and then hidden (but keep them visible during development so you can check if they have right values) variables smartmeter,battery which selects right value from InfluxDB based on inverter variable value (e.g. SHOW TAG VALUES WITH KEY = "smartmeter" WHERE inverter=$inverter). Use variables in right panel queries. Of course inverter,smartmeter,battery must be proper tags (not fields) in your InfluxDB measurements.

Hey,

Thanks for the reply, here is part of the problem Smartmeter and battery are independent from the inverter not just technically but also from a data structure. Thus between them there not common element I would limit/query them.

So, create one special measurement just for dashboard structure where you will manage those relations.

1 Like