Skip to content

Commit

Permalink
more reliable friendly names handling, fixes #20 #21
Browse files Browse the repository at this point in the history
  • Loading branch information
benleb committed Jun 9, 2020
1 parent e7aff47 commit 26ddf2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/ench/ench.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ def hl(text: Union[int, float, str]) -> str:


def hl_entity(entity: str) -> str:
domain, entity = entity.split(".")
return f"{domain}.{hl(entity)}"
if (len(splitted := entity.split(".")) > 1):
return f"{splitted[0]}.{hl(splitted[1])}"
else:
return f"{hl(entity)}"


class EnCh(hass.Hass): # type: ignore
Expand Down

0 comments on commit 26ddf2c

Please sign in to comment.