HASSBIAN crashes, my pi3 crashes. How to troubleshoot

I had others which I removed, now I only have

logger:
  default: warning
  logs:
    homeassistant.components.switch.broadlink: info

The file
home-assistant_v2
is already 1.200.000KB, after I cancelled it 1 hour ago ā€¦

what is this???

EDIT this is the database file, NOT the logger file

Okay, the database file. My fault I thought it was the home-assistant.log file.

The database file is influenced by how many devices you have in the history: and logbook: components: and how chatty those devices they are. https://home-assistant.io/components/history/

You can honestly shut down HA, copy that file off, delete it and restart HA.

definetely its an issue, this morning HASS was down (pi3 was ok), and I see that DB file is 4 gbyte, in one night.

How to stop from making it grow so fast?

I also deleted the
recorder:
logbook:

entries in my configuration file

I canā€™t just delete the file and thatā€™s it? Does HASS need to be stopped? I deleted it while HASS was going

I would stop the service before deleting the db, just to be sure the db doesnĀ“t get corrupted.

You can configure the history: component to limit the amount of data that is stored in the database.
I have mine set up with only the things I am interested in keeping the history of. Something like this:

history:
  include:
    entities:
      - sensor.media_power
      - sensor.laundry_running
      - switch.wol_comp1
      - binary_sensor.sensor_hall_sensor
      - sensor.sensor_hall_temperature
....

if you put INCLUDE, will exclude everything else?

Yes. You can also include a whole domain, and exclude parts of that. But I prefer to just add the entities I want history for, listed one by one.

yes of course. I just include one binary_sensor, and little by little I will add what I need.

Also put recorder: with purge_days?

Thatā€™s what I do. Here is my recorder config:

# (file included via recorder: !include recorder.yaml)
purge_days: 2
db_url: sqlite:///home/homeassistant/.homeassistant/home-assistant.db
exclude:
  domains:
    - automation
    - weblink
    - updater
  entities:
    - sun.sun   # Don't record sun data
    - sensor.last_boot
    - sensor.date

I could probably exclude even more, I havenā€™t looked at it in a while.

I am not sure I understand

you put

history:
  include:

AND

recorder:
  exclude:

?

1 Like

Here is my configuration

history:
  include:
    entities:
      - binary_sensor.motion_sensor_158d000129a3c4

and the database log is 2Gbyte after few hours ā€¦ I do not understand

Hmm, thanks for pointing it out @anon35356645. Iā€™m looking at the docs now, and I may have gotten it a bit backward. The documentation isnā€™t totally clear, but it might be working like this:

  • Recorder decides what is recorded, and history only filter what is presented in the UI.

If thatā€™s the case, then itā€™s the recorder part that needs more heavy pruning (from the DB size point of view). I would love som clarification on this myself.

I think Iā€™ll add the history includes to the recorder and see what happens, and perhaps skip it in the history: settings.

Updated recorder and history settings. This will be interesting.

# Recorder with the few entities I want included
recorder:
  purge_days: 2
  db_url: sqlite:///home/homeassistant/.homeassistant/home-assistant.db
  include:
    entities:
      - sensor.media_power
      - sensor.laundry_running
      - switch.wol_comp1
      - binary_sensor.sensor_hall_sensor
      - sensor.sensor_hall_temperature

# History setting is empty now
history:

I may need to add a few more entities or domains in the future. Hope it works out for you @anon35356645.

Yes is strange. If we put INCLUDE, it should exclude what is not indicated (if we use simply the command history: it should record EVERYTHING), otherwise the command INCLUDE has no sense.

p.s. now my database is 3,4Gbyte ā€¦ no wonder after a while probably fills up the SD card. And in any case is not good to write so much on the SD card.

I just wish to know how to stop this recording

is this correct?
/// 3 times

Yes. Itā€™s sqlite://<path>, and since the path starts with / it becomes three slashes.

Ok, and the name of my database is

home-assistant_v2

so I should put with _v2 ?

(I am on HASSBIAN 1.something)

It doesnā€™t matter what you call your dababase afaik, so keep the name you have, or rename it as you want. As long as the accound have permissions to write there it should be fine.

Ok thanks, letā€™s see