Comments (8)
Your template seems fine to me in a markdown card:
from frontend.
Your template seems fine to me in a markdown card:
Thanks for verifying, but it only fails for entities where the device class is missing.
from frontend.
Yes I see what you mean. It seems markdown card subscribes its template with an additional argument strict: true
, and developer tools does not.
Related: #17824
from frontend.
So it seems that strict
mode for devtools was replaced with an option report_errors
, but report_errors
seems to catch less things than strict mode.
Perhaps that should be reported as a core bug, that report_errors should be able to report everything that strict mode would catch. I assume that was its intention but I don't know.
from frontend.
@karwosts
Nice it seems your identifiers the source of this issue.
But one remark. Rejectattr and selectattr should not raise errors when those attributes don't exist (to my knowledge)?! They will simply not be selected or rejected (like dev tools and template sensors). That is why I raised the issue here.
from frontend.
Rejectattr and selectattr should not raise errors when those attributes don't exist (to my knowledge)?! They will simply not be selected or rejected (like dev tools and template sensors).
My first experiments with selectattr / rejectattr were on 2021 - and on that time I learned that I must check for an attribute existence before using selectattr/rejectattr.
from frontend.
My first experiments with selectattr / rejectattr were on 2021 - and on that time I learned that I must check for an attribute existence before using selectattr/rejectattr.
I agree it is not very robust, But How to do that in filter expressions?! When I lookup a value with state_attr(), I have to check, but in a filter I want to include/exclude entities that match.
I checked several places where I can execute templates (dev tools, template sensors, state switch card etc) and the same filtering works for all, except the markdown card.
Update: @ildar170975 thanks for your hint. This combo of filters works in the markdown as well:
selectattr('attributes.device_class', 'defined') |selectattr('attributes.device_class','eq','connectivity')
It complicates my full template, as I also want the entity's that don't have a device_class attribute (so need to merge two lists). But it's a workaround. Still hope the issue gets solved though.
from frontend.
Other simple example:
{% set entities = states | rejectattr('attributes.device_class','ne','connectivity')| map(attribute='entity_id') | list -%}
{{ entities }}
auto entities card works fine:
Markdown card with the same template fails:
from frontend.
Related Issues (20)
- Error while loading page lovelace on 2024.6.0 HOT 1
- Edit Sections dialog - cancel button doesn't work HOT 1
- Weather-forecast card does not show correct icons and units for some secondary_info_attributes
- Value ON or OFF in dictionary cause error loading blueprint HOT 1
- Accessibility: unable to open/view automation details via the keyboard
- NWS stopedworking after update HOT 1
- Domains in filter sidebar are not ordered by frontend language
- Theme variable box-shadow / ha-card-box-shadow doesn't work with Dashboard view type 'panel'. HOT 4
- Graphical ugliness in automations HOT 1
- A strange window appears in the automations HOT 1
- Android Navigation Back gesture activates buttons on dashboard HOT 1
- "Create helper" button covers menu options
- Experimental sections not correctly handling conditional cards on earlier versions of webview HOT 1
- Area card: Temperature shown 10 °C too high HOT 7
- workday subdivision of country become number HOT 1
- Workday: UI explanation discrepancy HOT 1
- Failed to format translation for key HOT 1
- August Home integration... HOT 1
- Cannot configure webhook URL HOT 1
- Filtering in selector.Select not available with `multiple=False`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frontend.