If a Integration change it’s Name like hahm → hmip, new Data will be written with new entitiy_id to the InfluxDB. If you have longtime Data and want to visualize it with Grafana for Example, it is kind of PITA.
Use Influx 2 Data Explorer to look at your data and get your entity_id and or _measurement value.
Data need to copied from old to new measurement, as Influx 2 does not support rename. Than old measurement can be deleted.
Source
- InfluxDB 2 Measurements umbenennen – Laub-Home Wiki InfluxDB 2
- Influxdb umbenennen von Measurements – Laub-Home Wiki InfluxDB
Flux Example copy entity_id
- entity_id OLD:
hahm_00xxxxxxxxxxxxx_1_actual_temperature
- entitiy_id NEW:
hmip_swo_pl_00xxxxxxxxxxxxx_temperatur
execute in Influx 2 Data Explorer:
from(bucket: "home_assistant/autogen")
|> range(start: -720d)
|> filter(fn: (r) => r.entity_id == "hahm_00xxxxxxxxxxxxx_1_actual_temperature")
|> set(key: "entity_id", value: "hmip_swo_pl_00xxxxxxxxxxxxx_temperatur")
|> to(bucket: "home_assistant/autogen")
Flux Example copy _measurement
- _measurement OLD:
binary_sensor.hahm_00xxxxxxxxxxxxx_1_raining
- _measurement NEW:
binary_sensor.hmip_swo_pl_00xxxxxxxxxxxxx_regen
execute in Influx 2 Data Explorer:
from(bucket: "home_assistant/autogen")
|> range(start: -720d)
|> filter(fn: (r) => r._measurement == "binary_sensor.hahm_00xxxxxxxxxxxxx_1_raining")
|> set(key: "_measurement", value: "binary_sensor.hmip_swo_pl_00xxxxxxxxxxxxx_regen")
|> to(bucket: "home_assistant/autogen")
Delete old entity_id / _measurement
Look at source links for curl example
influx cli example
influx delete --bucket "home_assistant/autogen" --org "examle-org" --token xxxxxxxxxxxxxxxxxxxxxxx-GvFl-xxxxxxxxxxxxxxxxxxxxxx-YT3icTsm90Rp5w== --predicate 'entity_id="hahm_00xxxxxxxxxxx_1_actual_temperature"' --start '2009-01-02T23:00:00Z' --stop '2023-06-16T23:00:00Z'
Tested with
- InfluxDB: 2.7.1
- HomeAssistant: 2023.6.1