How to increase amount of InfluxDB data points


I want to record the battery levels for my thermostats in influxdb and graph them with grafana.
For each thermostat, I created a sensor like this:

platform: template
    value_template: '{{ states.climate.danfoss_z_thermostat_014g0013_heating_1_2_1.attributes.battery_level | int }}'
    unit_of_measurement: '%'
    entity_id: climate.danfoss_z_thermostat_014g0013_heating_1_2_1

This basically works, but I see two issues:

  • the values recorded/graphed are sometimes completely off for all of these sensors - e.g. half of the actual value.
  • there’s only about one datapoint created per 24h, sometimes even less, sometimes (rarely) more.

Is there a way to increase the datapoints, i.e. the amount of measurements that HA sends to influxdb?
And if anyone has a cause/solution for the first issue, I’d be glad to hear about it too :slight_smile:


EDIT: that’s how it currently looks in grafana:

Sometimes there’s no graph at all because no data points are available for the selected time range.

I think hass submits all the data that it receives to influxdb, so my guess here is that you are not receiving very often from the thermostat itself, so improving Z-wave coverage might be your only solution.

Some ideas:

Check how many points you have querying directly influxdb (port 8083), to rule out issues with your Grafana configuration.

Put a z-wave device that can act as a repeater (e.g. smart switch), between your controller and the thermostat.

1 Like

Thanks for your answer!
The data is gathered from a template sensor that reads one of the zwave device’s attributes.
So even if the communication with the zwave device was unreliable (which I can rule out quite certainly), that would only mean that HA’s internal state of this device would not get updated.
As a result, the template sensor would only read outdated values from the internal state - which would be okay.

The issue to me seems to be the template sensor.
It would be cool if there was a way to make it report it’s state periodically, even if the state did not change.
I tried setting up the template sensor with and without the entity_id: line, but it doesn’t make a difference regarding this issue.

I’m also graphing the current state of my thermostats (directly), which reflects the current temperature setting.
This is working reliably so far, so I’d rule out any communication problems.
Also, I get the template sensor issue with for any of these template sensors and the closest thermostat is about 2 meters away from my zwave controller.


I think you answered yourself. If there’s no change - nothing gets logged. Otherwise Influxdb might get hammered. If you want you can set Grafana to “Fill: Previous”. That will make your line more consistent, or you can experiment with the other fill settings.

You could be right - it seems that additional data points get created when restarting HA and otherwise only when values change.
I had hoped there was an option to force an update even if a value didn’t change, e.g. once per hour or so (I have a zwave multisensor that works like that; it sends a report if the sensor value changes by a certain amount or after a specific time interval - whatever happens first).

Anyway, that fill(previous) thing sounds promising, though - I’ll try that and see how it goes.


To my understanding HASS is event driven, so if there’s no new event - nothing is pushed to the other components, like influxdb. Because your multisensor generates an event by sending update regularly, that’s why you get extra points to influxdb. Similarly on restart, your thermostats are queried and that’s why a new point is recorded in InfluxDB.

I’ve been looking at these Danfoss Z-wave thermostats, and I’d be happy if you share your experience with them. Also:

  1. Do they report the current room temperature back to hass, or only the temperature they are set on?
  2. I read somewhere that they update their values every 2 minutes, so can you share whether this is so and how long their batteries last?

I would have thought that the event created by - for example - changing the target temperature would also update the values or the derived template sensors.
But it really seems to be limited to a change in the value used in the template.

So far it does look good using the fill(previous) statement in grafana.
However, I have to view a timespan that contains at least one data point otherwise I only get a “no datapoints” message.
But that’s ok, I guess…

Regarding the Danfoss thermostats:
They only report back their current setting, not the room temperature, unfortunately.
But, since they are thermostats and not just simple valves, they regulate themselves to achieve the wanted room temperature.
I think they wouldn’t work with an external (room) thermostat (like the Nest stuff).
I’m also not sure how representative a temperature sensor would be that’s placed inside the thermostat, i.e. directly next to a radiator.
So I can live with the fact that they don’t report back the current room temperature.

Like (probably) any zwave device, you can configure a wake-up interval for the thermostats.
I have mine set to 30 minutes, which I think is the default.
They wake up when you push a button on the thermostat and also when you send a command to change the temperature setting.
I’m not aware of any 2 minute interval specifically.
Changing the temperature from hass takes some time though; this does not happen instantly.
It may take a few minutes, usually less. Maybe that’s where the 2 minutes come from…

I’ve had my thermostats for 2.5 and 3 months (I bought them in two batches).
Two of the ones I bought first are used in my living room and my home office and they get a new setting at least three times a day though HA.
Most evenings I also manually set a temperature in the living room, so that makes four changes/day.
With those two, I’m currently at 74% and 76% battery level.
I have one that rarely changes temperature, which is now at 80% battery level.
The ones I bought later are also at 80% currently.

So realistically I’m expecting the batteries to last until the end of the heating period.
I’ll probably replace them next fall.


Thanks for the feedback! It’s very valuable to get some real-world usage data :slight_smile: