mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-18 02:47:00 +01:00
extended icon overwrite
This commit is contained in:
@@ -6898,6 +6898,8 @@ icons = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_icon_id(ma_name):
|
def get_icon_id(ma_name):
|
||||||
|
if "text:" in ma_name:
|
||||||
|
return ma_name.replace("text:","")
|
||||||
ma_name = ma_name.replace("mdi:","")
|
ma_name = ma_name.replace("mdi:","")
|
||||||
if ma_name in icons:
|
if ma_name in icons:
|
||||||
return icons[ma_name]
|
return icons[ma_name]
|
||||||
|
|||||||
@@ -114,7 +114,13 @@ def map_to_mdi_name(ha_type, state=None, device_class=None, cardType=None):
|
|||||||
|
|
||||||
def get_icon_id_ha(ha_type, state=None, device_class=None, overwrite=None):
|
def get_icon_id_ha(ha_type, state=None, device_class=None, overwrite=None):
|
||||||
if overwrite is not None:
|
if overwrite is not None:
|
||||||
return get_icon_id(overwrite)
|
if type(overwrite) is str:
|
||||||
|
return get_icon_id(overwrite)
|
||||||
|
if type(overwrite) is dict:
|
||||||
|
for overwrite_state, overwrite_icon in d.items():
|
||||||
|
if overwrite_state == state:
|
||||||
|
return get_icon_id(overwrite_icon)
|
||||||
|
|
||||||
return get_icon_id(map_to_mdi_name(ha_type, state, device_class))
|
return get_icon_id(map_to_mdi_name(ha_type, state, device_class))
|
||||||
|
|
||||||
def get_action_id_ha(ha_type, action, device_class=None, overwrite=None):
|
def get_action_id_ha(ha_type, action, device_class=None, overwrite=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user