Get values from climate sensor for Grafana

Hi there,

I want to adjust my thermostates so I created templates with the target temperature and the actual temperature. The goal is to know how long a thermostate needs to bring the room from actual temperature to target temperature.

I get the actual temperature quite well but my Cometdect thermostates only output the target temperature on a change. In Grafana this leads to ugly jumps in the graph.

So I decided to get it going with an statistics sensor:

  - platform: statistics
    entity_id: sensor.soll_temp_wohnzimmer
    name: stat_soll_wohnzimmer
    sampling_size: 1

Please say I am stupid (it’s okay) but I am not getting the purpose of the “sampling_size” attribute in my head.

When I set the sampling_size higher I get weird results like “18.6°C” on a sensor who is nailed to 20°C since hours.

May you please help me to build a sensor which is outputting the actual set “target temperature” to Grafana (maybe every 15 minutes)?

Thank you very very much!

Greets from Germany

It sounds like normal behavior to only record the changes. I graph my thermostat with this InfluxDB query:

SELECT last("temperature") FROM "climate.thermostat" 
  WHERE $timeFilter GROUP BY time(1m) fill(previous)

The key here is the selection and the fill.

The graph ends up looking like this:

1 Like

The important part here is how to configure InfluxDB in Home Assistant, so the latter sends all the entities and their attributes as measurements.

Once you do that part, then you can access the data in Grafana, and graph what you want …

I outlined this in an article Visualizing thermostat/HVAC in Home Assistant in InfluxDB and Grafana.

1 Like