Edit 2:
Well…looking closer at widget definitions I realize sensor widgets don’t have icons. So, I believe the better way to solve my problem is going to be to find/build a sensor-with-icon widget type, and I imagine i’ll be solving these attribute-reference problems through different means. Still curious if what I was trying to do with at least the friendly name would work, but it’s now less important.
#
Like what seem like half the questions here I’m currently working on a weather app, but I think this question is simple, I just can’t seem to get to the bottom of it…
Very simply, I have sensors that are working in home assistant with a value, icon, and friendly_name.
I want to use these same values in hadashboard.
So, for instance, a sensor named sensor.forecast_4 has the attributes:
friendly_name: Saturday
icon: mdi:weather-pouring
I believe I should be able to use these attributes in my hadashboard widget definition like so:
forecast_4:
title: {{ states.sensor.forecast_4.attributes.friendly_name }}
widget_type: sensor
entity: sensor.forecast_4
icon: {{ states.sensor.forecast_4.attributes.icon|replace(':','-') }}
I’ve tried lots of variations
{{ states.sensor.forecast_4.attributes.friendly_name }}
“{{ states.sensor.forecast_4.attributes.friendly_name }}”
{{ sensor.forecast_4.attributes.friendly_name }}
{{ states.sensor.forecast_4.friendly_name }}
And I’m not positive about that |replace(’:’,’-’) to use the mdi icon in the hadashboard format, but just one problem at a time. Most of these variations are throwing:
found unhashable key while constructing a mapping
Is this something I should be able to do?
Thank you!
edit: typo