Flat line history after upgrade 0.117.x

Hi

After my upgrade to 0.117.x, the history lines are not working properly anymore.
All of my histories are now giving a flat line.

I’m running mariaDB as an addon in HA but the DB is not producing any errors.
Also tried deleting the DB are let it re-create but still no luck.
Tried another browser to see if it was Chrome that was causing the problem, but also the same problem.

Anyone has a solution for this problem?

image

Kind regards

I have the exact same problem after 0.117.x.

A workaround for now is to restart HA and then it works again until next night where it stops working again. Maybe it has to do with automatic back-up which is scheduled in the night but I can’t see any related error in the logs.

EDIT:
In the mariadb log there is a error after I restarted the database:

8:37:52 30 [Warning] Aborted connection 30 to db: ‘homeassistant’ user: ‘homeassistant’ host: ‘172.30.32.1’ (Got an error reading communication packets)

But after this restart it works again.

Same thing here and it is driving me crazy! Apart from the data freezing, I seem to only have the entities from z-wave and few many more, even though the actual data is shown for all zigbee-sensors etc.
I have tried to clear the database (MariaDB, PHPmyadmin) and also reinstall the add-on without any luck. I also tried to tweak the configuration using recorder:include but makes no difference. The logs seem to give no clue either.

EDIT: I seem to have found a solution that works for me. Since 0.117 entity_id is deprecated in templates. I had a template sensor that included an entity_id. Removing it seems to have done the trick! So far I really don’t many database entries to evaluate on, but there was a significant change in the history now including many more.

Hi @masfak97

I’ll try it as soon i’m home :slight_smile:
Thank you for your response!

Hey @masfak97

I guess i’m missing something in your solution.
The code of my screenshot is this:

        title: Home Assistant
        type: glance
      - cards:
          - align_icon: left
            align_state: center
            entities:
              - sensor.processor_use
            name: CPU
            font_size: 75
            icon: 'mdi:chip'
            show:
              fill: false
            type: 'custom:mini-graph-card'
            
          - align_icon: left
            align_state: center
            entities:
              - sensor.memory_use_percent
            name: Memory
            font_size: 75
            show:
              fill: false
            type: 'custom:mini-graph-card'
            
          - align_icon: left
            align_state: center
            entities:
              - sensor.glances_etc_resolv_conf_used_percent_2
            name: Disk
            font_size: 75
            show:
              fill: false
            type: 'custom:mini-graph-card'

The entity’s i’m using in this code are not coming from a template?

Many thanks

So far I can see it’s not related to template entities in my config. What helped for me was to stop the Mariadb addon before I make a backup.

I use the Snapshots addon. In the settings of this addon you can stop certain addons before a backup starts. After changing this setting last night Mariadb keeps working till now.

Different issues then. Sorry…

It has to do probably with the next error that is all over my home-assistant.log

sqlalchemy.exc.IntegrityError: (MySQLdb._exceptions.IntegrityError) (1452, ‘Cannot add or update a child row: a foreign key constraint fails (history.states, CONSTRAINT states_ibfk_2 FOREIGN KEY (old_state_id) REFERENCES states (state_id))’)

What seems to help for me is to restart the Mariadb addon each night, I added this to my automations.yaml:

- alias: 'MariaDB restart'
  trigger:
    platform: time
    at: '04:30:00'
  action:
  - service: hassio.addon_restart
    data:
      addon: "core_mariadb"

I make a Proxmox snapshot of HA each night at 4:00 after that I restart the addon now.

EDIT:
This didn’t seem to help two days later I have flat lines again after the night and had to restart HA.

Flat line was due the DB, check for solution HERE

1 Like