Compare commits

..

5 Commits

Author SHA1 Message Date
Johannes Braun
529b0516f4 implementes #539 2022-12-25 15:43:23 +01:00
Johannes
b9504a2ff0 fixes #631 2022-12-25 10:32:45 +01:00
Johannes
b4b988b735 fixes #630 2022-12-24 23:47:02 +01:00
Johannes
d3ab908507 Update issue-close-app.yml 2022-12-24 22:54:14 +01:00
Johannes
2ee79debd0 Update card-climate.md 2022-12-24 00:44:07 +01:00
5 changed files with 24 additions and 14 deletions

View File

@@ -5,10 +5,10 @@
# Comment that will be sent if an issue is judged to be closed. # Comment that will be sent if an issue is judged to be closed.
comment: >- comment: >-
This issue has been automatically closed because the TEMPLATE is missing or incomplete. This issue has been automatically closed because the TEMPLATE (it's the stuff you deleted from the issue while opening) is missing or incomplete.
Filling the template is required so standard questions don't need to be asked again each time. Filling the template is required so standard questions don't need to be asked again each time.
THe ability to provide assistance is greatly hampered if few minutes are not taken to complete the issue template The ability to provide assistance is greatly hampered if few minutes are not taken to complete the issue template
with the requested information. The details requested potentially affect which options to pursue. The small amount with the requested information. The details requested potentially affect which options to pursue. The small amount
of time you will spend completing the template will also help the volunteers, providing assistance to you, to reduce of time you will spend completing the template will also help the volunteers, providing assistance to you, to reduce
the time required to help you. the time required to help you.
@@ -19,14 +19,16 @@ comment: >-
[Docs](https://docs.nspanel.pky.eu) for more information. [Docs](https://docs.nspanel.pky.eu) for more information.
IF YOU THINK THIS IS WAS CLOSED AS A FALSE POSITIVE or you just didn't find a template that matches your request, please do not open another issue, closed issues will also be monitored.
issueConfigs: issueConfigs:
# There can be several configs for different kind of issues. # There can be several configs for different kind of issues.
- content: - content:
# template 1: bug report # template 1: bug report
- "PROBLEM DESCRIPTION" - "PROBLEM DESCRIPTION"
# - "REQUESTED INFORMATION" - "REQUESTED INFORMATION"
# - "TO REPRODUCE" - "TO REPRODUCE"
# - "EXPECTED BEHAVIOUR" - "EXPECTED BEHAVIOUR"
- content: - content:
# template 2: feature request # template 2: feature request
- "FEATURE DESCRIPTION" - "FEATURE DESCRIPTION"

View File

@@ -1,5 +1,6 @@
import colorsys import colorsys
import math import math
import apis
def scale(val, src, dst): def scale(val, src, dst):
""" """
@@ -37,6 +38,8 @@ def rgb_brightness(rgb_color, brightness):
return [int(red), int(green), int(blue)] return [int(red), int(green), int(blue)]
def rgb_dec565(rgb_color): def rgb_dec565(rgb_color):
if type(rgb_color) is str:
rgb_color = apis.ha_api.render_template(rgb_color)
red = rgb_color[0] red = rgb_color[0]
green = rgb_color[1] green = rgb_color[1]
blue = rgb_color[2] blue = rgb_color[2]

View File

@@ -25,7 +25,7 @@ class LuiPagesGen(object):
def get_entity_color(self, entity, ha_type=None, overwrite=None): def get_entity_color(self, entity, ha_type=None, overwrite=None):
if overwrite is not None: if overwrite is not None:
if type(overwrite) is list: if type(overwrite) in [str, list]:
return rgb_dec565(overwrite) return rgb_dec565(overwrite)
if type(overwrite) is dict: if type(overwrite) is dict:
state = entity.state state = entity.state
@@ -455,16 +455,16 @@ class LuiPagesGen(object):
icon_res = "".join(icon_res_list) icon_res = "".join(icon_res_list)
if len(icon_res_list) == 1: if len(icon_res_list) == 1 and not self._config.get("model") == "us-p":
icon_res = "~"*4 + icon_res_list[0] + "~"*4*6 icon_res = "~"*4 + icon_res_list[0] + "~"*4*6
elif len(icon_res_list) == 2: elif len(icon_res_list) == 2 and not self._config.get("model") == "us-p":
icon_res = "~"*4*2 + icon_res_list[0] + "~"*4*2 + icon_res_list[1] + "~"*4*2 icon_res = "~"*4*2 + icon_res_list[0] + "~"*4*2 + icon_res_list[1] + "~"*4*2
elif len(icon_res_list) == 3: elif len(icon_res_list) == 3 and not self._config.get("model") == "us-p":
icon_res = "~"*4*2 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4 icon_res = "~"*4*2 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4
elif len(icon_res_list) == 4: elif len(icon_res_list) == 4 and not self._config.get("model") == "us-p":
icon_res = "~"*4 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4 + icon_res_list[3] icon_res = "~"*4 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4 + icon_res_list[3]
elif len(icon_res_list) >= 5: elif len(icon_res_list) >= 5 or self._config.get("model") == "us-p":
icon_res = "~"*4 + "".join(icon_res_list) + "~"*4*(7-len(icon_res_list)) icon_res = "".join(icon_res_list) + "~"*4*(8-len(icon_res_list))
currently_translation = get_translation(self._locale, "frontend.ui.card.climate.currently") currently_translation = get_translation(self._locale, "frontend.ui.card.climate.currently")
state_translation = get_translation(self._locale, "frontend.ui.panel.config.devices.entities.state") state_translation = get_translation(self._locale, "frontend.ui.panel.config.devices.entities.state")
@@ -486,7 +486,7 @@ class LuiPagesGen(object):
else: else:
media_icon = self.generate_entities_item(entity, "cardGrid") media_icon = self.generate_entities_item(entity, "cardGrid")
ha_entity = apis.ha_api.get_entity(entityId) ha_entity = apis.ha_api.get_entity(entityId)
heading = title if title != "unknown" else entity.attributes.friendly_name heading = title if title != "unknown" else ha_entity.attributes.friendly_name
title = get_attr_safe(ha_entity, "media_title", "") title = get_attr_safe(ha_entity, "media_title", "")
author = get_attr_safe(ha_entity, "media_artist", "") author = get_attr_safe(ha_entity, "media_artist", "")
volume = int(get_attr_safe(ha_entity, "volume_level", 0)*100) volume = int(get_attr_safe(ha_entity, "volume_level", 0)*100)

View File

@@ -20,7 +20,7 @@ List of supported config keys of this card:
key | optional | type | default | description key | optional | type | default | description
-- | -- | -- | -- | -- -- | -- | -- | -- | --
`type` | False | string | `None` | Type of the card `type` | False | string | `None` | Type of the card
`entities` | False | complex | `None` | contains a list of entities of this card `entity` | False | string | `None` | contains the entitiy of this card
`title` | True | string | `None` | Title of the Page `title` | True | string | `None` | Title of the Page
`temperatureUnit` | True | string | `celsius` | set this to fahrenheit to change the temperatureUnit on the page `temperatureUnit` | True | string | `celsius` | set this to fahrenheit to change the temperatureUnit on the page
`key` | True | string | `None` | Used by navigate items in combination with the type (cardEntities_key) `key` | True | string | `None` | Used by navigate items in combination with the type (cardEntities_key)

View File

@@ -45,6 +45,11 @@ It is also possible to configure different color overwrites per state:
"on": [255,0,0] "on": [255,0,0]
"off": [0,0,255] "off": [0,0,255]
``` ```
Dynamic color overwrites using homeassistant templates:
```yaml
color: '{{iif(states("binary_sensor.test")=="on", "[0,255,0]", "[255,165,0]")}}'
```
It is also possible to use text instead of icons with `text:X` It is also possible to use text instead of icons with `text:X`