Skip to content

Commit

Permalink
fix: recover icon from binary_sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosabot committed Oct 2, 2024
1 parent f883ffd commit 95bfffa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function tapFeedback(feedbackElement) {

export function getIcon(context, entity = context.config.entity, icon = context.config.icon) {
const entityType = entity?.split('.')[0];
const deviceClassType = getAttribute(context, "device_class", entity);
const entityIcon = getAttribute(context, "icon", entity);
const configIcon = icon;
const state = getState(context, entity);
Expand Down Expand Up @@ -290,6 +291,7 @@ export function getIcon(context, entity = context.config.entity, icon = context.
if (configIcon) return configIcon;
if (entityIcon) return entityIcon;
if (defaultIcons[entityType]) return defaultIcons[entityType];
if (defaultIcons[deviceClassType]) return defaultIcons[deviceClassType];

return '';
}
Expand Down

0 comments on commit 95bfffa

Please sign in to comment.