[Bug]: HA State Object (state.state / etc.) not working in Template Card
See original GitHub issueCurrent Behavior
Configure a Template Card (via GUI or YAML) and setting the optional Entity Parameter. Then trying to use the Home Assistant State Object to make Templating simpler (not having to type out the entity_id every time, etc.) does not seem to work:
Maybe I’m just doing it wrong, but as far as I can see, it currently doesn’t work.
Thank you!
Expected Behavior
Being able to use the State Object and its properties in the Template Card.
Steps To Reproduce
- Edit Dashboard
- Add new Mushroom-Template-Card
- Set Entity Parameter to any available Entity
- Enter the following in Primary or Secondary Information:
{{ state.state }}
- Save the changes and take a look at the new Card on the Dashboard
Example configuration
type: custom:mushroom-template-card
primary: '{{ state.name }}'
secondary: '{{ state.state }}'
entity: zone.home
Environment
- OS: Raspbian 11 (bullseye)
- HA Core Version: 2022.8.6 (container)
- HA Frontend Version: 20220802.0 - latest
- Lovelace-Mushroom Version: v2.1.3 (via HACS)
Anything else?
State Object Documentation: https://www.home-assistant.io/docs/configuration/state_object
Templating Documentation: https://www.home-assistant.io/docs/configuration/templating/
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Lovelace card-templater card (Jinja2 card templating in ...
I tried it yesterday and I saw in the dev tools states page that it changed the actual state there. You won't see...
Read more >Usage - Floorplan for Home Assistant - GitHub Pages
Observe the HA media_player.tv entity for state changes. Action triggers: When the SVG element (i.e. button.power ) is tapped / clicked, call ...
Read more >Bug listing with status RESOLVED with resolution FIXED as at ...
_* in /etc" status:RESOLVED resolution:FIXED severity:enhancement · Bug:195 ... Bug:1455 - "USE broken: -item in USE enviroment variable does not work" ...
Read more >RomRider/apexcharts-card - GitHub
A Lovelace card to display advanced graphs and charts based on ... Eg: if the state is 345 and as_duration is set to...
Read more >Cisco Firepower Release Notes, Version 6.4 - Security
Open and Resolved Bugs. ... Users not showing correctly in FDM Events ... mode flow table memory usage to reduce the probability of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
0
is considered asfalse
by the template system so it doesn’t render. I saw workaround for this issue but I can’t find her anymore 😅For templating the doc is here : https://www.home-assistant.io/docs/configuration/templating/ Mushroom expose two additional variables :
I agree, it should be in the template documentation 🙂 https://github.com/piitaya/lovelace-mushroom/blob/main/docs/cards/template.md
For some reason it wouldn’t display the secondary information (current value = 0). I then changed it to “{{ states(entity) ~ ’ Personen’ }}” and then it is displayed.
Other than that it works flawlessly.
Is this documented somewhere and i just overlooked it? If it isnt, then where should it be documented?
Thank you very much!