#Attribute as Tile Title
1 messages · Page 1 of 1 (latest)
If you mean the attribute instead of the "Warnung" title, I don't think that's possible. But you could give it a single space as a custom name in the card - that way the title would disappear, but the other test would not become bold.
You could create a template (binary) sensor with a dynamic templated friendly name attribute, the desired entity name as unique_id and no name value declared. 🤔
I opted for a binary sensor with a text attribute of the general highest warning level (e.g. Amtliche Warnung vor markantem Wetter) and a markdown card for full size presentation.
That does not work, it's still not readable. Basically I would like the headline attribute to be the title and the description attribute to be displayed below.
That would work with a seperate template entity with a dynamic friendly name.
Ok, I’ll have a look at that idea.
I did that with Tankerkönig gas price stuff. A sensor showing the nearest and cheapest gas station nearby. Its friendly name changes to the station name on each change.
I can, but the templates themselves are for another integration.
Ok, I got a sensor now, with a custom friendly name. But seems that I cannot set attributes via the ui
looks a bit odd 😉
Do not set a name for the sensor, but a meaningful unique_id only. For example:
template:
- sensor:
- unique_id: wetterwarnung
state: "{{ whatever template }}"
attributes:
friendly_name: "{{ name template }}"
What do you mean by set attributes via UI?
That only works in yaml.
Ok, thanks!
As I said, I only use a template binary sensor for basic warning info and a markdown card for all available weather warnings.
The end product looks like this
If additional warnings are available, they will be added to the markdown card automatically - a list of all warnings.
Older version with a list.
In case you want to use the markdown card as well:
https://dpaste.org/CqcFL
Oh... and you would have to place a DWD icon in /www/images/dwd.png or change that part. 😅
So it seems to work a:
- sensor:
- unique_id: warnung_1
icon: mdi:alert-circle
state: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_1.attributes.description if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_1', 'description') != none }}"
attributes:
friendly_name: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_1.attributes.headline if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_1', 'headline') != none}}"
- sensor:
- unique_id: warnung_2
icon: mdi:alert-circle
state: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_1.attributes.description if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_2', 'description') != none }}"
#state: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_2.attributes.description if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_2', 'description') != none }}"
attributes:
friendly_name: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_2.attributes.headline if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_2', 'headline') != none}}"
- sensor:
- unique_id: warnung_3
icon: mdi:alert-circle
state: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_1.attributes.description if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_3', 'description') != none }}"
#state: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_3.attributes.description if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_3', 'description') != none }}"
attributes:
friendly_name: "{{ states.binary_sensor.warning_hamburg_freie_und_hansestadt_3.attributes.headline if state_attr('binary_sensor.warning_hamburg_freie_und_hansestadt_3', 'headline') != none}}"
But seems that something is breaking while calculating the state...
sensor 1 works, but the texts from 2 and 3 fail the sensor. Is there something to sanitize the values?
Does the description have more than 255 characters? That's the limit.
hi