Missing database - where is it?

Hi all,

I’m trying to locate my DB file in the config folder.

However, the only thing I can see there is this:

Each time I do a hard reset of my HA PC I lost all the data.
Also, sometimes when there is an internet connection issue, my data shows strange numbers after that (example: daily electricity consumption jumps 500% more than it should be).

Any suggestions how to fix that, please?

Many thanks.

If you mean by pulling the power, don’t do that. Do this:

Shut home assistant down from the Supervisor / System / Host box.

Screenshot 2022-03-12 at 16-42-48 Home Assistant

You can also reboot the host here instead of rebooting the PC.

You should very rarely have to do this. You should be restarting only the Home Assistatnt core from Configuration / Settings / Server Controls page. And even then most often you should use the reload services under that (after doing a config check):

If you have frequent power issues get a cheap UPS.

Restarting home assistant core (not the host) should rebuild the the database.

On the side, I installed mariadb and my house/area sees occasional power cuts which, until now, have never lead to issues with that one. As tom states, in reality I should setup a ups but since I had no damage yet…not spending money…which at some point will lead to me paying dearly :slight_smile:

Hi guys,

yes, I know that power cuts off are not recommended.
I’m doing a renovation and I can’t avoid that, unfortunately.

I’ll have a think about a UPS to fix that.

Two things that bother me on this topic:

  1. Why some of my data is wrong after internet disconnection?
    Example: energy usage jumps by few hundred kwh.

  2. I still don’t know where is my DB file?
    Why can’t I see it in the config folder?

Any suggestions, please?

Many thanks.

  1. Because your energy sensors are reporting 0 instead of unavailable. See: https://community.home-assistant.io/t/how-to-prevent-entity-from-resetting-to-0/369363/2

  2. Delete the corrupted versions and

Thank you Tom.

I have around 20 tuya smart plugs at my home.

They also report random jumps in kWh.

I use two tactics to show kWh from them at the moment.

  1. Convert Watts to kWh:

  2. Show to correct stat of watt (Tuya show 100W instead of 10W, hence I divided it by 10):
    ** friendly_name: “Pobor Pralka”**
    ** value_template: “{{ (states(‘sensor.pralka_power’)) | float / 10}}”**

Can you please suggest how to implement your method in my example?

So that kWh won’t jump periodically.

Thank you!

Or maybe let me ask differently:

How to use your method for entities that have small amount of total kWh?

Should I use a different number instead of your 4000 in here:
availability: “{{ states(‘sensor.total_yield’)|float(0) > 4000 }}”

Thank you

You must set the template to a value just below your current value. There are other alternatives. Show your whole template sensor configuration, correctly formatted, don’t post a picture of text.