mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-24 00:14:26 +01:00
fixes #622
This commit is contained in:
@@ -209,6 +209,12 @@ def get_action_icon(ha_type, action, device_class=None, overwrite=None):
|
||||
return get_icon_char(actionicon)
|
||||
|
||||
def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
|
||||
|
||||
ha_type = entity_id.split(".")[0]
|
||||
if (apis.ha_api.entity_exists(entity_id)):
|
||||
entity = apis.ha_api.get_entity(entity_id)
|
||||
state = entity.state if stateOverwrite is None else stateOverwrite
|
||||
|
||||
if overwrite is not None:
|
||||
if type(overwrite) is str:
|
||||
return get_icon_char(overwrite)
|
||||
@@ -219,10 +225,6 @@ def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
|
||||
|
||||
result_icon = "alert-circle-outline"
|
||||
|
||||
ha_type = entity_id.split(".")[0]
|
||||
if (apis.ha_api.entity_exists(entity_id)):
|
||||
entity = apis.ha_api.get_entity(entity_id)
|
||||
state = entity.state if stateOverwrite is None else stateOverwrite
|
||||
# icons only based on state
|
||||
if ha_type in simple_type_mapping:
|
||||
result_icon = simple_type_mapping[ha_type]
|
||||
@@ -267,4 +269,4 @@ def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
|
||||
if entity.attributes.media_content_type in media_content_type_mapping:
|
||||
result_icon = media_content_type_mapping[entity.attributes.media_content_type]
|
||||
|
||||
return get_icon_char(result_icon)
|
||||
return get_icon_char(result_icon)
|
||||
|
||||
Reference in New Issue
Block a user