InfluxDB, Home Assistant & Grafana - Energy & Power

Hi all,

I’m using influxDB on a seperate container including grafana. All my sensors from hassio are reporting to that influxdb next to my mariadb (short term).
I currently declared my energy sensors using the utility_meter configuration, but I cannot succeed in getting them represented in Grafana. Grafana only accepts FLUX language, and that makes it even hard to query the influxDB.

Here are my sensors from utility_meter:

utility_meter:

    energy_offpeak_hourly:
        source: sensor.power_high
        cycle: hourly
    energy_peak_hourly:
        source: sensor.power_low
        cycle: hourly
    gas_hourly:
        source: sensor.gas_usage
        cycle: hourly
        
    
    energy_offpeak_daily:
        source: sensor.power_high
        cycle: daily
    energy_peak_daily:
        source: sensor.power_low
        cycle: daily
        
    energy_import_t2_daily:
        source: sensor.power_low
        cycle: daily
        
    energy_import_t1_daily:
        source: sensor.power_high
        cycle: daily
        
    energy_export_t2_daily:
        source: sensor.power_delivery_low
        cycle: daily
        
    energy_export_t1_daily:
        source: sensor.power_delivery_high
        cycle: daily
        
    gas_daily:
        source: sensor.gas_usage
        cycle: daily
        
    pv_daily:
        source: sensor.solaredge_lifetime_energy
        cycle: daily
        
    wasdroger_energy_daily:
        source: sensor.power_6
        cycle: daily
        
    wasmachine_energy_daily:
        source: sensor.power_4
        cycle: daily
        
        
        # Weekly sensors
    energy_offpeak_weekly:
        source: sensor.power_high
        cycle: weekly
    energy_peak_weekly:
        source: sensor.power_low
        cycle: weekly
    gas_weekly:
        source: sensor.gas_usage
        cycle: weekly
    
    wasdroger_energy_weekly:
        source: sensor.power_6
        cycle: weekly
        
    wasmachine_energy_weekly:
        source: sensor.power_4
        cycle: weekly
        
        #  water_weekly:
        #    source: sensor.water_meter_usage_in_m3
        #    cycle: weekly
        
    pv_weekly:
        source: sensor.solaredge_lifetime_energy
        cycle: weekly
        
        # Monthly sensors
        # energy_peak_monthly:
        #   source: sensor.power_low
        #   cycle: monthly
        
        # energy_offpeak_monthly:
        #   source: sensor.power_high
        #   cycle: monthly
        
    energy_import_t2_monthly:
        source: sensor.power_low
        cycle: monthly
        
    energy_import_t1_monthly:
        source: sensor.power_high
        cycle: monthly
        
    energy_export_t2_monthly:
        source: sensor.power_delivery_low
        cycle: monthly
        
    energy_export_t1_monthly:
        source: sensor.power_delivery_high
        cycle: monthly
        
    gas_monthly:
        source: sensor.gas_usage
        cycle: monthly

    wasdroger_energy_monthly:
        source: sensor.power_6
        cycle: daily
        
    wasmachine_energy_monthly:
        source: sensor.power_4
        cycle: daily
                
    
        
    pv_monthly:
        source: sensor.solaredge_lifetime_energy
        cycle: monthly
        
        # Yearly sensors
    energy_offpeak_yearly:
        source: sensor.power_high
        cycle: yearly
    energy_peak_yearly:
        source: sensor.power_low
        cycle: yearly
    gas_yearly:
        source: sensor.gas_usage
        cycle: yearly
    
    pv_yearly:
        source: sensor.solaredge_lifetime_energy
        cycle: yearly
    
    cv_energy_daily:
        source: sensor.cv_verbruik_kwh
        cycle: daily

I would like to have an overview per day, month & week for my energy consumed, for my gas usage and my solar production. I’ve read a lot of articles on the group function, but somehow, I can’t get it working in Grafana * v8.3.4 (a551d74b11)

Anyhelp would make my day !

Thanks a lot !

Kr,

Bart
`

Welcome to the Grafana forum.

When you set up InfluxDB, have you opened up Data Explorer and played around with it? It would typically be at http://your_local_ip:8086

I have found that building Flux queries in there, then changing to the editor to view the actual Flux query that was just built, then copy & paste into Grafana is much easier than writing a Flux query from scratch.

1 Like

Hi Grant2,

Thanks very much for the explanation, I indeed managed to create the queries in InfluxDB and copy them over to the Grafana Flux.
However, I managed to link link my bucket to a database and create link with the database using the QL method. I’m happy now to create my queries in the Grafana Query Editor :slight_smile:

Thanks again for your swift answer !

Kr,

Bart

InfluxQL is definitely easier. I am still trying to learn Flux and I will be the first to admit that it is not easy to pick up.

I’m getting there, on the InfluxQL stuff of course :slight_smile: