Influxdb and grafana running but having issues with continuous data feeds

I’m looking to pull in custom time frames and calculations on the on/off events of my underfloor heating switches.

So I have this panel with all the heating switches.
The idea is to extract the on/off times from the logbook and have them on another row plus calculations on cost kWh.

My panel looks like this now.

I’ve seen a couple of Gits with projects but would like to hear from people who have done something similar. How do I extract the data from the logbook easily?


heatingCost

Looks like the way to go is to create a template. Reading into examples now

this is driving me nuts.

created folder integrations, template, history_stats and tried all the examples and just get a lot of config errors.

I’m looking to calculate the times on/off of switches and add a formula to see the kwH depending on which switch used.

There may be an easier way, but I use Node-Red. Run an sql query to extract the data and then display the results.

1 Like

let me check that out as I’m a dba! daily work with sql

hmm installed it and getting ‘502: Bad Gateway’

I’m in yeahh thanks!!

I’m struggling quite a bit with this. Getting the hang of the node flow in node-red for automation.

But what I am really looking for is a way to code in sql to pull out total times of on/off states of specific entities (do some further calcs on them) and show them on the lovelace or even the node-red dash in a visible UI form.

I’ve added sqllite on the sidebar so I can query data but rendering this into lovelace is where I am stuck

Got somewhere but using a different method so far.

  - platform: history_stats
    name: Master Bedroom Heating ON today
    entity_id: switch.sonoff_10008ffb6a
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0, minute=0, second=0) }}'
    end: '{{ now() }}'

HeatingON

I have Grafana and influxdb up and running.

Tested with 3 temp sensors on a graph. It only seems to show the data at the point I restart HA. Not a continuous feed.

Where am I going wrong? config yaml looks all ok and influxdb says connected successfully. I can see all the entities in the drop downs under the DB.

ok my confusion continues.
Created a linear graph with just the sum temp sensor. All looked fine.
Published it to a new dash and just get one dot, not what I see in the query view.

Getting somewhere now. One setting changed and it linked the nulls to make a line instead of dots!

Help as soon as I include ‘include’ in my config it stops bringing in the data.
Something wrong with the indentation?

  default_measurement: state
  include:
    entities:
       - switch.51746580840d8e63e756
       - switch.51746580840d8e63e75
       - switch.51746580840d8e63e756
       - switch.sonoff_10008ffb6a
       - switch.sonoff_10008ff9e7   
       - switch.sonoff_1000744b0c

Can anyone shed light on why 2 of the sensors are not feeding in data here for the past 3 hours but on the lovelace I can see the temp just fine? Also on my ewelink app.

Nothing excluded in the config yml. Can’t see any abnormal error logs.

If I change the option of fil to fill(previous) this then continues the lines.
Does this mean if there has been no change in value the linear graph stops unless I use previous option?

I can’t see anything wrong with the indentation here.

Soon as I have the include section in data stops feeding in.
If I comment them out all data feeds in.

  max_retries: 6
  default_measurement: state
  include:
    entities:
      - switch.51746580840d8e63e756
      - switch.sonoff_10008ffb6a
      - switch.sonoff_10008ff9e7   
      - switch.sonoff_1000744b0c
      - switch.sonoff_1000907bc4
      - switch.sonoff_1000907f28
      - switch.sonoff_1000908142
      - switch.sonoff_10008f8794
      - switch.sonoff_1000729132

Hello @yonny24 did you solve this issue with missing records in grafana ? , I have exactly the same problem with my measurement of temperature in my HVAC system. Could not find anything to solve this.
image