Temperature measurement performance and bugs

http://karpero.mine.nu/ha

Moderators: tom_rosenback, Daniel, Telldus

Post Reply
honken
Posts: 1
Joined: Thu Jan 18, 2018 11:08 am

Temperature measurement performance and bugs

Post by honken » Thu Jan 18, 2018 11:08 am

I've been running Homeautomation for over a year, really like it! One thing that is not quite working the way it is intended though I believe is the temperature measurements. I just upgraded to HA 3.1.1 but the problems remain. The biggest issue is performance, I have three temperature + humidity sensors, and after running HA for a bit less than a year the temps table now contains about 650K rows. Due to the amount of data and how the readings for the measurements page gets calculated this started to cause issues a couple of months back, when the page just went blank. Found that PHP was running out of memory, so despite it not being a very viable long-term solution I changed from the standard memory_limit = 128M to 150M and now more recently 160M to get the page to render. It used to be really slow to load, but after switching to HA 3.1.1 it at least loads quicker. Are there any thoughts on how data can be aggregated long-term in an RRD-like fashion to prevent it from getting out of hand, or to aggregate it in the database as it grows to reduce the memory footprint? I saw the recent changes in 3.1 to prevent the same value from getting entered repeatedly which should help, but the amount of data will still grow over time, especially with a larger number of sensors.

Daniel
Posts: 313
Joined: Thu Jan 18, 2018 11:08 am

Re: Temperature measurement performance and bugs

Post by Daniel » Thu Jan 18, 2018 11:08 am

For the next version of HA (I guess it'll be 3.2) the entire database handling is reworked and moved from using deprecated mysql functions to mysqli. This work is primarily done to get it to work with php 7, but it's also affecting performance overall.

With that said though, we haven't done anything in terms of RRD or anything like that, so I think your problem will be much the same. I guess it's a future thing to look at.

One thing you could do though is culling old data. Some years ago I made a function called "cullOldData" that was never used but still is in there somewhere. What it does is removing all values but min and max for days older than x days. If you put something like the following in a php file and call it (and then wait for quite some while), your database will probably shrink quite a bit:

Code: Select all

<?php

include("includes.php");

cullOldData(90);

?>
No guarantees though. Take a backup of your database before trying!

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha

Post Reply