First off, my apologies for the upcoming written diarrhea that I am about to spew on this post! It’s difficult to gather my thoughts into a cohesive post at the moment as my brain is fried!
I’m already bald, but this is still making me want to pull my hair out!
I’ve watched a ton of YT vids on creating templates. But I find that every single one of them only focuses on the developer tools/template page. None of them actually go to a dashboard and demonstrate clearly how that new ‘whatever’, is used on a card.
My current headache is this
I have door contact sensors. The default presentation of that entity is a blue icon if it’s closed and a greyed-out icon if it’s open. I want to show the icon in ‘green’ if the door is closed and ‘red’ if the door is open. But you can’t put that on the entity of a card. You have to create a special-purpose sensor to show these specific state values.
If you look at the log of the contact sensor, it shows ‘open’ or ‘closed.’ And if you look at the sensor state, it’s either ‘ON’ or ‘OFF.’ So which is it? Are the two values ON and OFF or OPEN and CLOSED?!?!?! There’s consistency for ya!!
Why are there no simple settings in the card builder UI that let you define the icon color based on an entity value? Why are we forced to always go to code to set these things?!?!?!
And then I’ll have to create one for each and every door that I want to display this way. That’s creating a special entity to reference an already existing entity just to customize what is displayed. That is stupid and goes against all advice for code reuse and maintainability.
You can’t put this code on a card. It will error out.
type: custom:mushroom-entity-card
name: Back Door
layout: vertical
fill_container: true
tap_action:
action: none
hold_action:
action: none
double_tap_action:
action: none
entity: binary_sensor.back_door_contact_contact
secondary_info: state
icon_color: >-
{% if is_state("binary_sensor.back_door_contact_contact", "on") %}
Green
{% else %}
Red
{% endif %}
I fully believe that the adoption of HA would be ten times what it is already if the UI was just built in a more accessible way for those that are not full-time developers.
If anyone can recommend any course, video blog whatever that teaches this stuff effectively and clearly. Please send it on over!