diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index b5cd714db..40af1c486 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -7360,14 +7360,17 @@ action: {% elif entity_state in ["pending", "arming"] %}{{ all_icons["shield-outline"] }} {% else %}{{ all_icons["shield-alert-outline"] }} {% endif %} - {% elif entity_domain in ["binary_sensor", "cover", "sensor", "switch"] %} + {% elif + entity_domain in ["binary_sensor", "cover", "sensor", "switch"] and + entity_device_class is defined and entity_device_class is string and entity_device_class | length > 0 and + entity_state is defined and entity_state is string and entity_state | length > 0 %} {% set entity_device_class_icon = entity_device_class + "-" + entity_state %} - {% set entity_device_class_icon = device_class_icons.[entity_domain][entity_cover_icon] if entity_device_class_icon in device_class_icons[entity_domain] else icon_domain %} + {% set entity_device_class_icon = device_class_icons[entity_domain][entity_cover_icon] if entity_device_class_icon in device_class_icons[entity_domain] else icon_domain %} {{ all_icons[entity_device_class_icon] if entity_device_class_icon in all_icons else icon_domain }} {% else %} {{ - all_icons[entity_icon.split(":")[1]] | default(icon_domain) - if entity_id_is_valid and entity_icon is string and entity_icon.split(":") | count == 2 + all_icons[entity_icon.split(":")[1]] + if entity_id_is_valid and entity_icon is string and entity_icon.split(":") | count == 2 and entity_icon.split(":")[1] in all_icons else icon_domain }} {% endif %}