How to access HomeAssistant’s InfluxDB from R

Wait 5 sec.

[This article was first published on rstats-tips.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.I’m running a HomeAssistant instance at home.I’ve configured it to log data into an InfluxDB database,so I can retrieve historical data for analysis later on. In default modeHomeAssistant would aggregate historical data for storage reasons.So now I want to access the InfluxDB database from R to perform custom analyses.HomeAssistant is still using InfluxDB version 1. To connect to InfluxDB from R,I thought I can use the influxdbr package. But I got some errors becausethis package seems to be outdated.Here’s what I get, when fetching data: 1 2 3 4 5 6 7 8 91011121314library(influxdbr)library(tidyverse)influx_con % as.data.frame(stringsAsFactors = FALSE)12data_raw_df %>% head(10) 1 2 3 4 5 6 7 8 91011## V1 V2 V3## 1 2025-11-11T13:20:31.171165Z Temp_5 25.875## 2 2025-11-11T13:20:43.741052Z Temp_11 30.625## 3 2025-11-11T13:20:43.741159Z Temp_10 48.75## 4 2025-11-11T13:20:44.552422Z Temp_8 28.25## 5 2025-11-11T13:20:44.552522Z Temp_9 28.25## 6 2025-11-11T13:20:50.225514Z Temp_2 19.8## 7 2025-11-11T13:21:07.61594Z Temp_15 26.5625## 8 2025-11-11T13:21:07.616039Z Temp_14 22.9375## 9 2025-11-11T13:21:10.101543Z Temp_13 26.75## 10 2025-11-11T13:21:10.911298Z Temp_12 23.5Now we can change the column names (they are stored indata_raw %>% pluck("results", "series", 1, "columns", 1)) and convert the time column to POSIXct:1234567data_raw_df %>% set_names(data_raw %>% pluck("results", "series", 1, "columns", 1)) %>% mutate( time = as.POSIXct(time, format = "%Y-%m-%dT%H:%M:%OSZ", tz = "UTC"), value = as.numeric(value) ) %>% str()1234## 'data.frame':44176 obs. of 3 variables:## $ time : POSIXct, format: "2025-11-11 13:20:31" "2025-11-11 13:20:43" ...## $ entity_id: chr "Temp_5" "Temp_11" "Temp_10" "Temp_8" ...## $ value : num 25.9 30.6 48.8 28.2 28.2 ...To leave a comment for the author, please follow the link and comment on their blog: rstats-tips.net.R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.Continue reading: How to access HomeAssistant’s InfluxDB from R