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

Animation Not working as expected #36

Closed
wouzer opened this issue Jun 29, 2020 · 14 comments
Closed

Animation Not working as expected #36

wouzer opened this issue Jun 29, 2020 · 14 comments

Comments

@wouzer
Copy link

wouzer commented Jun 29, 2020

Animation of gauge not working as expected. It doesn't animate from the old value to the new, but 0 to the new. According to the description of the canvas-gauges (https://canvas-gauges.com/documentation/user-guide/configuration), it should animate the needle from old to new value.

Here is my (lovelace) config of the card:

card_height: 175
entity: sensor.verbruik_current
gauge:
animation: true
animationDuration: 1500
animationRule: linear
borderInnerWidth: 0
borderMiddleWidth: 0
borderOuterWidth: 0
borderShadowWidth: 0
borders: false
height: 175
highlights:
- color: 'rgba(200, 50, 50, .75)'
from: 4000
to: 5000
majorTicks:
- '0'
- ' '
- '1000'
- ' '
- '2000'
- ' '
- '3000'
- ' '
- '4000'
- ' '
- '5000'
maxValue: 5000
minValue: 0
minorTicks: 5
startAngle: 45
strokeTicks: false
ticksAngle: 270
title: Verbruik (W)
type: radial-gauge
valueBox: true
valueDec: 0
width: 200
type: 'custom:canvas-gauge-card'

@dhover
Copy link

dhover commented Aug 20, 2020

Same issue here!

@Olen
Copy link
Contributor

Olen commented Nov 19, 2020

That is probably caused by this upstream issue:
Mikhus/canvas-gauges#106
Which should be fixed there.

Edit:
Just checked the code, and the version I have already has the latest canvas-gauges:
* @version 2.1.7 so it seems like either the bug is not properly fixed in 2.1.3, or this is another problem.

@eBoon123
Copy link

eBoon123 commented Mar 8, 2021

Animation of gauge not working as expected. It doesn't animate from the old value to the new, but 0 to the new. According to the description of the canvas-gauges (https://canvas-gauges.com/documentation/user-guide/configuration), it should animate the needle from old to new value.

Here is my (lovelace) config of the card:

card_height: 175
entity: sensor.verbruik_current
gauge:
animation: true
animationDuration: 1500
animationRule: linear
borderInnerWidth: 0
borderMiddleWidth: 0
borderOuterWidth: 0
borderShadowWidth: 0
borders: false
height: 175
highlights:

  • color: 'rgba(200, 50, 50, .75)'
    from: 4000
    to: 5000
    majorTicks:
  • '0'
  • ' '
  • '1000'
  • ' '
  • '2000'
  • ' '
  • '3000'
  • ' '
  • '4000'
  • ' '
  • '5000'
    maxValue: 5000
    minValue: 0
    minorTicks: 5
    startAngle: 45
    strokeTicks: false
    ticksAngle: 270
    title: Verbruik (W)
    type: radial-gauge
    valueBox: true
    valueDec: 0
    width: 200
    type: 'custom:canvas-gauge-card'

I'm seeing the same thing. Just installed 0.4.1. Had to turn animation to False to avoid the annoying flickering back to 0 on every update. These gauges are very cool though - thanks for making this available to Home Assistant!!!

@cooperised
Copy link

Same issue here, not that it needs much confirmation at this point. It would be great to know the cause!

@kaijk
Copy link

kaijk commented Jan 27, 2022

At least I can stop chasing this in my configuration. I'd love a fix as well.
Thanks!

@lloyda
Copy link

lloyda commented Jun 14, 2022

Would also love to see a fix for this.

@wuast94
Copy link

wuast94 commented Dec 16, 2022

any uptade to this?

@seganku
Copy link

seganku commented Jan 21, 2023

animation: false helps a lot, but it would be great to be able to keep animation without the constant jump to zero.

@rhadamantys
Copy link
Contributor

rhadamantys commented Feb 14, 2023

I did some debugging recently, and I figured, that the gauge card gets initialized every time, a new value is reported. That means, that the current value (the value, that the needle shows) is reset to zero and thus, the animation always starts at zero. I tried to add some additional members and store values, they all get reset as well. So my guess is, that the embedding of the gauge in home assistant causes the trouble. The gauge itself is working fine.

@Olen
Copy link
Contributor

Olen commented Feb 15, 2023

Hm. You seem to be right.
The function updated(_) is actually initializing the card on each update.

Could it be as easy as wrapping everything from

to
this._gauge = gauge;
in a if this_gauge != none { } or something?

@rhadamantys
Copy link
Contributor

rhadamantys commented Mar 21, 2023

@Olen: you were right. It is actually if (this._gauge == null) { } in the canvas-gauge-card.ts file. Now it is working locally on my home assistant instance. Thanks a lot for the suggestion!

I created a Pull Request #56

rhadamantys added a commit to rhadamantys/canvas-gauge-card that referenced this issue Mar 21, 2023
@helto4real
Copy link
Collaborator

@Habile2019
Copy link

Habile2019 commented Apr 2, 2023

Thank you for this @helto4real - I'm not sure the fixed JS made it into the release though? I don't see the changes after updating.

@reisfni
Copy link

reisfni commented Apr 6, 2023

Thank you for this! I'm not sure the JS made it into the release though? I don't see the changes after updating.
+1

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

No branches or pull requests