mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-21 21:54:46 +01:00
add docs
This commit is contained in:
@@ -631,15 +631,20 @@ class LuiPagesGen(object):
|
|||||||
def generate_power_page(self, navigation, heading, items):
|
def generate_power_page(self, navigation, heading, items):
|
||||||
command = f"entityUpd~{heading}~{navigation}"
|
command = f"entityUpd~{heading}~{navigation}"
|
||||||
for item in items:
|
for item in items:
|
||||||
entity = apis.ha_api.get_entity(item.entityId)
|
if apis.ha_api.entity_exists(item.entityId):
|
||||||
icon_color = self.get_entity_color(entity, overwrite=item.colorOverride)
|
entity = apis.ha_api.get_entity(item.entityId)
|
||||||
icon = get_icon_ha(item.entityId, overwrite=item.iconOverride)
|
icon_color = self.get_entity_color(entity, overwrite=item.colorOverride)
|
||||||
speed = 0
|
icon = get_icon_ha(item.entityId, overwrite=item.iconOverride)
|
||||||
if float(entity.state) > 0:
|
speed = 0
|
||||||
speed = str(item.entity_input_config.get("speed", 1))
|
if float(entity.state) > 0:
|
||||||
speed = apis.ha_api.render_template(speed)
|
speed = str(item.entity_input_config.get("speed", 1))
|
||||||
unit = get_attr_safe(entity, "unit_of_measurement", "")
|
speed = apis.ha_api.render_template(speed)
|
||||||
command += f"~{icon_color}~{icon}~{speed}~{entity.state} {unit}"
|
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)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def render_card(self, card, send_page_type=True):
|
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