Refine logging, sanitized name separators

This commit is contained in:
Edward Brown 2023-09-02 13:20:55 +01:00
parent 747fca5ab1
commit 33ea83362d
3 changed files with 3 additions and 3 deletions

View file

@ -3,7 +3,7 @@ import string
from pathlib import Path
CHARS_ALLOWED = string.ascii_lowercase + string.digits
SEPS_ALLOWED = '_- '
SEPS = '_- /'
BRANCH = 'release'
CONFIGS_PATH = Path(os.environ['HACO_CONFIGS_PATH'])

View file

@ -36,7 +36,7 @@ async def listen(client, devices):
break
if not device:
msg = f'Got announce from device with no config: Hostname: {data_announce["hostname"]} MAC:{data_announce["mac"]}. Publishing config data.'
msg = f"""Found device with no configuration module assigned. Assign one in Add-On Configuration: "{data_announce["device_name"]}" Hostname: {data_announce["hostname"]} {data_announce["hostname"]} MAC:{data_announce["mac"]}."""
tools.logger.info(msg)
continue

View file

@ -65,7 +65,7 @@ def sanitize_name(s, sep='-'):
chars = []
for c in s.lower():
if c in constants.SEPS_ALLOWED:
if c in constants.SEPS:
chars.append(sep)
elif c in constants.CHARS_ALLOWED:
chars.append(c)