I’m having some problems with data getting into InfluxDB from homeassistant (0.100.2 using the official docker image). Some stuff is fine, appearing under climate.kitchen absolutely fine. The following query works fine.
FROM homeassistant climate.landing WHERE SELECT field (current_temperature) mean () GROUP BY time ($__interval) fill (null)
What’s odd is that some sensors seem to be being placed under tables which are named after the units of measurement. For example, the data rates from my router are appearing under kbytes/sec and not sensor.mikrotik_router_kbyte_sec_received:
FROM homeassistant kbyte/sec WHERE SELECT field (value) mean () GROUP BY time ($__interval) fill (linear)
This is also happening with other components measurements like heating power setting which is being sent to the table %
OK, I’ve found out what’s going on. I’m documenting it here so that future people might find this.
If a unit of measurement is defined, then that is used as the measurement name, but entries are tagged with the sensor id. Therefore you need to add a WHERE clause to the query to filter out values. For example:
SELECT mean("value") FROM "%" WHERE ("entity_id" = 'kitchen_humidity') AND $timeFilter GROUP BY time($__interval) fill(previous)
It seems this has been done so you can, for example, average all temperature measurements in the house, although to my experience that doesn’t really work.
Just wanted to say thank you for documenting this. I’ve been trying to work out where my temperature measurements had been going, as they weren’t under the measurement name.
yes awesome, thanks! was confused by this myself. anyway to turn the behavior off? i’d prefer consistency where everything is its own measurement as it makes selecting things in grafana much easier.
Old thread, but really useful even today. Using this finally allowed Grafana to be able to select the data I was expecting. Updating for the benefit of others as this is still top of the google hits for this.