Closed andyblac closed 1 year ago
this still occurs in beta 4.0b11, if I can get any logs or debug info please just explain what you want me to do.
this is from safari java console
Some of your templates in your custom fields are incorrect it seems. The JS console will show something like "ButtonCardJSTemplateError" with the error.
if i refresh couple time the error goes away, or if i switch to a standard lovelace dashbaord and refresh then go back to this one again error is gone.
can you see any issue in my code above ?
this is what i see in the console
can you see any issue in my code above ?
No, as I lack context. But again, I need the js console output of the ButtonCardJSTemplateError.
Please try with chrome as it seems safari behaves strangely with the error thrown by your templates (it says anonymous where it should report the error as stated above with ButtonCardJSTemplateError).
is this what your after ?
this is the line
- color: "[[[ return variables.ulm_card_room_sensor_color ? 'rgba(var(--color-'+variables.ulm_card_room_sensor_color+'),0.4)' : 'rgba(var(--color-theme),0.2)'; ]]]"
i want to only use the color if one is defined, else use --color-theme
Change any access to variables.xxxx
to variables?.xxxx
and it will be fixed.
But i'll fix it so that variables
exists even if there are none defined. It will just be an empty object, currently it's undefined
. It's cleaner also.
thanks, i really appreciate the time you take to help people like me out. can I donate to you somehow ?
:tada: This issue has been resolved in version 4.0.0-dev.13 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
both ways fix the issue, thanks again
Jerome, if I may, why do we explicitly have to use the keyword variables
in our templates after a declaration? I mean, if we set a variable in core Jinja we only need to use the name of the variable, without anything further.
eg:
variables:
id: >
[[[ return entity.entity_id.split('.')[1]; ]]]
entity_picture: >
[[[ return '/local/family/' + variables.id + '.jpg'; ]]]
why not simply do:
variables:
id: >
[[[ return entity.entity_id.split('.')[1]; ]]]
entity_picture: >
[[[ return '/local/family/' + id + '.jpg'; ]]]
?
If I am being ignorant of common JS practice, sorry, I have been wondering about this. not an issue in any way so nevermind if this is a silly question.
i think variables is a simple list to store all your vars so you can use the same var name in each template, else if you only have 1 master list you could only use the var name once in the button. but could be wrong, I'm, still new to all this.
why do we explicitly have to use the keyword
variables
Because it's easier for me from a code perspective and avoid weird conflicts (and thus potential new unneeded questions/issues 😄 )
:tada: This issue has been resolved in version 4.0.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Checklist
Describe the bug I get the following at random times, it takes several refreshes or HA restart to fix the error
It only shows on button templates that are not in use, in the above screen shot there is 5 sensor butttons, 2 in use, 3 not, the error only shows only show on ones not in use.
the browser console shows the following.
light-entity-card v6.1.0 is installed
Version of the card Version: 3.5.0
To Reproduce This is the configuration I used:
Screenshots
Expected behavior where the error are on scren it should just a empty space, when the sensor button is not in use, like the 2nd screenshot
Desktop (please complete the following information):