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

Current value is displayed wrong in case of using a data_generator which creates future values #8

Closed
4 tasks done
TheBrain8791 opened this issue Jan 17, 2023 · 0 comments · Fixed by #9
Closed
4 tasks done
Labels
bug Something isn't working

Comments

@TheBrain8791
Copy link
Owner

Checklist

  • I updated the card to the latest version available
  • I cleared the cache of my browser
  • I verified that I'm really running the lastest version in my browser console
  • I checked if there is another issue opened with the same problem

Describe the bug
Using a data_generator, the current value of the entity is displayed wrong, since always the last / youngest historical value is used for this according to the code.

get lastState(): number | null {
return this.history.length > 0 ? this.history[this.history.length - 1][1] : null;

In case a data_generator is used which creates "future" values (values which will be valid in a future point in time) - this approach causes the issue:

Version of the card
Version: 2.0.2

Expected behavior
The value of the entity as reported by HA should be used the display the current value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant