mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-23 13:02:14 +01:00
closes #258
This commit is contained in:
52
README.md
52
README.md
@@ -443,12 +443,42 @@ key | optional | type | default | description
|
|||||||
key | optional | type | default | description
|
key | optional | type | default | description
|
||||||
-- | -- | -- | -- | --
|
-- | -- | -- | -- | --
|
||||||
`type` | False | string | `None` | Used by navigate items
|
`type` | False | string | `None` | Used by navigate items
|
||||||
`entities` | False | complex | `None` | contains entities of the card, applys only to cardEntities and cardGrid
|
`entities` | False | complex | `None` | contains entities of the card, only valid on cardEntities and cardGrid and cardQR
|
||||||
`title` | True | string | `None` | Title of the Page
|
`title` | True | string | `None` | Title of the Page
|
||||||
`entity` | False | string | `None` | contains the entity of the current card, valid for cardThermo, cardAlarm and cardMedia
|
`entity` | False | string | `None` | contains the entity of the current card, valid for cardThermo, cardAlarm and cardMedia
|
||||||
`key` | True | string | `None` | Used by navigate items
|
`key` | True | string | `None` | Used by navigate items
|
||||||
`mediaControl` | True | string | `None` | Only valid on cardMedia, contains the action executed on pressing the top left media icon. (useful to navigate to a hidden card or start a script)
|
`mediaControl` | True | string | `None` | Only valid on cardMedia, contains the action executed on pressing the top left media icon. (useful to navigate to a hidden card or start a script)
|
||||||
|
|
||||||
|
#### Possible configuration values for entities key
|
||||||
|
|
||||||
|
key | optional | type | default | description
|
||||||
|
-- | -- | -- | -- | --
|
||||||
|
`name` | True | string | `None` | Used to override names
|
||||||
|
`icon` | True | string | `None` | Used to override icons
|
||||||
|
`state` | True | string | `None` | Only displayed if Entity state is equal to this value
|
||||||
|
`state_not` | True | string | `None` | Only displayed if Entity state is unequal to this value
|
||||||
|
|
||||||
|
##### Override Icons or Names
|
||||||
|
|
||||||
|
To overwrite 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 Cheatsheet](https://htmlpreview.github.io/?https://github.com/joBr99/nspanel-lovelace-ui/blob/main/HMI/icon-cheatsheet.html) are useable.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
entities:
|
||||||
|
- entity: light.test_item
|
||||||
|
name: NameOverride
|
||||||
|
icon: mdi:lightbulb
|
||||||
|
```
|
||||||
|
|
||||||
|
It is also possible to configure different icon overwrites per state:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
icon:
|
||||||
|
"on": mdi:lightbulb
|
||||||
|
"off": mdi:lightbulb
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Possible configuration values for screensaver config
|
#### Possible configuration values for screensaver config
|
||||||
|
|
||||||
@@ -556,26 +586,6 @@ The following example configuration does nothing during the day but at night, if
|
|||||||
brightness: 20
|
brightness: 20
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Override Icons or Names
|
|
||||||
|
|
||||||
To overwrite 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 Cheatsheet](https://htmlpreview.github.io/?https://github.com/joBr99/nspanel-lovelace-ui/blob/main/HMI/icon-cheatsheet.html) are useable.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
entities:
|
|
||||||
- entity: light.test_item
|
|
||||||
name: NameOverride
|
|
||||||
icon: mdi:lightbulb
|
|
||||||
```
|
|
||||||
|
|
||||||
It is also possible to configure different icon overwrites per state:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
icon:
|
|
||||||
"on": mdi:lightbulb
|
|
||||||
"off": mdi:lightbulb
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Also it is possible to configure a text or a character by using "text:" as a prefix instead of an icon. `icon: text:X`
|
Also it is possible to configure a text or a character by using "text:" as a prefix instead of an icon. `icon: text:X`
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ class Entity(object):
|
|||||||
if type(entity_input_config) is not dict:
|
if type(entity_input_config) is not dict:
|
||||||
#self._ha_api.log("Config error, not a dict check your entity configs")
|
#self._ha_api.log("Config error, not a dict check your entity configs")
|
||||||
self.entityId = "error"
|
self.entityId = "error"
|
||||||
self.nameOverride = None
|
|
||||||
self.iconOverride = None
|
|
||||||
else:
|
else:
|
||||||
self.entityId = entity_input_config.get("entity", "unknown")
|
self.entityId = entity_input_config.get("entity", "unknown")
|
||||||
self.nameOverride = entity_input_config.get("name")
|
self.nameOverride = entity_input_config.get("name")
|
||||||
self.iconOverride = entity_input_config.get("icon")
|
self.iconOverride = entity_input_config.get("icon")
|
||||||
|
self.colorOverride = entity_input_config.get("color")
|
||||||
|
self.condState = entity_input_config.get("state")
|
||||||
|
self.condStateNot = entity_input_config.get("state_not")
|
||||||
|
|
||||||
class Card(object):
|
class Card(object):
|
||||||
def __init__(self, card_input_config, pos=None):
|
def __init__(self, card_input_config, pos=None):
|
||||||
|
|||||||
@@ -146,10 +146,10 @@ class LuiPagesGen(object):
|
|||||||
state = None
|
state = None
|
||||||
self._send_mqtt_msg(get_screensaver_color_output(theme=theme, state=state))
|
self._send_mqtt_msg(get_screensaver_color_output(theme=theme, state=state))
|
||||||
|
|
||||||
def generate_entities_item(self, entity, cardType):
|
def generate_entities_item(self, item, cardType):
|
||||||
entityId = entity.entityId
|
entityId = item.entityId
|
||||||
icon = entity.iconOverride
|
icon = item.iconOverride
|
||||||
name = entity.nameOverride
|
name = item.nameOverride
|
||||||
# type of the item is the string before the "." in the entityId
|
# type of the item is the string before the "." in the entityId
|
||||||
entityType = entityId.split(".")[0]
|
entityType = entityId.split(".")[0]
|
||||||
|
|
||||||
@@ -176,6 +176,12 @@ class LuiPagesGen(object):
|
|||||||
|
|
||||||
# HA Entities
|
# HA Entities
|
||||||
entity = self._ha_api.get_entity(entityId)
|
entity = self._ha_api.get_entity(entityId)
|
||||||
|
# check state for if a condition is defined
|
||||||
|
if item.condState is not None and item.condState == entity.state:
|
||||||
|
return ""
|
||||||
|
if item.condStateNot is not None and item.condState != entity.state:
|
||||||
|
return ""
|
||||||
|
|
||||||
name = name if name is not None else entity.attributes.friendly_name
|
name = name if name is not None else entity.attributes.friendly_name
|
||||||
if entityType == "cover":
|
if entityType == "cover":
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user