mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-14 08:58:17 +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)
|
return get_icon_char(actionicon)
|
||||||
|
|
||||||
def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
|
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 overwrite is not None:
|
||||||
if type(overwrite) is str:
|
if type(overwrite) is str:
|
||||||
return get_icon_char(overwrite)
|
return get_icon_char(overwrite)
|
||||||
@@ -219,10 +225,6 @@ def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
|
|||||||
|
|
||||||
result_icon = "alert-circle-outline"
|
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
|
# icons only based on state
|
||||||
if ha_type in simple_type_mapping:
|
if ha_type in simple_type_mapping:
|
||||||
result_icon = simple_type_mapping[ha_type]
|
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:
|
if entity.attributes.media_content_type in media_content_type_mapping:
|
||||||
result_icon = media_content_type_mapping[entity.attributes.media_content_type]
|
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