-
Notifications
You must be signed in to change notification settings - Fork 21
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
usersvg - png - animations not beingapplied #235
Comments
As for one of your problems, I just realized that the state 'unavailable' did not work previously, as it was internally translated to '-ua-'. With the refactoring of the state machine, SAK now is able to use the 'unavailable' state, so I think if you replace '-ua-' with 'unavailable', your animation should work again... As you can see below, the 'unavailable' state is now also localized correctly: That was one of the reasons to support 'unavailable', as the HA localization engine requires this. My SAKE9 example dashboard is still working with icon and card color changes depending on the state. I did not have to make changes for those cards: |
About percentages. If you use 'format: brightness', that should be replaced with 'convert: brightness'. But other than that, the animation engine hasn't changed, nor has the template engine. But you might have stumbled on an edge case, as I always define 'default' styles in my cards, so I can see if there is an unhandled state for the animations like 'undefined' or 'unavailable'. The switch tool for instance has its thumb in the middle by default as long as there is no 'on' or 'off' state received. If your problem and the solution is clear, I can add that to the documentation about animations! |
Do you see errors in the console of the browser? As it seems if nothing draws, some error is detected. My pollen and AQI test cards still work, so your card does other things than I have tested. |
Ok. That explains at least that SAK won't do what it should do. What version of HA core are you running? |
Ok. I'm still running 2023.5.x The crash with the The lowercase errors will likely prevent the state handler from doing its job. The animation engine is part of that state handler, so also won't do what it should do. |
Hope this helps you with the developement of the card :) so the 'simple' fix was having to add a default image to animations on usersvgs (mabye only in case they use png? ) you can close this if you want for me. depending if you see an issue to fix in your code or just add it to the docs Final (working) code:
|
Great! I now think I know what's going on: as of v2.5.1, the 'undefined' state is processed through the pipeline as it now has become a valid state, including localization. Previously, an 'undefined' state was filtered very early in the state handler. Now I think the By setting the 'default' image, you always have a valid state, as the image is the resulting state for the I just checked all my examples, and they either use a list of images, or use a Javascript template to determine the image, which ALWAYS returns a 'default' image. Hence those always work! |
I will keep it open for now, to add validation in the code, and put it in the documentation.
Yup. Most of the bugs are very logical once you find the problem. This one never was a problem because the 'undefined' state was filtered. So the omission of the default image was never a problem! Thanx for debugging 😄 |
Bug report notice
Before you file a bug, make sure that you did not make a configuration mistake. The Swiss Army Knife in its current state does not yet have full configuration sanity checks!
I'm not sure actually
Swiss Army Knife version
Bug description
State animation not being applied to png usersvg.
I have a robot vaccuum, and the rectex responds well to the animations (entity_index 0)
for debugging purpose i also added a state with the text value of the entity_index 1.
when aplying the style directly (without animations) it works.
once i try to apply it through animations it doesn't respond.
current life span of main brush is 0.54% which is rounded to 1 with the decimals:0. since i thought maybe it was an issue with the comma.
ive tried adding ' brackets around the state value: card isnt drawn anymore at all (no error card, just invisible)
adding ' over operator: doesn't do anything
adding entity_index in the state animation: nothing
since its a percentage, maybe sak treated it as a percentage, so i used 0.10, 0.20, 10% 20% as states as well: also nothing
i wanted to wait for the update to see if that might have a fix but still the same issue.
so if you see anything thats wrong with the code or if it is an actual bug, please enlighten me.
To Reproduce
card code:
Expected behavior
change appearance on svg based on state.
Screenshots
card example:
The text was updated successfully, but these errors were encountered: