Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starline: consecutive records with same states & attributes are written to DB #111524

Closed
ildar170975 opened this issue Feb 26, 2024 · 10 comments
Closed

Comments

@ildar170975
Copy link

ildar170975 commented Feb 26, 2024

The problem

Here is a states table filtered for some particular device_tracker entity:

изображение

The state is same.
Even the attributes_id is same.
Then why there are several consecutive records about same?

What version of Home Assistant Core has the issue?

2024.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

starline

Link to integration documentation on our website

https://www.home-assistant.io/integrations/starline/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @Anonym-tsk, mind taking a look at this issue as it has been labeled with an integration (starline) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of starline can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign starline Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


starline documentation
starline source
(message by IssueLinks)

@ildar170975 ildar170975 changed the title Starline: records with same states & attributes are written to DB Starline: consecutive records with same states & attributes are written to DB Feb 26, 2024
@Anonym-tsk
Copy link
Contributor

This happens because the attributes change. What's wrong with these records?

@ildar170975
Copy link
Author

Attributes do not change.
Check this again:

изображение

Each group has same "attributes_id".
For instance, first 6 records have these attributes:

изображение

Difference between records is only in "last_updated" (every 180 sec).
But this attribute should not be updated if attributes do not change.

@Anonym-tsk
Copy link
Contributor

Maybe schedule_update_ha_state() publishes update for each call, I don't know. @joostlek please help

@joostlek
Copy link
Member

I assume schedule_update_ha_state() will update the state. I don't get what's the problem here

@Anonym-tsk
Copy link
Contributor

schedule_update_ha_state() will update the state

Should this method update state if it hasn't changed? Or should the component itself determine the state change? @frenck

@joostlek
Copy link
Member

Please don't ping random people. This will only have a counter productive effect. Instead formulate a question and put it in the discord #devs channel for example

@joostlek
Copy link
Member

But yes, if you ask to update the ha state, it will update the state and that is also stored

@rvalitov
Copy link

rvalitov commented Mar 5, 2024

Is this issue planned to be fixed?

@ildar170975
Copy link
Author

There is a similar issue #111517

What we can see here in this Starline issue:

  1. A row with same state & attrs is added to DB.
  2. Difference is last_updated (every 3 minutes).

Thoughts:

  1. The way for a user to see that an entity is still being updated (i.e. the Starline integration is still working) - checking last_updated: if it changes -> then the integration is not dead.
  2. According to HA dev: on every change of last_updated a new row is added to DB - even if state & attrs are same. This seems to be a common architecture.

Based on said above - I have to accept the current fact "DB is flooded by same rows".
Closing.
Let me know if I am wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants