From d3f0a3a5bc48ebe0bef26a8220e0d15cdb187a58 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 24 Mar 2022 16:08:21 +0100 Subject: [PATCH 1/3] Add name as config item See FR #58 --- apps/nspanel-lovelace-ui/nspanel-lovelace-ui.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/nspanel-lovelace-ui/nspanel-lovelace-ui.py b/apps/nspanel-lovelace-ui/nspanel-lovelace-ui.py index 93f24efb..bbcdb0c8 100644 --- a/apps/nspanel-lovelace-ui/nspanel-lovelace-ui.py +++ b/apps/nspanel-lovelace-ui/nspanel-lovelace-ui.py @@ -433,8 +433,10 @@ class LovelaceUIPanel: def generate_entities_item(self, item): icon = None + name = None if type(item) is dict: - icon = next(iter(item.items()))[1]['icon'] + icon = next(iter(item.items()))[1].get('icon') + name = next(iter(item.items()))[1].get('name') item = next(iter(item.items()))[0] # type of the item is the string before the "." in the item name @@ -449,7 +451,7 @@ class LovelaceUIPanel: return f",text,{item},{get_icon_id('alert-circle-outline')},17299,Not found check, apps.yaml" entity = self.api.get_entity(item) - name = entity.attributes.friendly_name + name = name if name is not None else entity.attributes.friendly_name if item_type == "cover": icon_id = get_icon_id_ha("cover", state=entity.state, overwrite=icon) From 3c2f5646c93e5bb44137eee69ba45fee98e89f93 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 24 Mar 2022 16:10:06 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6942c5f6..bb3a4fdb 100644 --- a/README.md +++ b/README.md @@ -309,9 +309,9 @@ key | optional | type | default | description `class` | False | string | | The name of the Class. `config` | False | complex | | Config/Mapping between Homeassistant and your NsPanel -### Override Icons +### Override Icons or Names -To override Icons of entities you can configure an icon name in your configuration, please see the following example. +To override Icons or Names of entities you can configure an icon or name in your configuration, please see the following example. Only the icons listed in the [Icon Table](HMI#icons-ids) are useable. ```yaml @@ -322,6 +322,7 @@ Only the icons listed in the [Icon Table](HMI#icons-ids) are useable. - light.schreibtischlampe - switch.deckenbeleuchtung_hinten: icon: lightbulb + name: Lampe - delete - delete - type: cardMedia From 4464736b478719eccffac5e599a62d21226d31bc Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 24 Mar 2022 16:11:06 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb3a4fdb..9a620bff 100644 --- a/README.md +++ b/README.md @@ -311,7 +311,7 @@ key | optional | type | default | description ### Override Icons or Names -To override Icons or Names of entities you can configure an icon or name in your configuration, please see the following example. +To override Icons or Names of entities you can configure an icon and/or name in your configuration, please see the following example. Only the icons listed in the [Icon Table](HMI#icons-ids) are useable. ```yaml