mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-24 00:14:26 +01:00
add docs
This commit is contained in:
@@ -631,15 +631,20 @@ class LuiPagesGen(object):
|
||||
def generate_power_page(self, navigation, heading, items):
|
||||
command = f"entityUpd~{heading}~{navigation}"
|
||||
for item in items:
|
||||
entity = apis.ha_api.get_entity(item.entityId)
|
||||
icon_color = self.get_entity_color(entity, overwrite=item.colorOverride)
|
||||
icon = get_icon_ha(item.entityId, overwrite=item.iconOverride)
|
||||
speed = 0
|
||||
if float(entity.state) > 0:
|
||||
speed = str(item.entity_input_config.get("speed", 1))
|
||||
speed = apis.ha_api.render_template(speed)
|
||||
unit = get_attr_safe(entity, "unit_of_measurement", "")
|
||||
command += f"~{icon_color}~{icon}~{speed}~{entity.state} {unit}"
|
||||
if apis.ha_api.entity_exists(item.entityId):
|
||||
entity = apis.ha_api.get_entity(item.entityId)
|
||||
icon_color = self.get_entity_color(entity, overwrite=item.colorOverride)
|
||||
icon = get_icon_ha(item.entityId, overwrite=item.iconOverride)
|
||||
speed = 0
|
||||
if float(entity.state) > 0:
|
||||
speed = str(item.entity_input_config.get("speed", 1))
|
||||
speed = apis.ha_api.render_template(speed)
|
||||
unit = get_attr_safe(entity, "unit_of_measurement", "")
|
||||
command += f"~{icon_color}~{icon}~{speed}~{entity.state} {unit}"
|
||||
elif item.entityId == "delete":
|
||||
command += f"~~~~"
|
||||
else:
|
||||
command += f"~17299~{get_icon_id('mdi:alert-circle-outline')}~~"
|
||||
self._send_mqtt_msg(command)
|
||||
|
||||
def render_card(self, card, send_page_type=True):
|
||||
|
||||
51
docs/card-power.md
Normal file
51
docs/card-power.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# Power Card (v3.9 and higher)
|
||||
|
||||

|
||||
|
||||
```yaml
|
||||
cards:
|
||||
- type: cardPower
|
||||
title: Power Test
|
||||
entities:
|
||||
- entity: sensor.today_energy
|
||||
- entity: delete
|
||||
- entity: sensor.today_energy
|
||||
speed: 3
|
||||
- entity: sensor.today_energy
|
||||
speed: -1
|
||||
- entity: sensor.today_energy
|
||||
speed: -2
|
||||
- entity: sensor.today_energy
|
||||
speed: -3
|
||||
- entity: sensor.today_energy
|
||||
speed: 1
|
||||
- entity: sensor.today_energy
|
||||
speed: 1
|
||||
```
|
||||
|
||||
The first two entities are shown in the middle of the card, all other entities are used around it.
|
||||
|
||||
List of supported config keys of this card:
|
||||
|
||||
key | optional | type | default | description
|
||||
-- | -- | -- | -- | --
|
||||
`type` | False | string | `None` | Used by navigate items
|
||||
`entities` | False | complex | `None` | contains entities of the card
|
||||
`title` | True | string | `None` | Title of the Page
|
||||
`key` | True | string | `None` | Used by navigate items
|
||||
|
||||
List of supported entitiy types for this page:
|
||||
|
||||
- sensor
|
||||
|
||||
Some details about speed:
|
||||
|
||||
It is possible to calculate the speed though home assistant templates, this allows to link the speed to something within your homeassistant.
|
||||
|
||||
If you got a proper configuration for that, feel free to share it, would be a good addition to the documentation.
|
||||
|
||||
```
|
||||
- entity: sensor.today_energy
|
||||
speed: '{{ range(-3, 3) | random }}'
|
||||
```
|
||||
|
||||
BIN
docs/img/card-power.png
Normal file
BIN
docs/img/card-power.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user