Hi,
I have stored a lot of data in the InfluxDB from a sensor called sensor.temperature_158d0002e966d7 . I would like to rename this sensor to a more meaningful name sensor.temperature_livingroom without losing all my already stored data in InfluxDB. How can I do that?
Using the influx client, I’ve tried SQL statements such as:
> SELECT * FROM "homeassistant"."autogen"."°C" WHERE time = 1594530983521684992
time Measured Measured_str Stationname Stationname_str attribution_str battery_level device_class_str domain entity_id friendly_name_str icon_str value voltage
---- -------- ------------ ----------- --------------- --------------- ------------- ---------------- ------ --------- ----------------- -------- ----- -------
1594530983521684992 27 temperature sensor temperature_158d0002e966d7 Buiten 11.8 2.94
> UPDATE "homeassistant"."autogen"."°C" SET entity_id=temperature_livingroom WHERE entity_id=temperature_158d0002e966d7
ERR: error parsing query: found UPDATE, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER, SET, KILL at line 1, char 1
But the UPDATE statement is obviously not supported by InfluxDB.
Some background info:
InfluxdB version: 3.7.2
~ $ ha info
arch: armv7
channel: stable
docker: 19.03.8
hassos: "4.11"
homeassistant: 0.112.4
hostname: homeassistant
logging: info
machine: raspberrypi4
supervisor: "228"
supported_arch:
- armv7
- armhf
timezone: Europe/Amsterdam
Configuration.yaml
influxdb:
host: 192.168.103.110
port: 8086
database: homeassistant
username: homeassistant
password: xxxxx
max_retries: 3
default_measurement: state
include:
entities:
- sensor.temperature_158d0002ca033a
- sensor.humidity_158d0002ca033a
- sensor.br_precipitation_2
- sensor.br_temperature_2
- sensor.br_pressure_2
- sensor.temperature_158d0002e966d7
- sensor.humidity_158d0002e966d7
- sensor.humidity
- sensor.tvoc
- sensor.temperature
- sensor.eco2
I’ve been banging my head on this and I’m hoping for someone to put me in the right direction.
Umberto