Graph a group item in grafana?

Hi Guys

I want to graph my Power usage consumption, I have a few number items which I’ve placed into a group, called gPowerUsage.

I want to graph the power usage over 3 months (my power billing cycle) to see how in alignment my utility company is with my bills. I will then reset the usage every billing cycle.

In grafana I can graph the individual items, but I cannot graph a group.

Is there a way to graph the combined usage?

Thank you

Can you post your persistence file, please?

In your persistence file you’ve probably got gPowerUsage*

I think your also need gPowerUsage as it’s own item. It does means it’s technically doubling its storage, but I don’t think Grafana can sum the group for you as they are different series. Another option might be a cq (to use the influxdb term). It may depend on your persistence provider

Sure


Strategies {
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"

    default = everyChange
}

Items {
// persist all members of gInfluxDB Group on: everyChange, everyHour, everyDay
    gInfluxDB*,gSpeedtest*,gSpotify*  : strategy = everyChange, everyHour, everyDay
    gPowerUsage*,gPowerConsumption*   : strategy = everyChange, everyHour, everyDay
    * : strategy = restoreOnStartup
}

items


/* Group Definitions
Group gPowerConsumption
Group gPowerUsage

/* Reset ZWave Usage
switch LivingRoomReset  { channel="zwave:device:d4900ba9:node2:meter_reset" }
switch KitchenReset     { channel="zwave:device:d4900ba9:node4:meter_reset" }

/* ZWave Switches*/
Switch LivingRoomSw1  "Living Room"                                                       { channel="zwave:device:d4900ba9:node2:switch_dimmer1" }
Dimmer LivingRoomDim1 "Living Room [%d %%]"                                               { channel="zwave:device:d4900ba9:node2:switch_dimmer1" }
Number LivingRoomNum1 "Living Room - Current Consumption [%.1f W]"                        { channel="zwave:device:d4900ba9:node2:meter_watts" }
Number LivingRoomNum2 "Living Room - Usage [%.1f kW]"                                     { channel="zwave:device:d4900ba9:node2:meter_kwh" }

Switch KitchenSw1 "Kitchen"                                                               { channel="zwave:device:d4900ba9:node4:switch_dimmer1" }
Dimmer KitchenDim1 "Kitchen [%d %%]"                                                      { channel="zwave:device:d4900ba9:node4:switch_dimmer1" }
Number KitchenNum1 "Kitchen - Current Consumption [%.1f W]"                               { channel="zwave:device:d4900ba9:node4:meter_watts" }
Number KitchenNum2 "Kitchen - Usage [%.1f kW]"                                            { channel="zwave:device:d4900ba9:node4:meter_kwh" }

I use influx.

What is cq? yes I need a function to add them together and graph that item.

1 Like
Strategies {
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"

    default = everyChange
}

Items {
// persist all members of gInfluxDB Group on: everyChange, everyHour, everyDay
    gInfluxDB*,gSpeedtest*,gSpotify*  : strategy = everyChange, everyHour, everyDay
    gPowerUsage*,gPowerConsumption*   : strategy = everyChange, everyHour, everyDay
    gPowerUsage : strategy = everyChange, everyHour, everyDay
    * : strategy = restoreOnStartup
}```

PS: you don’t need the everyday if you are already doing the everyhour…

1 Like

True :slight_smile:

So do you have the gPowerUsage item in Grafana?

Groups dont display, only the individual items @psyciknz

It looks like none of your items are attached to groups. It should be like this.

Number LivingRoomNum2 "Living Room - Usage [%.1f kW]" (gPowerUsage)                                     { channel="zwave:device:d4900ba9:node2:meter_kwh" }

and the group should be like this

Group:Number:SUM gPowerUsage
1 Like

In Grafana you could use a bar chart and then stack the values. this would then show you the individual values and the sum at the same time.

this is a temperature chart so it doesn’t make sense to do that, but it shows the options

Thanks Dan ill try that!

Hi David, ill see how Dans suggestion goes failing that, ill try the bar chart

@dastrix80, just a quick FYI, it will only start tracking the group totals after you make the changes. But this should get it going from that point on. You may want to read up on groups as they are very helpful in processing. There are two areas that come to mind full of information.

Official Group Documentation

and

Design Patterns: Group Based Persistence

Also, if you’re like me and have devices with multi-channels, they may have an energy consumption for the whole device and each individual channel. You don’t want to put both in the group or you will double your consumption for that device. I personally use the individual channels for more precise reporting.

I use @david method as well, depending on what I want to do.

Influx hasn’t updated yet with the group i defined as a selectable graphing item

/* Group Definitions
Group gPowerConsumption
Group:Number:SUM gPowerUsage

/* Reset ZWave Usage
switch LivingRoomReset  { channel="zwave:device:d4900ba9:node2:meter_reset" }
switch KitchenReset     { channel="zwave:device:d4900ba9:node4:meter_reset" }

/* ZWave Switches*/
Switch LivingRoomSw1  "Living Room"                                                       { channel="zwave:device:d4900ba9:node2:switch_dimmer1" }
Dimmer LivingRoomDim1 "Living Room [%d %%]"                                               { channel="zwave:device:d4900ba9:node2:switch_dimmer1" }
Number LivingRoomNum1 "Living Room - Current Consumption [%.1f W]"                        { channel="zwave:device:d4900ba9:node2:meter_watts" }
Number LivingRoomNum2 "Living Room - Usage [%.1f kW]" (gPowerUsage)                       { channel="zwave:device:d4900ba9:node2:meter_kwh" }

Switch KitchenSw1 "Kitchen"                                                               { channel="zwave:device:d4900ba9:node4:switch_dimmer1" }
Dimmer KitchenDim1 "Kitchen [%d %%]"                                                      { channel="zwave:device:d4900ba9:node4:switch_dimmer1" }
Number KitchenNum1 "Kitchen - Current Consumption [%.1f W]"                               { channel="zwave:device:d4900ba9:node4:meter_watts" }
Number KitchenNum2 "Kitchen - Usage [%.1f kW]" (gPowerUsage)                              { channel="zwave:device:d4900ba9:node4:meter_kwh" }

And my persistance file


Strategies {
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"

    default = everyChange
}

Items {
// persist all members of gInfluxDB Group on: everyChange, everyHour, everyDay
    gInfluxDB*,gSpeedtest*,gSpotify*  : strategy = everyChange, everyHour, everyDay
    gPowerUsage*,gPowerConsumption*   : strategy = everyChange, everyHour, everyDay
    * : strategy = restoreOnStartup
}

/* Group Definitions
Group gPowerConsumption
Group:Number:SUM gPowerUsage

/* Reset ZWave Usage
switch LivingRoomReset  { channel="zwave:device:d4900ba9:node2:meter_reset" }
switch KitchenReset     { channel="zwave:device:d4900ba9:node4:meter_reset" }

/* ZWave Switches*/

These are all commented out
You need to add */ at the end of your title lines

1 Like

Thanks Vincent :slight_smile: Seems i need to learn to comment. Ive made the change and will see if the Groups are not present in Grafana when some data is visible.

To comment 1 line use // at the beginning of the line

To comment a block use /* at the beginning and */ at the end.

1 Like

Now that the items definition are uncommented, the items are created (live) so it should work
Did you modify the persistence file as I suggested?

gGroup* for the group members
and
gGroup for the group itself